Computer Science 161.01

 

HOMEWORK 5:  50 points

 

Due Monday February 27th  at 1:30PM

 

 

 

1.      (20 points) Write a VSC-32 machine language program Echo3 that reads in three numbers and echoes the three back in the same order they were read in.  You may use the hex input capability of the machine at this site to test your program!  Write down the program in both binary and hex below.

 

 

 

 

 

 

 

 

2.      (20 points)  Solve Exercise 3 from Wednesday's notes. 

The program will read in two numbers x and y, and output the value    (x + y) – 5.

Write down the hex below and use the hex input capability of the machine at this site to test your program!

 

 

 

 

 

 

  

3.      (10 points) Solve Exercise 4 from Wednesday's notes.  

There you are asked to reason about a program that is in hex!

Try to figure out what it does before running it, and show below how the hex expands into binary and give some explanation as to what each instruction does. 

(For example, for 00100101, you might say “load from address 5;  the accumulator gets a 20” if that’s what the program does).