Write and assemble a program to a Set SP 9D b Put a differe

Write and assemble a program to:

a)     Set SP = $9D,

b)    Put a different value in each of RAM locations $9D, $9C, $9B, $9A, $99, and $98,

c)     POP each stack location into registers R20 – R24.

d)    Use the simulator to single-step and examine the registers, the stack, and the stack pointer.

Solution

;[a]


.INCLUDE \"M32DEF.INC\"
  

LDI R20, HIGH($9D)
OUT SPH, R20
LDI R20, LOW($9D)
OUT SPL, R20

;[b]


LDI R16, 1
STS $98, R16
LDI R16, 2
STS $99, R16
LDI R16, 3
STS $9A, R16
LDI R16, 4
STS $9B, R16
LDI R16, 5
STS $9C, R16
LDI R16, 6
STS $9D, R16

;[c]

POP R20
POP R21
POP R22
POP R23
POP R24

;[d]

L1: RJMP L1

Write and assemble a program to: a) Set SP = $9D, b) Put a different value in each of RAM locations $9D, $9C, $9B, $9A, $99, and $98, c) POP each stack location

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site