Beruflich Dokumente
Kultur Dokumente
op n i x b p e disp/address address
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 Source statement Object code
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
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 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
100F STR1 BYTE C’TEST STRING’ 544553…
101A STR2 RESB 11
1025 ZERO WORD 0 000000
1028 ELEVEN WORD 11 00000B
102B END FIRST
8
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
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 Object code
STRCP2 START 1000
FIRST LDT #11
LDX #0
MOVECH LDCH STR1,X
STCH STR2,X
TIXR T
JLT MOVECH
STR1 BYTE C'TEST STRING'
STR2 RESB 11
END FIRST
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 #11 75000B
1003 LDX #0 050000
1006 MOVECH LDCH STR1,X 53A008
1009 STCH STR2,X 57A010
100C TIXR T B850
100E JLT MOVECH 3B2FF5
1011 STR1 BYTE C'TEST STRING' 544553…
101C STR2 RESB 11
1027 END FIRST
12
Q4(10%)
Machine instruction
Code Binary Hex
op n i x bpe 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%)
16
Q5(10%)
Machine instruction
Hex Binary Code
op n i x bpe disp/address
3B2FF8 0011 10 1 1 0 0 1 0 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 1 2 3 4 5 6 7 8 9 10 11
Register
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
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
20
Q7(10%)
Machine instruction
Hex Binary Code
op n i x bpe 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%)
[(1+100)*100]/2=5050
A=13BA
22
Homework
23