Assignment 6, due Oct 3
Part of
the homework for 22C:60, Fall 2008
|
Remember to write your name on what you turn in! Homework must be turned in on paper and in class!
LOAD R3,R2,A LOAD R4,R2,B STORE R3,R2,B STORE R3,R2,A
a) Concisely explain what this does to the values of the two variables. (0.2 points)
b) Show the Hawk machine code resulting from assembling this code. Give your answer as a sequence of 8 halfwords, each expressed in hexadecimal. If any part of any halfword is unknown, use question marks for the hex digit corresponding to that part. (0.8 points).
Question: Write a macro MYLOAD such that MYLOAD a,b,c does exactly the same thing as LOAD a,b,c. (1.0 points)
Problems: For each of the following, what sequence of Hawk instructions would you substitute for the given AAMP instruction? Use R2 on the Hawk as a stack pointer - it always points to the free word just beyond the stack top, and use R1 as a temporary if you need one.
a) an AAMP add instruction. (0.3 points)
b) an AAMP call instruction. Warning -- this is tricky. (0.4 points)
c) an AAMP return instruction. (0.3 points)