Question: 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
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
