5.54. Push Multiple Registers onto the Stack


Addr
Mode  Mnemonic          Format/Opcode
                           8      4      4
                        ----------------------
S     PSHM   RA,RB      |  9F  |  RA  |  RB  |
                        ----------------------

Description. For RA <= RB, the contents of RB through RA are pushed onto a stack in memory using R15 as the stack pointer. As each register contents are pushed onto the memory stack, R15 is decremented by one word for each word pushed. On completion, R15 points to the last item on the stack, the contents of RA.

For RA > RB, the contents of RB through R0, and then the contents of R15 through RA, are pushed onto the stack. On completion, R15 points to the last item on the stack, the contents of RA.

In both cases, successive increasing addresses on the stack correspond to successive increasing register addresses, with a point discontinuity between R15 and R0 in the latter case.

PSHM R3,R5 results in:


           --------------
(R15) -->= |    (R3)    |
           --------------
           |    (R4)    |
           --------------
           |    (R5)    |
           --------------

PSHM R14,R2 results in:


           --------------
(R15) -->= |    (R14)   |
           --------------
           |    (R15)   |
           --------------
           |    (R0)    |
           --------------
           |    (R1)    |
           --------------
           |    (R2)    |
           --------------

Register Transfer Description.

if RA <= RB then
    for i = 0 thru RB - RA do
        begin
        (R15) <-- (R15) - 1;
        [(R15)] <-- (RB - i);
        end;
else
        begin
        for i = 0 thru RB do
            begin
            (R15) <-- (R15) - 1;
            [(R15)] <-- (RB - i);
            end;
        for i = 0 thru 15 - RA do
            begin
            (R15) <-- (R15) - 1;
            [(R15)] <-- (R15 - i);
            end;
        end;



Registers Affected. R15