Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Modify the program to allow the user to exit once a key other than 0-6 is entered .ORIG x3000 RESTART LEA R0, PROMPT PUTS GETC
Modify the program to allow the user to exit once a key other than 0-6 is entered
.ORIG x3000 RESTART LEA R0, PROMPT PUTS GETC ; place ascii value of input character into r0 ADD R4, R0, x0 ; copy r0 into r3 ADD R4, R4, #-16 ; subtracts 48, the ascii value of 0 ADD R4, R4, #-16 ; ADD R4, R4, #-16 ; r4 now contains the value LEA R0, DAYS ; Loads address of days into R0 ADD R4, R4, x0 LOOP BRz DISPLAY ADD R0, R0, #10 ; go to next day ADD R4, R4, #-1 ; decrement loop variable BR LOOP DISPLAY PUTS BR RESTART INVALID HALT PROMPT .STRINGZ "Please enter number:" DAYS .STRINGZ "Sunday " .STRINGZ "Monday " .STRINGZ "Tuesday " .STRINGZ "Wednesday" .STRINGZ "Thursday " .STRINGZ "Friday " .STRINGZ "Saturday " .END
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