a) For each line
that works with the stack, after that instruction is complete fill in what is
on the stack (fill in
simple picture; this picture goes with this instruction not the ones above) and
give the value to the
stack pointer (SP):
NOTE: for the `jsr’ instruction give
the stack and stack pointer information inside the function
on entry; the stack and stack
pointer by that instruction is for exit information.Also, for the
return address on the stack, just
indicate the return address high byte with a `rhh’ and the return
address low byte with a `rll
in the correct place on the stack.
b) if the instruction works with the X register, give its value:
c) if the instruction works with A register, give its value:
d) if the instruction works with B register, give its value:
RAM equ $0010
STACK equ $00ff
EEPROM equ $f800
RESET equ $fffe
org EEPROM
start lds #STACK SP = 00ff | |
--------------
| |
--------------
des SP = 00fe | ? |
--------------
| |
--------------
ldaa #1 A = 01 | 01 |
--------------
psha SP = 00fd | ? |
--------------
| |
--------------
| 05 |
--------------
ldaa #5 A = 05 | 01 |
--------------
psha SP = 00fc | ? |
--------------
| |
--------------
| ? |
--------------
| ? |
--------------
| 05 |
--------------
| 01 |
--------------
jsr add SP = 00fc | 06 |
--------------
| |
--------------
| ? |
--------------
| ? |
--------------
| ? |
--------------
| 01 |
--------------
pulb B = 05 SP = 00fd | 06 |
--------------
| |
--------------
| ? |
--------------
| ? |
--------------
| ? |
--------------
| ? |
--------------
pulb B = 01 SP = 00fe | 06 |
--------------
| |
--------------
| ? |
--------------
| ? |
--------------
| ? |
--------------
ldab #2 B = 02 | ? |
--------------
pula A = 06 SP = 00ff | ? |
--------------
sba A = 04 B = 02
eloop bra eloop
| |
--------------
| rhh |
--------------
| rll |
--------------
| 05 |
--------------
| 01 |
--------------
add tsx X = 00fb SP = 00fa | ? |
--------------
ldaa 2,x A = 05 X = 00fb
ldab 3,x B = 01 X = 00fb
aba A = 06 B = 01
| |
--------------
| rhh |
--------------
| rll |
--------------
| 05 |
--------------
| 01 |
--------------
staa 4,x A = 06 X = 00fb | 06 |
--------------
rts
org RESET
fdb start