Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
System Programming Mid-Term Date: October 28th, 2005 Time: 09:10-12:00 Q1(10%) Consider the memory contents shown in the following figure. What would be loaded to register A with the instruction 022030 (hexidecimal)? . . . . . . 3030 003600 . . . . . . 3600 103000 . . . . . . 6390 00C303 . . . . . . C303 003030 . . . . . . (B)=006000 (PC)=003000 (X)=000090 2 Q1(10%) Machine instruction Hex Binary 022030 op n i x b p e disp/address 000000 1 0 0 0 1 0 0000 0011 0000 . . . . . . 3030 003600 . . . . . . 3600 103000 . . . . . . Value loaded into register A Target address 3030 103000 (B)=006000 (PC)=003000 (X)=000090 3 Q2(40%) Why does Beck's "System Software" textbook design a hypothetical computer SIC to present the concepts in his book? illustrate the most commonly encountered hardware features and concepts, while avoiding most of the idiosyncrasies (p.4) easy to learn What are the maximum memory size of SIC and SIC/XE, respectively? 215/220 (p.5/p.7) 4 Q2(40%) How many addressing modes do SIC and SIC/XE support, respectively? 2/18 (p.6/p.499) How many instructions are there in the SIC/XE instruction set? 59 (p.496~498) How does SIC determine whether the result of a TD instruction is successful? CC (condition code) = LT means the device is ready (p.7) 5 Q2(40%) What are the two general purpose registers in SIC/XE? S,T (p.7) What is the size of F register? 48bits (p.7) Why does the assembler need to handle the source files in two passes? Pass1 assign addresses to all symbol Pass2 generate object code in order to solve the problem of forward reference 6 Q3(10%) Translate (by hand) the following assembly program to SIC object code. (The output format will look like Figure 2.3, which contains H record, T record, and E record.) Loc STRCPY FIRST MOVECH STR1 STR2 ZERO ELEVEN Source statement START 1000 LDX ZERO LDCH STR1,X STCH STR2,X TIX ELEVEN JLT MOVECH BYTE C’TEST STRING’ RESB 11 WORD 0 WORD 11 END FIRST Object code 7 Q3(10%) Translate (by hand) the following assembly program to SIC object code. (The output format will look like Figure 2.3, which contains H record, T record, and E record.) Loc 1000 1000 1003 1006 1009 100C 100F 101A 1025 1028 102B STRCPY FIRST MOVECH STR1 STR2 ZERO ELEVEN Source statement START 1000 LDX ZERO LDCH STR1,X STCH STR2,X TIX ELEVEN JLT MOVECH BYTE C’TEST STRING’ RESB 11 WORD 0 WORD 11 END FIRST Object code 041025 50900F 54901A 2C1028 381003 544553… 000000 00000B 8 Q3(10%) Machine instruction Code Binary op x disp/address Hex LDCH STR1,X 01010000 1 001 0000 0000 1111 50900F STCH STR2,X 01010100 1 001 0000 0001 1010 54901A 9 Q3(10%) HSTRCPY00100000002B ^ ^ ^ T0010000F04102550900F54901A2C1028381003 ^ ^ ^ ^ ^ ^ ^ T00100F0B5445535420535453494E47 ^ ^ ^ T0010250600000000000B ^ ^ ^ ^ E001000 ^ 10 Q4(10%) Translate (by hand) the following assembly program to SIC/XE object code. Loc Source statement STRCP2 START 1000 FIRST LDT LDX #11 #0 MOVECH LDCH STR1,X STCH STR2,X TIXR T JLT MOVECH STR1 BYTE C'TEST STRING' STR2 RESB 11 END FIRST Object code 11 Q4(10%) Translate (by hand) the following assembly program to SIC/XE object code. Loc Source statement Object code 1000 STRCP2 START 1000 1000 FIRST LDT LDX #11 #0 75000B LDCH STR1,X 53A008 1009 STCH STR2,X 57A010 100C TIXR T B850 100E JLT MOVECH 3B2FF5 544553… 1003 1006 MOVECH 1011 STR1 BYTE C'TEST STRING' 101C STR2 RESB 11 END FIRST 1027 050000 12 Q4(10%) Machine instruction Code Binary op n i x bpe Hex disp/address LDCH STR1,X 0101 00 1 1 1 0 1 0 0000 0000 1000 53A008 STCH STR2,X 0101 01 1 1 1 0 1 0 0000 0001 0000 57A010 JLT MOVECH 0011 10 1 1 0 0 1 0 1111 1111 0101 3B2FF5 13 Q4(10%) HSTRCP2001000000027 ^ ^ ^ T0010001175000B05000053A00857A010B8503B2FF5 ^ ^ ^ ^ ^ ^ ^ ^ T0010110B544553542053545249 ^ ^ ^ E001000 ^ 14 Q5(10%) Disassemble (convert object code back into assembly language) the following SIC program. HSUM 00100000000E T0010000E01000005000190102D000B3B2FF8 E001000 15 Q5(10%) Loc Source statement Object code 1000 SUM START #1000 1000 FIRST LDA #0 010000 LDX #1 050001 ADDR #X,A 9010 1008 TIX #11 2D000B 100B JLT #LOOP 3B2FF8 100E END #FIRST 1003 1006 LOOP 16 Q5(10%) Machine instruction Hex Binary op 3B2FF8 n i x bpe 0011 10 1 1 0 0 1 0 Code disp/address 1111 1111 1000 JLT LOOP 17 Q6(10%) Simulate (by hand) the execution of the above program and let the breakpoint be 00100E. What would be the value of register A and register X when (PC) = 00100E? Iteration Register 1 2 3 4 5 6 7 8 9 10 11 A 0 1 3 6 10 15 21 27 36 45 55 X 1 2 3 4 5 6 7 8 9 10 11 1+2+3+……+9+10=55 A=37, X=B 18 Q7(10%) Simulate (by hand) the execution of the object code below. Let the breakpoint be 001011. What is the value of register A when (PC) = 001011? HGAUSS 001000000017 T0010000C01000169200B1B4003232008 T00100C0B6F40009C40000002000064 E001000 19 Q7(10%) Loc Source statement Object code 1000 GAUSS START #1000 1000 FIRST LDA #1 010001 LDB #TWO 69200B BASE #TWO 1006 ADD #K100 1B4003 1009 MUL #K100 232008 100C LDS #TWO 6F4000 100F DIVR #S,A 9C40 1003 1011 TWO WORD #2 000002 1014 K100 WORD #100 000064 END #FIRST 1017 20 Q7(10%) Machine instruction Hex Binary op n i x bpe Code disp/address 69200B 0110 10 0 1 0 0 1 0 0000 0000 1011 LDB #TWO 1B4003 0001 10 1 1 0 1 0 0 0000 0000 0011 ADD #K100 232008 0010 00 1 1 0 0 1 0 0000 0000 1000 MUL #K100 6F4000 0110 11 1 1 0 1 0 0 0000 0000 0000 LDS #TWO 21 Q7(10%) Loc 1000 1003 1006 1009 100C 100F 1011 A F 1 1 101 10100 10100 5050 B F F 2 2 2 2 2 S F F F F F 2 2 Register [(1+100)*100]/2=5050 A=13BA 22 Homework The code can work well greater than 7 If I need to correct it less then 5 Second chance 23:59 on Nov. 4th (tonight) Subject of email: [SP HW1v2] ######## Email to me: [email protected] 23