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 called reference
;loop:
; subtract by
; if resulting number in the s is positive or zero, increment a counter by
; if resulting number in is negative, dont increment counter and do following:
; print counter
; divide reference by
; start checking the matching ten's place. if reference is subtract with
;Repeat this until you print out the complete number
here is the code for the test harness and the first subroutine
orig x
; Test harness
;
LD R LOADFILLVALUE ; Load the address of the first subroutine
JSRR R ; Call the first subroutine
ADD R R # ; Increment the value in R by
LD R OUTPUTASDECIMAL ; Load the address of the second subroutine
JSRR R ; Call the second subroutine
HALT
; Test harness local data
;
LOADFILLVALUEfill x
OUTPUTASDECIMALfill x
END
;
; Subroutine: LOADFILLVALUE
; Parameter: None
; Postcondition: Loads a hardcoded value x into R
; Return Value: The hardcoded value in R
;
ORIG x
; Load the hardcoded value into R
LD R FILLVALUE ; Load hardcoded value into R
RET ; Return to caller
FILLVALUE FILL x
END
;
; Subroutine: OUTPUTASDECIMAL
; Parameter: None
; Postcondition: Outputs the value in R as a decimal string
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
