NCNU System Programming Mid-Term (2)

Date: December 30th, 2005
Time: 09:10-12:00

  1. (10%) Translate (by hand) the following assembly program to SIC/XE object code.
    SUM2  START  
     0
    FIRST
     LDX #0

     LDA
    #0

    +LDB
    #TABLE2

     BASE
     TABLE2
    LOOP
     ADD
     TABLE,X

     ADD
     TABLE2,X

     TIX
     COUNT

     JLT
     LOOP

    +STA
     TOTAL

     RSUB

    COUNT
     RESW
     1
    TABLE
     RESW
     2000
    TABLE2
     RESW
     2000
    TOTAL
     RESW
     1

     END
     FIRST

  2. (10%) Disassemble (convert object code back into assembly language) the following SIC/XE program.
        HSUM   00100000000E
    T0010000E01000005000190102D000B3B2FF8
    E001000
  3. (20%) Disassemble the following SIC program. (You may choose meaningful labels for those addresses as you wish.)
        HEXAM2 00000000005A
    T0000002000004B04004848001E2000540C005848001E1800585480002C004B3C0006E000
    T000020205730001ED8005728004230008028004538001E1C004528005138003F1C004E4C
    T00004020000000000400003000008000000000000700000A000010F1000000
    E000000
  4. (20%) Briefly answer the following questions.
    1. Explain the function of the above program.
    2. If we modify the first three bytes from 00004B to 000000, will it make any difference? Why?
    3. If we modify Bytes[18:1A] from 2C004B to 2C0000, will it make any difference? Why?
    4. What is the ID of the device accessed by this program?
  5. (20%) Consider the three control sections in Figure 3.8. 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.
  6. (20%) With the above load map, show how you calculate the following values:
    1. REF5 in PROGA
    2. REF5 in PROGC
    3. REF8 in PROGA
    4. REF8 in PROGB
    5. REF8 in PROGC