The assembly instructions of Main program and Subroutine MYADD are given below.
ID: 3803537 • Letter: T
Question
The assembly instructions of Main program and Subroutine MYADD are given below.
Assume that the starting address of main program is $2000 and Subroutine MYADD is 2FE0.
Sum dc.B 0
Main
LDS #$1FFF LDAA #51
LDAB # 49 JSR MYADD
Loop
BRA LOOP
MYADD
PSHA
PSHB
ABA
STAA Sum PULB PULA
RTS
In front of each instruction specify the addressing mode
Show the contents of stack after JSR MYADD instruction is executed
Show the contents of stack after PSHB instruction is executed
Show the contents of stack after RTS instruction is executed
Explanation / Answer
Main
LDR R1 , N ;
MOV R0 , #0 ;
BL SUMUP ;
LDR R3, =SUMP ;
STR R0, [ R3 ] ;
B STOP
SUMUP PROC ;
ADD R0 , R0 , R1 ;
SUBS R1 , R1 , #1 ;
BGT SUMUP ;
BX LR ;
ENDP
N DCD 5
ALIGN
STOP
END
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.