system programming mid-term
DESCRIPTION
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)? . Q1 (10%). Q2 (40%). - PowerPoint PPT PresentationTRANSCRIPT
System Programming Mid-Term
Date: October 28th, 2005Time: 09:10-12:00
2
Q1(10%)
Consider the memory contents shown in the following figure.What would be loaded to register A with the instruction 022030 (hexidecimal)?
.
.
.
.
.
.
(B)=006000(PC)=003000
(X)=000090
3030 003600
.
.
.
.
.
.3600 103000
.
.
.
.
.
.6390 00C303
.
.
.
.
.
.C303 003030
.
.
.
.
.
.
3
Q1(10%)
Machine instruction Value loaded into register AHex Binary Target
addressop n i x b p e disp/address
022030 000000 1 0 0 0 1 0 0000 0011 0000 3030 103000...
.
.
.
(B)=006000(PC)=003000
(X)=000090
3030 003600
.
.
.
.
.
.3600 103000
.
.
.
.
.
.
4
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)
5
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)
6
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
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 Source statement Object codeSTRCPY START 1000FIRST LDX ZEROMOVECH LDCH STR1,X
STCH STR2,XTIX ELEVENJLT MOVECH
STR1 BYTE C’TEST STRING’STR2 RESB 11ZERO WORD 0ELEVEN WORD 11
END FIRST
8
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 Source statement Object code1000 STRCPY START 10001000 FIRST LDX ZERO 0410251003 MOVECH LDCH STR1,X 50900F1006 STCH STR2,X 54901A1009 TIX ELEVEN 2C1028100C JLT MOVECH 381003100F STR1 BYTE C’TEST STRING’ 544553…101A STR2 RESB 111025 ZERO WORD 0 0000001028 ELEVEN WORD 11 00000B102B END FIRST
9
Q3(10%)
Machine instruction
Code Binary Hex
op x disp/address
LDCH STR1,X
01010000 1 001 0000 0000 1111 50900F
STCH STR2,X
01010100 1 001 0000 0001 1010 54901A
10
Q3(10%)
HSTRCPY00100000002BT0010000F04102550900F54901A2C1028381003T00100F0B5445535420535453494E47T0010250600000000000BE001000
^ ^ ^^ ^ ^ ^ ^ ^ ^^ ^ ^^ ^ ^ ^^
11
Q4(10%)
Translate (by hand) the following assembly program to SIC/XE object code.
Loc Source statement Object codeSTRCP2 START 1000 FIRST LDT #11
LDX #0MOVECH LDCH STR1,X
STCH STR2,XTIXR TJLT MOVECH
STR1 BYTE C'TEST STRING'STR2 RESB 11
END FIRST
12
Q4(10%)
Translate (by hand) the following assembly program to SIC/XE object code.
Loc Source statement Object code1000 STRCP2 START 1000 1000 FIRST LDT #11 75000B1003 LDX #0 0500001006 MOVECH LDCH STR1,X 53A0081009 STCH STR2,X 57A010100C TIXR T B850100E JLT MOVECH 3B2FF51011 STR1 BYTE C'TEST STRING' 544553…101C STR2 RESB 111027 END FIRST
13
Q4(10%)
Machine instruction
Code Binary Hex
op n i x b p e 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
14
Q4(10%)
HSTRCP2001000000027T0010001175000B05000053A00857A010B8503B2FF5T0010110B544553542053545249E001000
^ ^ ^^ ^ ^ ^ ^ ^ ^^ ^ ^^
^
15
Q5(10%)
Disassemble (convert object code back into assembly language) the following SIC program.
HSUM 00100000000E T0010000E01000005000190102D000B3B2FF8 E001000
16
Q5(10%)
Loc Source statement Object code
1000 SUM START #1000
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
17
Q5(10%)
Machine instruction
Hex Binary Code
op n i x b p e disp/address
3B2FF8 0011 10 1 1 0 0 1 0 1111 1111 1000 JLT LOOP
18
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?
1+2+3+……+9+10=55 A=37, X=B
IterationRegister
1 2 3 4 5 6 7 8 9 10 11
A 0 1 3 6 10 15 21 27 36 45 55X 1 2 3 4 5 6 7 8 9 10 11
19
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
20
Q7(10%)
Loc Source statement Object code1000 GAUSS START #1000
1000 FIRST LDA #1 010001
1003 LDB #TWO 69200B
BASE #TWO
1006 ADD #K100 1B4003
1009 MUL #K100 232008
100C LDS #TWO 6F4000
100F DIVR #S,A 9C40
1011 TWO WORD #2 000002
1014 K100 WORD #100 000064
1017 END #FIRST
21
Q7(10%)
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
22
Q7(10%)
[(1+100)*100]/2=5050 A=13BA
LocRegister
1000 1003 1006 1009 100C 100F 1011
A F 1 1 101 10100 10100 5050B F F 2 2 2 2 2S F F F F F 2 2
23
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]