Professional Documents
Culture Documents
CS303 M3 Ktunotes - in
CS303 M3 Ktunotes - in
S . I N
T U N OTE
K
Literals
Symbol Defining Statement
Expressions
Program Blocks
E S . I N
O T
TUN and Program Linking
ControlKSections
S
:
. I N
T U N OTE
K
It is convenient to write the value of a constant
operand as a part of instruction
:
LDA =X’05’
:
LITTAB
Content
Literal name
Operand value and length
Address
S . I N
T U N OTE
LITTAB is often organized as a hash table, using the
K
literal name or value as the key
Examples
MAXLEN EQU BUFEND-BUFFER
STAB RESB (6+3+2)*MAXENTRIES
. I N
Program readability is better if data areas are placed in the source
S
T U N OTE
program close to the statements that reference them.
Example: K
pp, 81, Figure 2.12
Three blocks are used
default: executable instructions
CDATA: all data areas that are less in length
"#
CBLKS: all data areas that consists of larger
blocks of memory
" $
OTE
0012 0 J #CLOOP 3F2FEE
0015
0018
001B
0
0
0
ENDFIL
K T U N LDA
STA
LDA
=C’EOF’
#BUFFER
#3
032055
0F2056
010003
001E 0 STA #LENGTH 0F2048
0021 0 JSUB #WRREC 4B2029
0024 0 J @RETADR 3E203F
0000 1 USE #CDATA CDATA block
0000 1 RETADR RESW #1
0003 1 LENGTH RESW #1
0000 2 USE #CBLKS CBLKS block
0000 2 BUFFER RESB #4096
1000 2 BUFEND EQU #*
1000 MAXLEN EQU #BUFEND-BUFFER
OTE
0037 0 +RD +INPUT DB2032
003A
003C
003F
0
0
0 K T U N +COMPR
+JEQ
+STCH
+A,S
+EXIT
+BUFFER,X
A004
332008
57A02F
0042 0 +TIXR +T B850
0044 0 +JLT +RLOOP 3B2FEA
0047 0 EXIT +STX +LENGTH 13201F
004A 0 +RSUB 4F0000
0006 1 +USE +CDATA CDATA block
0006 1 INPUT +BYTE +X’F1’ F1
I N
Assign each label an address relative to the start of the block
S .
T U N OTE
Store the block name or number in the SYMTAB along with the
K
assigned relative address of the label
Indicate the block length as the latest value of LOCCTR for each
block at the end of Pass1
Assign to each block a starting address in the object program by
concatenating the program blocks in a particular order
Block name Block number Address Length
(default) 0 0000 0066
CDATA 1 0066 000B
CBLKS 2 0071 1000
Pass 2
Calculate the address for each symbol relative to the
start of the object program by adding
The location of the symbol relative to the
start of its block
S . I N
N OTE
The starting address of this block
T U
K
S . I N
When this instruction is executed
U
PC = 0009
T N OTE
disp =K0069 – 0009 = 0060
op nixbpe disp
000000 110010 060 => 032060
% &' % (( ) * !
+,- .
…) …) …) …)
0027
Default(2) Default(2)
70
95 CDATA(1)
Not present 100
S . I N
CDATA(2) Default(3)
004D
OTE
in object program 105 CBLKS(1)
125
K T U N
Default(2)
Default(3)
CDATA(1)
0066
006C
CDATA(3) CDATA(2)
006D
CDATA(3)
180 0071
185 CDATA(2) CBLKS(1)
210 Default(3)
245
253 CDATA(3)
1070
✆ ✆ ✆ ✆
✆ ✆ ✆ ✆
✆ ✆
✆ ✆
✒✑ ✒✑
✆ ✝✆ ✍ ✍
✝✆✝ ✝✆ ✍ ✍
✕ ✕✕
✕ ✕✕
☛ ☛
☛ ☛ ✡✏ ✡✏
✡✏ ✡✏
✆✑ ✆✑ ✆ ✆
✆✑ ✆✑ ✆ ✆
✔ ✔
✔ ✔
✡ ✡
✡ ✡
✆ ✆
✆✏ ✆✏ ✞ ✞ ✆ ✆
✆✏ ✆✏ ✆ ✆
✞ ✞
✕ ✕
✕ ✕✕ ✕ ✕✕
✆ ✆
✒✑ ✒✑ ✆ ✆
✒✑ ✒✑
✑ ✑ ✆ ✆ ✆ ✆
✑ ✑ ✆ ✆ ✆ ✆
✆✑ ✆✑ ✆ ✆
✆✑ ✆✑ ✆ ✆
✡ ✡ ✡ ✡ ✏ ✏
✕ ✕✕
✌ ✌
☞ ☞ ☞ ☞
☞ ☞ ☞ ☞ ✌ ✌
✆ ✆ ✠✏ ✠✏
✆ ✆ ☞ ☞ ✠✏ ✠✏
☞ ☞
✕ ✕✕
✕ ✕✕
✠ ✠
✠ ✠
✠ ✠ ✆✌ ✆✌
✡✏ ✡✏
✠ ✠ ✆✌ ✆✌
✡✏ ✡✏
✆ ✆ ✍ ✍
✆ ✆ ✍ ✍
✔ ✔
✔ ✔
✡✏ ✡✏ ☞ ☞
✡✏ ✡✏ ☞ ☞
✕ ✕
✕ ✕✕ ✕ ✕✕
✆ ✆
✡ ✡
✆ ✆
✡ ✡
☞✏ ☞✏ ☞ ☞
☞✏ ☞✏ ☞ ☞
✕ ✕✕
✍ ✍ ✆ ✆
✍ ✍ ✆ ✆ ✒✑ ✒✑
✒✑ ✒✑
✍ ✍
☞ ☞ ✡ ✡ ✍ ✍
☞ ☞ ✡ ✡
✕ ✕✕
✆ ✆ ✍ ✍
✆ ✆ ✍ ✍ ✡ ✡
✡ ✡
✓ ✓
✡ ✡
✓ ✓
✡ ✡
✕ ✕✕
✔ ✔
✔ ✔
✍ ✍ ✆✝ ✆✝
✍ ✍ ✆✝ ✆✝
✡ ✡
✡ ✡
✕ ✕✕
✌ ✌ ✏ ✏
✌ ✌ ✏ ✏
✆☛ ✆☛ ✓✏ ✓✏
✆☛ ✆☛ ✡✏ ✡✏ ✓✏ ✓✏
✡✏ ✡✏
✕ ✕✕
✆ ✆
☞ ☞
✆ ✆
☞ ☞
☛ ☛
✡ ✡ ☞ ☞
☛ ☛
✡ ✡ ☞ ☞
✕
✕ ✕✕
✆✝ ✆✝
☞ ☞ ✒ ✒ ✆✝ ✆✝
☞ ☞ ✒ ✒
✔ ✔
✔ ✔
☞ ☞ ☞ ☞
☞ ☞ ☞ ☞
N
✕
✕ ✕✕
. I
✆ ✆ ✆ ✆
✆ ✆ ✆ ✆ ☞ ☞
☞ ☞
S
✆ ✆
✡ ✡
✆ ✆
E
✡ ✡
✕
✕ ✕✕
T
✔✑ ✔✑
✔✑ ✔✑
✆ ✆
☞ ☞
✆ ✆
☞ ☞
TUN O
✆ ✆ ✠ ✠
✆ ✆ ✠ ✠
Object Program
✕
✕ ✕✕
✆ ✆
✆ ✆ ✏ ✏
✏ ✏
K
✆ ✆
✡✎ ✡✎ ✆ ✆ ✡✏ ✡✏
✡✎ ✡✎ ✡✏ ✡✏
✕
✕ ✕✕
✆ ✆ ✆ ✆ ✆ ✆
☞ ☞
✆ ✆ ✆ ✆ ✆ ✆
☞ ☞
✆ ✆
☞✏ ☞✏ ☞ ☞
✆ ✆
☞✏ ☞✏ ☞ ☞
✕ ✕✕
each Text record.
✆☛ ✆☛ ✆ ✆ ✆✝ ✆✝ ✆ ✆ ✍ ✍
✆☛ ✆☛ ✆ ✆ ✆✝ ✆✝ ✆ ✆ ✍ ✍
✆ ✆
✡ ✡ ✡ ✡ ✆ ✆
✡ ✡ ✡ ✡
✝ ✝
✠ ✠ ✝ ✝ ✆✝ ✆✝
☞ ☞
✠ ✠ ✆✝ ✆✝
☞ ☞
✑ ✑
✆ ✆
✏ ✏
✆ ✆ ☞ ☞ ✑ ✑ ✡ ✡
☞ ☞ ✏ ✏ ✡ ✡
✕ ✕✕
✕ ✕
✕ ✕✕ ✕ ✕✕
✕ ✕✕
✆✞ ✆✞
✆✞ ✆✞ ✌ ✌ ☞ ☞
✌ ✌ ☞ ☞
✠ ✠
✡✝ ✡✝ ✡✎ ✡✎ ✏ ✏ ✠ ✠
✡✝ ✡✝ ✡✎ ✡✎ ✏ ✏
✕ ✕✕
✆ ✆ ✆ ✆ ✆✝ ✆✝
✌ ✌
✆ ✆ ✆ ✆ ✆✝ ✆✝
✌ ✌
✝ ✝ ✍✌ ✍✌
✞ ✞
✡ ✡ ✡ ✡ ✡ ✡
✝ ✝ ✍✌ ✍✌
✞ ✞
✡ ✡ ✡ ✡ ✡ ✡
✕ ✕✕
✆✞ ✆✞ ✍ ✍ ✍ ✍ ✆ ✆ ✆✝ ✆✝
✆✞ ✆✞ ✍ ✍ ✍ ✍ ✆ ✆ ☞ ☞ ✆✝ ✆✝
☞ ☞
✆ ✆ ✆✑ ✆✑
✆ ✆ ✡ ✡ ✆✑ ✆✑
✡ ✡
✕ ✕
✕ ✕✕ ✕ ✕✕
✕ ✕✕
✕ ✕✕
✔✝ ✔✝
✔✝ ✔✝
✆✝ ✆✝
✆✝ ✆✝ ☞✌ ☞✌ ✒✌ ✒✌
☞✌ ☞✌ ✒✌ ✒✌
✆ ✆ ✍✌ ✍✌ ✠ ✠ ☛ ☛
✞ ✞
☛ ☛
✆ ✆ ✍✌ ✍✌ ✠ ✠ ✞ ✞
✕ ✕✕
✕ ✕✕
✕
✕ ✕✕
✆ ✆ ✆☛ ✆☛ ✆✌ ✆✌ ✆ ✆ ✆✞ ✆✞
✌ ✌
✆ ✆ ✆☛ ✆☛ ✆✌ ✆✌ ✆ ✆ ✆✞ ✆✞
✌ ✌
✆ ✆
✏ ✏
✆ ✆ ✡ ✡ ✡ ✡ ✡✏ ✡✏
✡ ✡ ✡ ✡ ✡✏ ✡✏ ✏ ✏
✆ ✆ ✝ ✝ ✍ ✍ ✝ ✝
✆ ✆ ✝ ✝ ✍ ✍ ✝ ✝ ✌ ✌
✌ ✌
✆ ✆ ✆✏ ✆✏ ✍✌ ✍✌ ✝ ✝ ✍✌ ✍✌ ✑ ✑
✞ ✞
✆ ✆ ✆✏ ✆✏ ✍✌ ✍✌ ☞ ☞ ✝ ✝ ✍✌ ✍✌ ✑ ✑
✞ ✞
☞ ☞
✕ ✕
✕ ✕✕ ✕ ✕✕
✕ ✕
✕ ✕✕ ✕ ✕✕
✕ ✕ ✕
✕ ✕✕ ✕ ✕✕ ✕ ✕✕
✆ ✆ ✠✝ ✠✝ ✓ ✓
✏ ✏ ✌ ✌
✆ ✆ ✠✝ ✠✝ ✓ ✓
✏ ✏ ✌ ✌
✆ ✆ ✆✎ ✆✎ ✆✎ ✆✎ ✆✝ ✆✝ ✆✌ ✆✌
✎ ✎
✆ ✆ ✆✎ ✆✎ ✆✎ ✆✎ ✆✝ ✆✝ ✆✌ ✆✌
✎ ✎
✕ ✕ ✕
✕ ✕✕ ✕ ✕✕ ✕ ✕✕
✕ ✕
✖
✕ ✕✕ ✕ ✕✕
✖ ✖✖ ✕ ✕
✕ ✕✕ ✕ ✕✕
✝ ✝ ✝
✆✝ ✆✝ ✠ ✠ ✓ ✓ ✓ ✓ ✆ ✆
✆✝ ✆✝ ✠ ✠ ✝ ✝ ✝✓✝ ✝✓ ✓ ✓ ✆ ✆
✆ ✆ ✆ ✆
✆ ✆ ✡✞ ✡✞ ✌ ✌ ✁ ✁ ✆ ✆
✡✞ ✡✞ ✌ ✌ ✁ ✁
☎ ☎
☎ ☎
✆ ✆ ✆✝ ✆✝ ✆ ✆ ✆✌ ✆✌ ✆☛ ✆☛ ✆✌ ✆✌ ✆☛ ✆☛ ✆ ✆
✆ ✆ ✆✝ ✆✝ ✆ ✆ ✆✌ ✆✌ ✆☛ ✆☛ ✆✌ ✆✌ ✆☛ ✆☛ ✆ ✆
✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆
✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆
✂✄ ✂✄ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆
✂✄ ✂✄ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆
✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆
✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆
✕ ✕ ✕ ✕
✕ ✕✕ ✕ ✕✕ ✕ ✕✕ ✕ ✕✕
✕ ✕ ✕
✕ ✕✕ ✕ ✕✕ ✕ ✕✕
✕ ✕
✕ ✕✕ ✕ ✕✕
✠ ✠
✁ ✁ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✠ ✠
✁ ✁ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟ ✟✟ ✟ ✟
CDATA(2)
CDATA(3)
Default(1)
Default(2)
Default(3)
T
Ex: EXTDEF U N BUFFER, BUFEND, LENGTH
ExternalKreference
EXTREF name [,name]
EXTREF names symbols that are used in this control section and
are defined elsewhere
Ex: EXTREF RDREC, WRREC
To reference an external symbol, extended format
instruction is needed (why?)
+,#*
9>
9 #
9
9"
K TUN/
4"<+ *<
9 1**+0
/
, +0 +,# * * + 0$+0
9 # ; + +,- . 4
9 9 +,- .
9> 1 9700+" 70 + + *
9> =0+ #0 0+ 10, " +0
0+ #0 90+ 7 9
+,- . 90+ 7 9 +,- . * 0+" 0#
9 0-
1**+0 90+ 9 8 + 1**+0 0+
1*+,# 9+?1 9
6 +, 9+?1 9 1**+,#8 1**+0
1 0 1 ,+ 0+ # 0+" 0# , 1**+0
0 /
9 #
9 #
T
6 +,
,/1
U N OTE + ,/1 #+2 "+
9>+?
90#
K
0
,/1
/ / 1, 0+ #
0+ # ". 0 " +0 , 0+- +0
9" /0 : + * 0 +,# * 0+" 0# 36< <5
9>+? +6 +6 / *+ 0
9 ". 1**+0:6 0+ ". 0 " +0 , 1**+0
9 60 / 1, + 6 +,- . .
9> 0 / ++, 0+ ".+#
+6 9 6 +,- . 2+ 0+" 0# +,- .
90 1 0+ 10, " +0
,/1 9 + 6<* < " #+ * 0 ,/1 #+2 "+
6 +, 97 0# 1**+,#8 1**+0
)
) 1 0 1 ,+ 70 + 0+" 0# *0 1**+0
7 /
9 #
9 #
K T U
46< < N
9 +,- .
+ 1 /1 #+2 "+
9>+? 97 / / 1, 0+ #
9 #". 9 1**+0:6 -+ ". 0 " +0 *0 1**+0
97# 46< < 70 + ". 0 " +0
9 60 9 / 1, ". 0 " +0 . 2+
9> 97 / ++, 70 +,
90 1 0+ 10, " +0
9+,# 9* 0
K
passes information to the loader
Add to this data area the address of BUFEND
Subtract from this data area the address of BUFFER
Case 3
On line 107, BUFEND and BUFFER are defined in the same control
section and the expression can be calculated immediately.
107 1000 MAXLEN EQU BUFEND-BUFFER
+,#*
9>
9K
9 #
T U N 9" /
4"<+ *<
9 1**+0
* *+"
*
# 9 # ;
9 9 +,- . *
9> 1 9700+"
9> =0+ #0 +
0+ #0 90+ 7 9
# +,- . 90+ 7 9
9 0-
C 4"<+ *< *
1**+0 90+ 9
1*+,# 9+?1
6 +, 9+?1 9 1*+,#8 1**+0
1 0 1 ,+ 0+ # 0+" 0# , 1**+0
S . I N
OTE
9 # 6 +, *
0 / 9 # ,/1 +
"
* K
90#T
9>+?
U N 0
,/1
/
#
**
9" /0 :
9>+? +6
9 ". 1**+0:6
9 60
# 9> 0 / *+
+6 9 6 +,- .
90 1 *
,/1 9 + 6<* < *
6 +, 97 0# 1**+,#8 1**+0 "
)
1 0 1 ,+ 70 + 0+" 0# *0 1**+0
)
9+6 0+* 9 +,- .: 1**+0
9" + 0 96
9 # 9 +,- .
S . I N
OTE
7 / 9 # 46’ ’ +
"
9>+?
K T
9 #".
97#
U N 97 /
9 1**+0:6
46’ ’ #*
**
9 60 9
9> 97 / *++
90 1 *
9+,# 9* 0
C 46’ ’
Modification record
Col. 1 M
Col. 2-7 Starting address of the field to be modified (hexiadecimal)
Col. 8-9 Length of the field to be modified, in half-bytes (hexadeccimal)
. I N
Col.11-16 External symbol whose value is to be added to or subtracted
S
N OTE
from the indicated field
T U
K
Control section name is automatically an external symbol, i.e.
it is available for use in Modification records.
✆✝
✒
✢
✆☛
✗
✆✝
✒
✆✞
✢
☞✁
☛
✒
☛
Object Program of Figure 2.15
✢
✆✞
✆
✆
✆
✆
✝
✠ ✢
✔✕
✆
✆
✟ ✒
✞
✢
✆✒ ✆✞ ✆
✆ ✆ ✆
✆ ✆ ✆
N
✆ ✆
I
✢
✖ ☞✒
S .
OTE
✢
✢
✏✑ ✒ ✆✞
K T U N ☞✍
✎
✢
✞
✆✒
✒
✆
✆
✆
✆
✞ ✆✞
✢
✆✞ ✆ ✝
✆ ✠ ✢
✆✝ ✆ ✕
✆ ✆ ✆✘
✢
✟ ✆ ✆
✞
✆✞ ☞✍ ✝ ✒
✠ ✆☛
✢ ✢
✆✝ ✡☛ ✔✕ ✗
✆ ✆✞ ☞✁ ☞✁ ☞✁
✢ ✢
✆ ✠ ✒✆ ✆ ✕
✆ ✞ ✆ ☛ ✟✌ ✌ ✌
✆ ✆✞ ☞✁ ✔✒ ✙✕ ✓✌ ✓✌
✆ ✆ ✆✝ ✌
✢ ✢ ✢ ✢ ✢ ✢
✆ ✆ ✌ ✟✝ ✟ ✕ ✙✜✛ ✙✜✛ ✙✜✛
✆ ✆ ✓✌ ✆ ✆✞ ✆ ✢ ✆ ✢ ✆ ✢
✢ ✢ ✢ ✢ ✢ ✢
✆✝ ✟ ✆ ✆
☞✌ ✆ ✆✕ ✝ ✕ ✆
☎ ☞✁ ✆ ✆✝ ✆✞ ✆ ✆✝ ✆✒ ✆
☛ ✆ ✆ ✆ ✆ ✆ ✆ ✆
" /
✂✄ ✡☛ ✟✌ ✆ ✆ ✆ ✆ ✆ ✆ ✆
✆ ✆ ✆ ✆ ✆ ✆ ✆
✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢
✁ ✟✠ ✌ ✚ ✚ ✚ ☞
✌ ✑ ✑ ✑
✙
✢
✆✠ ✆
✢
✆ ✆
✆ ✆
✆ ✆
✆ ✆
✖
✔ ☛ ✢
✙ ☞✕
✢
✖ ☞
✆
✆ ☛
✒
✒ ✠
✢
Object Program of Figure 2.15
✞ ✆✞
✢
✞ ✙
✆✕
✆
✠ ✢
✢
✙✘ ✆
✆
✆✝
✒
✒ ✟☛
✢
✟✠ ✆
✢
✆
✘ ✆
☛ ✆ ✆
☛ ✆ ✆
✒ ✆ ✖
1*+,# 8 1**+0
✞ ✆
✢
✞ ✆ ✙✞ ✢
E
✠
S
✆✝
. I N ✆
✢ ✘
OT ✝
✢
☛
TUN
✒ ✆☛ ☛
☞✞ ✆ ✒
✢
K
✢
✆ ✞
☛ ✆ ✒
✆✝ ✆✝
☛
✢
✔✒ ✆✕ ✒
✔ ✆ ☞✞
✢ ✢
✆ ✆ ✆
✆ ✆
✟ ✕ ✆ ✆
✠ ✕ ✁ ✆
✢
✆✒ ☞✍ ✆✠ ✝ ✆✝ ✆
✆ ✆ ✞ ✟ ✆
✢
✆ ✡☛ ✖✝ ☞✌ ☞✌ ✆ ✔✝ ☞✌
✆ ✕ ☞ ✏✑ ☞✍ ✆ ✔ ✏✑
✢ ✢ ✢ ✢ ✢
✆ ✠ ✆✠ ☛ ☛ ✆ ✆ ☛
✆ ☛ ✡☛ ☞✍ ✡☛ ✡☛ ✆ ☞✌ ☞✍ ✡☛
✆ ✏✑ ✝ ✒ ✎ ✆ ✝ ✎
✆ ✕ ✠ ✠ ✠ ✠ ✆ ☛ ✕ ✠
✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢
✁
✁ ✁✁
✆ ☞✍ ✟✠ ✢ ☞✞ ✗ ✛ ✗ ✆ ✡☛ ✠
✙✜✛ ✙✜✛ ✙✜✛ ✙✜✛
✆ ✎ ✆ ✆ ✆ ✆ ✆ ✆ ✁ ✆ ✆
✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢
✆✝ ✟ ✠ ✆✝ ✟
☞✌ ✆ ✝ ✆ ✆✞ ✆
700+"
0#0+"
☞✁ ✆ ✆✝ ✆✝ ✆✒ ✆✒ ✆✒ ☞✁ ✏✑ ✆ ✆ ✆
☛ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆ ✆
✟✌ ✡☛ ✆ ✆ ✆ ✆ ✆ ✆ ✌ ☞✍ ✆ ✆ ✆
✆ ✆ ✆ ✆ ✆ ✆ ✓✌ ✎ ✆ ✆ ✆
✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢ ✢
✌ ✠ ✚ ✚ ✚ ✚ ☞ ✚ ✚ ☞
✌ ✑ ✑ ✌ ✑
S . I N
T U N OTE
K
One-pass assemblers
Multi-pass assemblers
Two-pass assembler with overlay structure
S . I N
T U N OTE
K
S . I N
Main problem - Forward references
Data items
T U N OTE
K
Labels on instructions
Solution
Require that all areas be defined before they are referenced.
It is possible, although inconvenient, to do so for data items.
Forward jump to instruction items cannot be easily eliminated.
Insert (label, address_to_be_modified) to
SYMTAB
Usually, address_to_be_modified is stored in a
linked-list
S . I N
T U N OTE
K
S . I N
T U N OTE
K
S . I N
T U N OTE
K
S . I N
T U N OTE
K
. I N
The number of undefined symbols in the defining expression
E S
The undefined N O T
symbol (marked with a flag *)
U a list of symbols depend on this
KTwith
associated
undefined symbol.
When a symbol is defined, we can recursively
evaluate the symbol expressions depending on the
newly defined symbol.
S . I N
T U N OTE
K Depending list
Undefined symbol
S . I N
T U N OTE
K
S . I N
T U N OTE
K
$ !" #
!" #
$ $ $
!" # !" #
!" #