Relocatable CodeProducing an object code, which can be placed to any specific area in memory.
Direct Address Table (DAT): contains offset locations of all direct addresses in the program (e.g., 8080 instructions that specify direct addresses are LDA, STA, all conditional jumps...). To relocate the program, the loader adds the loading point to all these locations.
assembly language program Assembler machine language program
and DAT
Figure 6. Assembler output for a relocatable code.
Example 3: Following relocatable object code and DAT are generated for Example 1.
assembly language memory object code
program address in memory
-----------------------
START
LDA #0 0000 01
0001 00
0002 00
LDX #0 0003 05
0004 00
0005 00
LOOP: ADD LIST, X 0006 18
0007 00
0008 12
TIX COUNT 0009 2C
000A 00
000B 15
JLT LOOP 000C 38
000D 00
000E 06
RSUB 000F 4C
0010 00
0011 00
LIST: WORD 200 0012 00
0013 02
0014 00
COUNT: WORD 6 0015 00
0016 00
0017 06
END
DAT
Forward and backward references in the machine code are generated relative to address 0000. To relocate the code, the loader adds the new load-point to the references in the machine code which are pointed by the DAT.
Date: 2015-01-11; view: 1159
|