Question: 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
;=================================================
 please fix this program, using the following method ;load 10000(called reference)

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!