Lect 05
Lect 05
(Assemblers – Continued)
5–1 / 18
Program Relocation
Example 1: Consider the SIC instruction
LDA THREE
Relocatable program:
Remarks:
5–3 / 18
Program Relocation (continued)
5–4 / 18
Program Relocation (continued)
5–5 / 18
Errors Detected by Assemblers
Undefined symbols.
Illegal opcode.
5–6 / 18
Literals in SIC/XE
Literal:
Examples:
LDA =C’PQR’
TD =X’05’
5–7 / 18
Literals in SIC/XE (continued)
Example: The SIC/XE statement
LDA #112
LDA =C’PQR’
is equivalent to
LDA LIT1
.
.
LIT1 BYTE =C’PQR’
Remarks:
5–9 / 18
Literals in SIC/XE (continued)
LDA =C’PQR’
.
.
J NEXT
LTORG
.
.
NEXT LDB #80
5–10 / 18
Symbol Defining Directives
Example:
LDA #MAXADR
5–11 / 18
Handling Expressions
Example:
Example:
STA START+2
5–12 / 18
Handling Expressions (continued)
5–13 / 18
One-Pass Assemblers
Intermediate version and final object code are kept in main memory.
Advantage: Program can begin execution right after assembly.
5–14 / 18
Load-and-go Assemblers (continued)
5–15 / 18
Object File Assemblers
Object code bytes written out to the file are “unavailable” for
patching.
When a symbol gets defined, output a text record for each forward
reference of the symbol using the list.
5–16 / 18
Multi-Pass Assemblers
Example:
5–17 / 18
Multi-Pass Assemblers (continued)
Suggested Exercises:
5–18 / 18