Answered step by step
Verified Expert Solution
Link Copied!

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 LC3
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 LC3 that will stop and wait for the user to enter a single digit number from 0
to 9. 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 x3000
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 R0. So, if a 5 is pressed,
the number 5 should be stored in R0 after GETNUM returns. NOTE that this is the number 5 and not the
ASCII code for 5. 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 R0 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 wxyz56, the first call to GETNUM should ignore w, x, y, and z and return
with 5 in R0. Then GETNUM will be called again and will return 6 in R0. So after your program runs, if
you type wxyz56, the number 6 should be in R0 and NOT decimal 54 or the hex value 36.
If you run the program again and type abce!!:*7ww}}{{8, the first call to GETNUM will ignore everything
up to the 7 and return with 7 in R0. Then GETNUM will be called again and will ignore the ww}}{{ and
return with the number 8 in R0.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

Define and describe endogenous rhythms.

Answered: 1 week ago

Question

what are the provisions in the absence of Partnership Deed?

Answered: 1 week ago

Question

1. What is called precipitation?

Answered: 1 week ago

Question

1.what is dew ?

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago