Computer Science 161.02

 

HOMEWORK 5:  50 points

 

Due Monday, October 6th at 4:00 PM

 

No help given after 10:30 AM on Monday.

So please come prepared Friday and Monday with questions.

 

 

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