Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please fix this program, using the following method ;load 1 0 0 0 0 ( called reference ) ;loop: ; subtract 1 2 8 0

please fix this program, using the following method
;load 10000(called reference)
;loop:
; subtract 12801 by 10000
; if resulting number in the 10000's is positive or zero, increment a counter by 1
; if resulting number in is negative, dont increment counter and do following:
; print counter
; divide reference by 10
; start checking the matching ten's place. if reference is 1000, subtract 2801 with 1000
;Repeat this until you print out the complete number "12801"
here is the code for the test harness and the first subroutine
.orig x3000
; 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
HALT
; Test harness local data
;-------------------------------------------------
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
; Load the hard-coded value into R0
LD R0, FILL_VALUE ; Load hard-coded value into R0
RET ; Return to caller
FILL_VALUE .FILL x3200
.END
;=================================================
; Subroutine: OUTPUT_AS_DECIMAL_3400
; Parameter: None
; Postcondition: Outputs the value in R0 as a decimal string
;=================================================
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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions