Motorola M68000 User's Guide Page 129

  • Download
  • Add to my manuals
  • Print
  • Page
    / 256
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 128
Subroutines 115
ADDQ.L
MOVEA.L
ADD.W
MOVEM.L
RTS
#4/AO
(AO),A1
(Al)/DO
(SP)+/A0-A1
-> 2ND. ARG
RESTORE REGS
12
13
14.
15.
ARGLST :DC.L A
DC.L B
A: DC.W
I
B;
DC.W 1
11. The return address is pushed onto the stack, and control transfers to
the location specified by the operand of the JSR.
The return address is popped from the stack, and control transfers to
the return address.
There is no matching pop to the push of DO onto the stack, and there
fore the RTS instruction will not obtain the correct return address.
The DO register is not saved and restored by the procedure.
16.
17.
SKIPLINES: MOVE.L DO(SP) SAVE DO
NEXT:
JSR NEWLINE
OUTPUT NEWLINE
SUBQ.L #1/DO
DECREMENT COUNT
BNE NEXT
BRANCH IF MORE
MOVE.L (SP)+/D0
RTS
RESTORE DO
caller can use an
ADD instruction
to register SP.
PAIRS: MOVE.L
DO/-(SP)
SAVE DO
MOVE.L
12(SP)/DO
GET VAL1
JSR
OUTDEC
OUTPUT
MOVE.B
#' '
BLANK
JSR
PUTC OUTPUT BLANK
MOVE.L
8 (SP)/DO GET VAL2
JSR
OUTDEC OUTPUT
JSR NEWLINE
MOVE.L
RTS
(SP) +,D0 RESTORE DO
18.
Note that VAL2 is at 8(SP) because of the extra 4 bytes used when
we saved DO on the stack. VAL1 is at 12(SP) because it was pushed
first.
With call by value, a copy of the data is placed on the stack. With
call by reference, the address of the data is placed on the stack.
19.
PEA ALPHA
Page view 128
1 2 ... 124 125 126 127 128 129 130 131 132 133 134 ... 255 256

Comments to this Manuals

No comments