NCNU System Programming Mid-Term (2)

Date: December 29th, 2006
Time: 09:10-12:00

Announcement: The SIC/XE assembler is ready now.  Please finish Homework #4 by January 4th.
  1. (10%) Translate (by hand) the following assembly program to SIC/XE object code.
    TEST1  START  
     1000

     LDA #3
    THREE
     WORD  3

     LDA
    #THREE

     LDA
     THREE

     LDA
     THREE-1

     END
     

  2. (10%) Run the above object code.  What values will be loaded into register A for each of the instruction?
  3. Consider the program in Figure 2.1 which is written for the standard SIC. 
    1. (5%) If you need to include the Modification records in the object code to support relocation, what will be the total size of the object file? 
    2. (5%) If the format of relocation bit is chosen, what is the size of the object file?
  4. Consider the bootstrap loader in Figure 3.3.  Answer the following questions in decimal:
    1. (5%) If the first two bytes it reads from device F1 is "2A" (uppercase), what will be the value stored in address 0x80? 
    2. (5%) If the first two bytes it reads from device F1 is "2a" (lowercase), what will be the value stored in address 0x80?
  5. (10%) How do you modify the program in Figure 3.3 to make it also capable of handling lowercase characters correctly?
  6. (20%) Assume that PROGA, PROGB, and PROGC are the same as in Figure 3.8.  Show how the object programs would change (including Header, Text and Modification records) if the following statements were added to each program:
    REF9
    WORD
    LISTC
    REF10
    WORD
    LISTB-3
    REF11
    WORD
    LISTA+LISTB
    REF12
    WORD
    ENDC-LISTC-100
    REF13 
    WORD 
    LISTA-LISTB-ENDA+ENDB

  7. (20%) After the aforementioned change, now suppose they are linked in the sequence of PROGC+PROGB+PROGA, and the beginning load address is 001000. Print the load map (generated after Pass 1) that shows the external symbols and their addresses.
  8. (20%) With the above load map, show how you calculate the following values:
    1. REF11 in PROGA
    2. REF11 in PROGC
    3. REF12 in PROGA
    4. REF12 in PROGC