Question
Machine & Assembly Languages. 20 Points This homework will test your understanding of Machine & Assembly Languages that we covered in lecture from Chapters 5,
Machine & Assembly Languages. 20 Points
This homework will test your understanding of Machine & Assembly
Languages that we covered in lecture from Chapters 5, 6 & 7 of your
textbook. Submit your homework on Canvas before the due date and time
with your name(s) in the program header at the top of each file. Name your
files, PrintLetters.bin, Guess.asm and Count.asm (if attempting extra
credit).
No late work or email submissions will be accepted.
Instructions
Write down the steps before you start with the Simulator and editor.
You dont need to submit these but will help greatly in completing the
work.
Start your program at x3000 so that it will be easier for me to grade it.
Each program must include a header comment that has your name(s)
and a brief description of the program.
Make sure to comment each line of code in the case of machine code
and have adequate comments in case of assembly code. You will be
graded on comments.
1. (7 Points) Write a machine language program for the LC3. It should
print out the letters: ZYX..DCBAABCD....XYZ That's a total of 26 *2 =
52 letters. You must use one or two loops.
Name your file PrintLetters.bin.
Rubric:
Machine code compiles - 3 Points
Works correctly 2 Points
Commented adequately 2 Points
Named incorrectly (-1 Point)
2. (13 points) Write an assembly language program to simulate a
simple guessing game. The program has stored the value 6. The
program will continually ask the user to guess a number between 0
and 9 (see sample program input/output below.). If your program
encounters any non-digit character, the program should output Invalid
input. Invalid input should still count as a guess. User enters input
and hits enter. The ASCII code x0A causes the cursor to go to the
next line (Newline). Name your file Guess.asm. Assume that the user
gets it right within 9 guesses.
Sample Output
Guess a number: 5
Too small.
Guess again: 9
Too big.
Guess again: a
Invalid input.
Guess again: 6
Correct! You took 4 guesses.
Rubric:
Assembly code compiles - 3 Points
Works correctly for all cases 6 Points
Output matches above sample 2 Points
Commented adequately 2 Points
Named incorrectly (-1 Point)
Extra Credit (10%): Write an LC-3 assembly language program that counts
the number of 1s stored in R5 and stores the result into R4. For example, if
R5 contains 0001 0011 0111 0000, then after the program executes, the
result stored in R4 would be 0000 0000 0000 0110. Name your file
Count.asm.
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