Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USE LC 3 This is a programming assignment that will be graded and scored as a home work since it is so simple. This one
USE LC
This is a programming assignment that will be graded and scored as a home work since it is so simple.
This one is less simple than previous assignments
Write a subroutine for the LC that will stop and wait for the user to enter a single digit number from
to The subroutine should function in a way like GETC but should not return until a digit is pressed. If
anything other than a numeric character is pressed the program should simply ignore the character.
The "MAIN" part of your program the top lines should look like this.
orig x
MAIN
JSR GETNUM
JSR GETNUM ;Yes, there are TWO calls to GETNUM
HALT
GETNUM waits for a digit to be pressed then returns the value of that digit in R So if a is pressed,
the number should be stored in R after GETNUM returns. NOTE that this is the number and not the
ASCII code for You will have to convert since GETC returns ASCII codes.
Since you are running GETNUM twice from main, it means you will have to type TWO digits for the
program to finish. Only the second digit will be stored in R after the program ends since the second call
to GETNUM will overwrite the value of the first call.
ALL OTHER INPUTS SHOULD BE TREATED AS IF THEY DIDN'T HAPPEN.
Some examples:
If you run the program and type wxyz the first call to GETNUM should ignore w x y and z and return
with in R Then GETNUM will be called again and will return in R So after your program runs, if
you type wxyz the number should be in R and NOT decimal or the hex value
If you run the program again and type abce!!:ww the first call to GETNUM will ignore everything
up to the and return with in R Then GETNUM will be called again and will ignore the ww and
return with the number in R
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