Question
Write a program in assembly for the LC3. The first line should be the starting address in memory, use 3000 to be safe. The last
Write a program in assembly for the LC3.
The first line should be the starting address in memory, use 3000 to be safe.
The last line should be a halt (F025).
The lines between the first and last line should do the following: Print a number of digits specified in R1. These digits should start with 0 and count up and then stop at R1 1.
For example:
If 5 is in R1, the program would print 01234
If 9 is in R1, your program would print 012345678
You can assume R1 will never be less than zero or greater than 10. Do not initialize R1 in the program. Assume the value will already be in R1 when your program starts.
Write your program in assembly. Convert it manually to hex.
A possible algorithm. Copy the ASCII code for zero to a register. R0 would be easiest.
while (R1 indicates not done) {
print ascii
ascii ++
R1 --
}
The equivalent to the above in LC3 assembly might look something like this.
Copy the ASCII code for zero to a register. R0 would be easiest.
If R1 indicated done, branch to end.
print ascii
add 1 to ascii
R1 --
Branch back to if statement
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