Homework 2

22C:18, Spring Fall

Due Tuesday Sept. 10, 1996, in discussion

Douglas W. Jones

  1. Convert the following string to ASCII, and show how it would be stored in consecutive words of memory by a Hawk system, starting at address #1000. Your answer should show the contents of each word of memory in hexadecimal.
    	This is the string!
    
    Note that if you just use the ASCII assembly directive, the assembly listing does not give you the contents of each word in hex, it gives you the contents of consecutive bytes in hex, and while the relation between bytes and words is trivial, you must do some of the work manually!

  2. Suppose you had a Hawk based system where bit 29 of the program counter was broken, so that, no matter what value you tried to store in the program counter, that bit would always report the value zero. Despite this failure, you find that, when you turn on your system, it still starts up correctly and runs for a brief while without problems. From this, you can conclude something about where the startup (or bootstrap) code is stored in memory. State your conclusions!

  3. The DEC PDP-8 was the first computer ever sold on a retail cash and carry basis (this happened in 1968; the architecture was introduced in 1965). This machine had word addressing, a 12 bit word, and an 15 bit memory address. The character set used for textual I/O on this machine was 8 bit ASCII.

    Part A: What is the maximum memory you can attach to this machine, in words?

    Part B: How many characters of text could you store in the memory of this machine? (for this part, ignore the problem of where the program would have to be stored if you actually filled the memory with text.)

    Part C: Propose a format for the efficient storage of consecutive bytes of ASCII data in memory on this machine; this format should allow you to actually store the number of characters you suggested in Part B.

    Part D: If a program uses a word as an array index, what is the maximum size of the array that program can directly access?

  4. On a Hawk machine, register 3 contains the value #01234567. Give the hex value for each of the following:

    Part A: R3 truncated to a halfword
    Part B: R3 truncated to one byte
    Part C: The most significant halfword of R3
    Part D: The LSB of R3

  5. Translate the following Hawk instructions to machine code, giving the result as a string of consecutive halfwords in hex:

    Part A: LEA R6,R5,36
    Part B: JSRS R3,R4
    Part C: LIL R2,#012345
    Part D: ADD R1,R7,R8