Z80 Assembly 19: Relocatable Code and Position-Independent Code (PIC)
The Problem with Absolute Addressing Normally, Z80 instructions like JP 8000H or LD HL, DATA_ADDR use absolute addressing. If you compile a program to run at address 8000H but later load it at 9000H, every one of those absolute addresses will be wrong, and the program will crash. Relocatable Code and Position-Independent Code (PIC) solve this problem. Relocatable Code (The Assembler’s Job) Relocatable code is written with absolute addresses, but the assembler generates a file that includes a relocation table. ...