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
SP Mid-Term Exam Chang-Yu Wu 2006/12/03 Q1. Consider the memory contents shown in the following figure. What would be loaded to register A with the instruction 022030 (hexidecimal)? (10%) . . . . . . 3030 003600 . . . . . . 3600 103000 . . . . . . 6390 00C303 . . . . . . C303 003030 . . . . . . (B)=006000 (PC)=003000 (X)=000090 Answer Machine instruction Hex Binary op 022030 n i x b p e 000000 1 0 0 0 1 0 disp/address 0000 0011 0000 . . . . . . 3030 003600 . . . . . . 3600 103000 . . . . . . (B)=006000 (PC)=003000 (X)=000090 Target address 3030 Value loaded into register A 103000 Q2. Briefly answer the following questions (40%) 1. Why does Beck's "System Software" textbook design a hypothetical computer SIC to present the concepts in his book? Ans: illustrate the most commonly encountered hardware features and concepts, while avoiding most of the idiosyncrasies. (p.4) 2. What are the maximum memory size of SIC and SIC/XE, respectively? Ans: 215/220 bytes(p.5/p.7) 3.How many addressing modes do SIC and SIC/XE support, respectively? Ans: 2/18 (p.6/p.499) 4.How many instructions are there in the SIC/XE instruction set? Ans: 59 (p.496~498) 5.How does SIC determine whether the result of a TD instruction is successful? Ans: CC (condition code) = LT means the device is ready (p.7) 6. What are the two general purpose registers in SIC/XE? Ans: S,T (p.7) 7. What is the size of F register? Ans: 48bits (p.7) 8. Why does the assembler need to handle the source files in two passes? Ans: Pass1: assign addresses to all symbol Pass2: generate object code in order to solve the problem of forward reference Q3. 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.) (10%) Source statement STRCPY START 1000 FIRST LDX ZERO MOVECH LDCH STR1,X STCH STR2,X TIX ELEVEN JLT MOVECH STR1 BYTE C’TEST STRING’ STR2 RESB 11 ZERO WORD 0 ELEVEN WORD 11 END FIRST Loc Source statement Object code 1000 STRCPY START 1000 1000 FIRST LDX ZERO 041025 1003 MOVECH LDCH STR1,X 50900F 1006 STCH STR2,X 54901A 1009 TIX ELEVEN 2C1028 100C JLT MOVECH 381003 544553… 100F STR1 BYTE C’TEST STRING’ 101A STR2 RESB 11 1025 ZERO WORD 0 000000 1028 ELEVEN WORD 11 00000B END FIRST 102B Answer HSTRCPY00100000002B ^ ^ ^ T0010000F04102550900F54901A2C1028381003 ^ ^ ^ ^ ^ ^ ^ T00100F0B5445535420535453494E47 ^ ^ ^ T0010250600000000000B ^ ^ ^ ^ E001000 ^ Q4. Translate (by hand) the following assembly program to SIC/XE object code. Source statement STRCP2 START 1000 FIRST LDT #11 LDX #0 LDCH STR1,X STCH STR2,X TIXR T JLT MOVECH STR1 BYTE C'TEST STRING' STR2 RESB 11 END FIRST MOVECH Loc Source statement Object code 1000 STRCP2 START 1000 1000 FIRST LDT #11 75000B LDX #0 050000 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 Answer HSTRCP2001000000027 ^ ^ ^ T0010001175000B05000053A00857A010B8503B2FF5 ^ ^ ^ ^ ^ ^ ^ ^ T0010110B5445535420535452494E47 ^ ^ ^ E001000 ^ Q5. Disassemble (convert object code back into assembly language) the following SIC/XE program. (10%) HQUIZ 000000000019 T000000130100031320100500006F10001690010F900013 E000000 Answer: 0000 0003 0006 0009 000D 000F 0013 0016 QUIZ FIRST RESULT THREE START 0 LDA #3 STX THREE LDX #0 +LDS THREE ADDR A,X +STA RESULT,X RESW 1 RESW 1 END FIRST 010003 132010 050000 6F100016 9001 0F900013 Q6. Simulate (by hand) the execution of the above program and let the breakpoint by 000013. What would be the value of register X when (pc) = 000013? (10%) LOC 0000 0003 0006 0009 000D 000F 0013 A F 3 3 3 3 3 3 X F F F 0 0 3 3 REGISTER A=3 X=3 Q7. 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? (10%) HGAUSS 001000000017 T0010000C01000169200B1B4003232008 T00100C0B6F40009C40000002000064 E001000 Answer 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 Machine instruction Hex Binary Code op n i x b p e 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 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