0% found this document useful (0 votes)
11 views19 pages

Tutorial

The document provides a detailed hand assembly translation of several assembly programs into SIC and SIC/XE object code, including the necessary records such as H, T, and E records. It also includes machine instructions, their binary and hexadecimal representations, and simulations of program execution. Additionally, it features disassembly of object code back into assembly language and the results of register values at specific breakpoints.

Uploaded by

ANJANA MS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views19 pages

Tutorial

The document provides a detailed hand assembly translation of several assembly programs into SIC and SIC/XE object code, including the necessary records such as H, T, and E records. It also includes machine instructions, their binary and hexadecimal representations, and simulations of program execution. Additionally, it features disassembly of object code back into assembly language and the results of register values at specific breakpoints.

Uploaded by

ANJANA MS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Hand Assembly

• 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 1
Hand Assembly
• 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
1003 MOVECH LDCH STR1,X
1006 STCH STR2,X
1009 TIX ELEVEN
100C JLT MOVECH
100F STR1 BYTE C’TEST STRING’
101A STR2 RESB 11
1025 ZERO WORD 0
1028 ELEVEN WORD 11
102B END FIRST 2
Data Structures
OPTAB SYMTAB
LDX 04 ZERO 1025
LDCH 50 STR1 100F
STCH 54 STR2 101A
TIX 2c ELEVEN 1028
JLT 38 MOVECH 1003

A 41 65
B 42 66
…. … …
Z 90
3
Hand Assembly
• 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
4
Hand Assembly

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

5
Hand Assembly

HSTRCPY00100000002B
^ ^ ^
T0010000F04102550900F54901A2C1028381003
^ ^ ^ ^ ^ ^
T00100F0B5445535420535453494E47 ^
^ ^ ^
T0010250600000000000B
^ ^ ^
E001000 ^
^

6
Hand Assembly
• 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

7
Hand Assembly
• 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
1003 LDX #0
1006 MOVECH LDCH STR1,X
1009 STCH STR2,X
100C TIXR T
100E JLT MOVECH
1011 STR1 BYTE C'TEST STRING'
101C STR2 RESB 11
1027 END FIRST

8
Hand Assembly
• 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

9
Hand Assembly

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

10
Hand Assembly

HSTRCP2001000000027
^ ^ ^
T0010001175000B05000053A00857A010B8503B2FF5
^ ^ ^ ^ ^ ^ ^ ^
T0010110B544553542053545249
^ ^ ^
E001000
^

11
Hand Assembly
• Disassemble (convert object code back into assembly
language) the following SIC program.

HSUM 00100000000E
T0010000E01000005000190102D000B3B2FF8
E001000

12
Hand Assembly

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

13
Hand Assembly

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

14
Hand Assembly
• 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

15
Hand Assembly
• 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

16
Hand Assembly
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

17
Hand Assembly

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

18
Hand Assembly

Loc 1000 1003 1006 1009 100C 100F 1011


Register
A F 1 1 101 10100 10100 5050
B F F 2 2 2 2 2
S F F F F F 2 2
• [(1+100)*100]/2=5050
• A=13BA

19

You might also like