Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
;=================================================
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

Under what circumstances are pay differentials justified?

Answered: 1 week ago