Question: All programming exercises in this homework need to be done in machine language, not assembly language. Follow the examples in the book and add pseudocode
All programming exercises in this homework need to be done in machine language,
not assembly language. Follow the examples in the book and add pseudocode to the
right of each instruction.
All of your programs should end with a Halt instruction:
TRAP x
Write a short LC program that compares the two numbers in R and R and puts
the value in R if R R in R if R R and in R if R R
Section of the text includes an example of character counting. Why is it
necessary to initialize R in this example? In other words, in what manner might the
program behave incorrectly if the R step were removed from the code?
Consider the following machine language program:
x
x
x
x
x
x
x
x
What are the possible initial values of R that cause the final value in R to be
Shown below are the contents of memory and registers before and after the LC
instruction at location x is executed.
Your job: Identify the instruction stored in
xall bits, not just the opcode Note: There is enough information below to
uniquely specify the instruction at x
Before After
Rxx
RxDC xDC
RxExE
Rxx
RxFF xFF
RxFF xFF
RxFAxFA
Rxx
Before After
xxx
xxAxA
xxAB xAB
xxAxA
xxFxF
xxx
xxBA xE
xxCxC
xxEFEF xEFEF
Using iteration write a program that displays the first character of your name
times on the screen.
Here's the instruction to write a character to the monitor. The TRAP instruction to
write a character to the monitor assumes the character is in bits : of R
TRAP x
Write a program that determines if the number stored in R is odd. If the value of
R is odd, the program puts a in R Otherwise it puts a in R
Write a program that determines if the number stored in R is even. If the value of
R is even, the program puts a in R Otherwise it puts a in R
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
