Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

What is the environment we are trying to create?

Answered: 1 week ago

Question

How can we visually describe our goals?

Answered: 1 week ago