Assignment 3, due Feb 8
Part of
the homework for 22C:60 (CS:2630), Spring 2013
|
On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!
B 239 B -66 H 57005
A Problem: If you assemble this and load it into memory, these two bytes plus a halfword can be viewed as a single word in memory. What is the value of that word in hexadecimal? (1.2 points)
Suggestion: Do it by hand first, converting the three parts to binary and then shuffling them into the correct fields of a 32 bit word before converting the results to hex. Then check your work by assembling this code using the SMAL assembler and then loading the resulting object file into the Hawk emulator to see what actually loads in memory. If you do this, you prove that you understand what the assembler did and you check your work.
NULL = 0 VALUE = 1 BIG = 2 HEAD: W CO, VALUE+BIG AX: W DE, VALUE BE: W NULL,(BE-HEAD)+1 CO: W EE, BIG >> VALUE DE: W BE, (DE-CO)+1 EE: W AX, BIG+BIG
a) What values does this place in memory? As above, you will learn more from this question if you do it by hand and then check your work using SMAL. (0.6 points)
b) If you traverse this list, starting at the head and continuing until you reach a null pointer, what integer values are found in each list element (list them from left to right and you should almost recognize a pattern -- unfortunately, the problem statement above got scrambled, and the last two list elements break the intended pattern). (0.6 points)