Question: Please do this problem, particular the second subroutine . orig x 3 0 0 0 LD R 6 , top _ stack _ addr ;

Please do this problem, particular the second subroutine
.orig x3000
LD R6, top_stack_addr ; Load the stack pointer
; Test harness
;-------------------------------------------------
LD R4, LOAD_FILL_VALUE_3200 ; Load the address of the first subroutine
JSRR R4 ; Call the first subroutine
ADD R0, R0, #1 ; Increment the value in R0 by 1
LD R4, OUTPUT_AS_DECIMAL_3400 ; Load the address of the second subroutine
JSRR R4 ; Call the second subroutine
LDR R7, R6, #0 ; Restore R7 from the stack
ADD R6, R6, #1 ; Adjust the stack pointer
HALT
; Test harness local data
;-------------------------------------------------
top_stack_addr .fill xFE00
LOAD_FILL_VALUE_3200.fill x3200
OUTPUT_AS_DECIMAL_3400.fill x3400
.END
;=================================================
; Subroutine: LOAD_FILL_VALUE_3200
; Parameter: None
; Postcondition: Loads a hard-coded value (x3200) into R0
; Return Value: The hard-coded value in R0
;=================================================
.ORIG x3200
; Backup registers
ADD R6, R6, #-1
STR R7, R6, #0 ; Save R7 to the stack
; Code
LD R0, FILL_VALUE ; Load hard-coded value into R0
; Restore registers
LDR R7, R6, #0 ; Restore R7 from the stack
ADD R6, R6, #1 ; Adjust the stack pointer
RET
FILL_VALUE .FILL x3200
.END
;=================================================
; Subroutine: OUTPUT_AS_DECIMAL_3400
; Parameter: // Fixme
; Postcondition: // Fixme
; Return Value: // Fixme
;=================================================
 Please do this problem, particular the second subroutine .orig x3000 LD

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!