Question
Create LC-3 assembly language program will interpret keystrokes as commands for printing characters on the console, resulting in ASCII art -- the ability to draw
Create LC-3 assembly language program will interpret keystrokes as commands for printing characters on the console, resulting in ASCII art -- the ability to draw pictures using ASCII characters.
For example, if the user types the following, where is used to represent Enter (linefeed):
3*3 3* 1 3*1 3* 2 5* 3 3* 4 1* X
it means: 3 stars, 3 spaces, 3 stars, next line. 1 space, 3 stars, 1 space, 3 stars, next line. 2 spaces, 5 stars, next line. 3 spaces, 3 stars, next line. 4 spaces, 1 star, next line. Stop.
Details
The program must start at address x3000. Heres how the program must behave:
1. The program waits for a character to be typed on the keyboard. (Use GETC to read the character; it will be placed in R0.)
2. If the character is a digit (0 through 9):
a)Convert the character to its corresponding decimal value. In other words, 0 becomes zero, 1 becomes 1, ... 9 becomes 9. Lets call that value R (for run length).
b)Wait for another character (using GETC).
c)Print R copies of that character to the console. (Use OUT to print one character, and do this R times. The character to be printed must be in R0 when OUT is called.)
d)Go back to Step 1.
3. Else, if the character is Enter/Return (ASCII #10): Print a linefeed (ASCII #10) to the console, and go back to Step 1.
4. Else, if the character is anything else, halt the program. (Use HALT.)
This is the basic logic and design class. If anyone could help me out so I can see where I am going wrong, that would be amazing.
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