Answered step by step
Verified Expert Solution
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started