Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is for logic system design class Use the PennSim simulator and assembler This LC-3 assembly language program will interpret keystrokes as commands for printing

this is for logic system design class

Use the PennSim simulator and assembler

This 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.

A command is one of the following:

a)A number followed by a character, which means to print that number of copies of the character. (E.g., 9* means to print *********.)

b)A linefeed (which is Enter or Return on your keyboard, which means to print a linefeed, moving to the beginning of the next line.

c)Any other character, which means to exit the program.

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.

And the printed output would look like this (assuming a fixed-width font):

*** *** *** *** ***** *** *

Note that the commands themselves are not printed on the console -- just the output that is generated by the commands.

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):

d)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).

e)Wait for another character (using GETC).

f)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.)

g)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.)

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

9. Describe the characteristics of power.

Answered: 1 week ago

Question

Question 44(1 point)

Answered: 1 week ago

Question

2 What supply is and what affects it.

Answered: 1 week ago