User's Manual

PMAC User Manual
150 Computational Features
Array Writing
Writing to a set of P-variables as an array must be done with indirect addressing techniques. To set this
up, first define an M-variable to point to P0 (e.g. M0->L:$1000). Next, define a second M-variable to
point to the lowest twelve bits of the first M-variable’s definition word which is in Y-register $BC00 (e.g.
M10->Y:$BC00,0,12 defines M10 to the low 12 bits of the definition word for M0). To point to the
definition word for M1, use Y-register $BC01; for M2, Y:$BC02; for M100, Y:$BC64 (64 hex is 100
decimal); for M1023, Y:$BFFF.
Now, by giving a value to the second M-variable, it changes which P-variable the first M-variable points
to. In the example, the command M10=5 makes M0 point to variable P5.
Once the first M-variable has been pointed to a particular P-variable, giving a value to this M-variable
writes that value into the addressed P-variable. Continuing the example, the command M0=73 writes a
value of 73 to P5.
Example:
To create a sine table with one entry per degree in P-variables P0 to P359, use the following program
segment (this assumes the use of M0 and M10 as set up above):
P1000=0 ; Starting value for array index
WHILE (P1000<360) ; Loop until done
M10=P1000 ; Point M0 to the proper P-variable
M0=SIN (P1000) ; Assign the sine value to this P-variable
P1000=P1000+1 ; Increment the array index
ENDWHILE
Special-Use P-Variable
If a command consisting simply of a constant value is sent to PMAC, PMAC assigns that value to
variable P0, unless a special table buffer such as a compensation table or stimulus table has been defined
but not filled – in that case, the constant value will be entered into the table. For example, if the
command 342<CR> is sent to PMAC, it will interpret it as P0=342<CR>. This capability is intended to
facilitate simple operator terminal interfaces. It does mean, however, that it is not a good idea to use P0
for other purposes, because it is easy to change this accidentally.
Q-Variables
Q-variables, like P-variables, are general-purpose user variables: 48-bit floating-point variables at fixed
locations in memory, with no pre-defined use. However, the meaning of a given Q-variable (and hence
the value contained in it) is dependent on which coordinate system is utilizing it. This allows several
coordinate systems to use the same program (for instance, containing the line X(Q1+25) Y(Q2), but to do
have different values in their own Q variables (which in this case, means different destination points).
Allotting Q-Variables
There are a total of 1024 Q-variables. If you are only using a single coordinate system (Coord.Sys. 1 —
specified as &1), you may use all of these: Q0 to Q1023. The Q-variables of Coordinate System 2 (&2)
overlap these: Q0 of &2 is the same thing as Q512 of &1, and Q511 of &2 is the same thing as Q1023 of
&1. (The Q buffer is actually rotary, so Q512 of &2 is the same thing as Q0 of &1, and Q1023 of &2 is
Q511 of &1.) Thus, both coordinate systems have 512 unique Q-variables: Q0 to Q511.
There is no protection against overwriting another coordinate system's Q- variables. It is the user's
responsibility to keep Q-numbers within the proper range.