User's Manual

PMAC User Manual
266 Writing a Host Communications Program
In this example, PMAC will have six characters waiting to be read: 19.2<CR><ACK>. (Assume that I-
variable I3 is set to 2.) The data will be in the registers as follows:
Address
$7FA001 $7FA003 $7FA005 $7FA007 $7FA009
Mailbox #
0 1 2 3 4
Character
1 9 . 2
<CR>
Start reading the characters at $7FA001, mailbox register 0. There is a <CR> in mailbox register 4, so
stop reading, and write a $00 into mailbox register 1 to tell PMAC it is fine to send more. Since PMAC
must still send the final <ACK> it interrupts again, and it is in the mail box registers:
Address
$7FA001 $7FA003 $7FA005 $7FA007 $7FA009
Mailbox #
0 1 2 3 4
Character
<ACK>
9 . 2
<CR>
Now start and stop at mailbox register 0, because it contains an <ACK>. Now, simply read in these
characters beginning with mailbox register #0 at $7FA001. Never write into mailbox register #1 when
sending data to PMAC VME. This is because PMAC will be allowed to write new data into the mailbox
registers as soon as we write to mailbox #1. (Incidentally, it actually does not matter what value is
written into mailbox register #1, it is a fact that this register is written to that counts. However, it is
recommended to write a value of $00 into mailbox register #1 for reasons given later.) After writing a
$00 into mailbox register #1, PMAC may or may not interrupt again, depending on whether or not PMAC
still has more data to be read.
Example
Again assume that the command to ask for the contents of memory locations X:$1000 through X:$1002
has been sent: RHX$1000,3<CR>. These three locations contain the values $123456, $789012, and
$345678. To go and read the mailbox registers, send the above command line and service the interrupt
PMAC generates (using an interrupt vector of $A0).
After PMAC has processed the command and put data into the mailbox registers, PMAC interrupts a
second time with an interrupt vector $A1. Remember, this second interrupt is sent because PMAC has
just now placed data in the mailbox registers, which is now ready to be read.
Service the second interrupt and note that the accompanying interrupt vector is $A1. Read the data in the
mailbox registers. In this example, PMAC will have 22 characters to be read: 123456 789012
345678<CR> <ACK>, with the first 16 of them in the mailbox registers. (Assume that I-variable I3 is
set to 2 again.) The data will be in the registers as follows:
Address
$7FA001 $7FA003 $7FA005 $7FA007 $7FA01D $7FA01F
Mailbox #
0 1 2 3 14 15
Character
1 2 3 4 3 4
Read the mailbox registers, beginning with the first one until a <CR>, <ACK>, <BELL> is encountered,
or all 16 registers have been read. In this case, the first 16 characters PMAC has does not contain a
<CR>, <ACK>, or <BELL>. Therefore read all 16 mailbox registers to obtain the first 16 characters of
the PMAC response, and then write $00 to mailbox register #1 (in this case, at $7FA003) to allow PMAC
to put the next chunk of data in the mailbox registers. PMAC interrupts again with vector $A1, and the
remainder of the characters in the mailbox registers are:
Address
$7FA001 $7FA003 $7FA005 $7FA007 $7FA01D $7FA01F
Mailbox #
0 ... 4 5 14 15
Character
5 ...
<CR>
2 3 4