Title: Dr. Ali Orooji
1COP 3402 Systems Programming
- Dr. Ali Orooji
- School of EECSUniversity of Central Florida
2Section 2.3.2
- Symbol-Defining Statements
- symbol EQU value
- assembler puts the symbol and value in
symbol table - 1000 L1 EQU 500
- L2
-
- L2-L3
3Section 2.3.3
- Expressions
- assemblers generally allow , -, , /
- Absolute expression
- either only absolute terms
- or if relative terms, they occur in pairs
with - opposite signs
- relative terms may not enter into a
multiplication or division - operation
- Relative expression
- relative terms occur in pairs as above
one extra - relative term (positive sign)
4Section 2.3.4
- Program Blocks
- segments of code that are logically rearranged
within a single object program unit
5- Pass 1
- - a separate location counter for each block
- - when storing a label in symbol table, store
the - block number as well
- At the end of pass 1, the length of each block is
known - the assembler can now assign a starting address
to each - block
Pass 2 the value for a label is the value in
the symbol table plus the starting address
for the block
6- Note that the assembler does not physically
rearrange the generated code in the object
program (the assembler puts the load address with
object code loader will load accordingly)
7Section 2.3.5 Control Sections
- segments that are translated into independent
object program units
CSECT 1
CSECT 2
- need to link together different control
sections . assembler cannot do the
linking . assembler provides information
for each external reference that will
allow the loader to perform the
required linking
- need extended format (type 4) for instructions
containing external references
8(No Transcript)
9Two-Pass Assembler with Overlay Structure
main segment 20K Pass 1 segment
50K Pass 2 segment 60K
10Section 2.4.1 One-Pass Assemblers Why did
we need two passes? forward references
- data items - labels Load-and-go
one-pass assemblers generate object code in
memory for immediate execution (no object
program is written out, and no loader is
needed)
11 . . . 1000 J RDREC
. . 101D J RDREC . .
2000 RDREC ...
12- If the one-pass assembler generates object
program - on secondary storage, i.e., not load-and-go
assembler - - put zero when address not known (and
remember the references using symtbl as before) - - when address is known, generate records to
fill references - 1000 J RDREC 1000 J
0000 - .
- .
- 101D J RDREC 101D J 0000
- .
- .
- 2000 RDREC
- 1000
2000 -
101D 2000
13Section 2.4.2
- Multi-Pass Assemblers
- in the two-pass assembler
-
- symbol defining directives
- MAXLEN EQU BUFEND-BUFFER
- symbols on the right hand side
must be - defined previously
- A EQU B
- B EQU C
- C EQU
-
14HALFSZ EQU MAXLEN/2
15MAXLEN EQU BUFEND-BUFFER
symtbl
of undef sym
ref ptr
name
value
expression
HALFSZ
1
MAXLEN / 2
MAXLEN
HALFSZ
2
BUFEND-BUFFER
BUFEND
MAXLEN
BUFFER
MAXLEN
PREVBT EQU BUFFER-1