One-Pass Assemblers
Two methods can be used:
- Eliminating forward references
Either all labels used in forward references are defined in the source program before they are referenced, or forward references to data items are prohibited.
- Generating the object code in memory
No object program is written out and no loader is needed. The program needs to be re-assembled every time.
Multi-Pass Assemblers
Make as many passes as needed to process the definitions of symbols.
Example 3:
A EQU B
B EQU C
C DS 1
3 passes are required to find the address for A.
Such references can also be solved in two passes: entering symbol definitions that involve forward references in the symbol table. Symbol table also indicates which symbols are dependent on the values of others.
Example 4:
A EQU B
B EQU D
C EQU D
D DS 1
At the end of Pass1:
Symbol Table
A
| &1
| B
|
|
|
|
|
|
|
| B
| &1
| D
|
|
| A
|
|
|
|
| C
| &1
| D
|
|
|
|
|
|
|
| D
|
|
|
|
| B
|
|
| C
|
|
After evaluating dependencies:
Symbol Table
Date: 2015-01-11; view: 1216
|