Presentation is loading. Please wait.

Presentation is loading. Please wait.

System Programming Mid-Term 2

Similar presentations


Presentation on theme: "System Programming Mid-Term 2"— Presentation transcript:

1 System Programming Mid-Term 2
Date: December 30th, 2005 Time: 09:10-12:00 2006/1/6

2 Q1(10%) Translate (by hand) the following assembly program to SIC/XE object code. Loc Source statement Object code SUM2 #START #0 FIRST #LDX #LDA +LDB #TABLE2 #BASE LOOP #ADD #TABLE,X #TABLE2,X #TIX #COUNT #JLT #LOOP +STA #TOTAL #RSUB COUNT #RESW #1 TABLE #2000 TABLE2 TOTAL #END #FIRST

3 Q1(10%) Translate (by hand) the following assembly program to SIC/XE object code. Loc Source statement Object code SUM2 #START #0 0000 FIRST #LDX 050000 0003 #LDA 010000 0006 +LDB #TABLE2 #BASE 000A LOOP #ADD #TABLE,X 1BA013 000D #TABLE2,X 1BC000 0010 #TIX #COUNT 2F200A 0013 #JLT #LOOP 3B2FF4 0016 +STA #TOTAL 0F102F00 001A #RSUB 4F0000 001D COUNT #RESW #1 0020 TABLE #2000 1790 TABLE2 2F00 TOTAL 2F03 #END #FIRST

4 Q1(10%) HSUM F03 T BA0131BC000 T D2F200A3B2FF40F102F004F0000 E000000 ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^

5 Q2(10%) Disassemble (convert object code back into assembly language) the following SIC/XE program.  HSUM E  T E D000B3B2FF8  E001000

6 Q2(10%) Loc Source statement Object code 1000 SUM START #1000 FIRST
LDA #0 010000 1003 LDX #1 050001 1006 LOOP ADDR #X,A 9010 1008 TIX #11 2D000B 100B JLT #LOOP 3B2FF8 100E END #FIRST

7 Q3(20%) Disassemble the following SIC program. (You may choose meaningful labels for those addresses as you wish.) HEXAM A T B E C E C004B3C0006E000 T ED E1C F1C004E4C T A000010F E000000

8 Q3(20%) Loc Source statement Object code EXAM2 START 0000 FIRST LDA
0000 FIRST LDA ZERO 00004B 0003 LDX K128 040048 0006 LOOP JSUB GETC 48001E 0009 MUL K16 200054 000C STA ZERO2 0C0058 000F 0012 ADD 180058 0015 STCH FIRST,X 548000 0018 TIX 2C004B 001B J 3C0006 001E TD DEV E00057 0021 JEQ 30001E 0024 RD D80057 0027 COMP K4 280042 002A 80 300080

9 Q3(20%) 002D COMP K48 280045 0030 JLT GETC 38001E 0033 SUB 1C0045 0036
280051 0039 RETURN 38003F 003C K7 1C004E 003F RSUB 4C0000 0042 K4 WORD 4 000004 0045 48 000030 0048 K128 128 000080 004B ZERO 000000 004E 7 000007 0051 10 00000A 0054 K16 16 000010 0057 DEV BYTE X’F1’ F1 0058 ZERO2 005A END FIRST

10 Q4(20%) Explain the function of the above program.
Bootstrap loader (p.128) If we modify the first three bytes from 00004B to , will it make any difference? Why? No, because of both contents loaded are zero. If we modify Bytes[18:1A] from 2C004B to 2C0000, will it make any difference? Why? No, because of following instruction is “J”. What is the ID of the device accessed by this program? F1

11 Q5(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 Print the load map (generated after Pass 1) that shows the external symbols and their addresses.

12 Q5(20%) Control section Symbol name Address Length PROGC 1000 0051
LISTC 1030 ENDC 1042 PROGB 1051 007F LISTB 10B1 ENDB 10C1 PROGA 10D0 0063 LISTA 1110 ENDA 1124

13 Q6(20%) REF5 in PROGA ENDC-LISTC-10 001042-001030+FFFFF6=000008
REF5 in PROGC 000008 REF8 in PROGA LISTB-LISTA-PROGA 0010B1+FFFFC0-0010D0=FFFFA1 REF8 in PROGB LISTB+PROGB-LISTA =FFFFA1 REF8 in PROGC LISTB-LISTA 0010B =FFFFA1


Download ppt "System Programming Mid-Term 2"

Similar presentations


Ads by Google