My Question
Building the code below i get: "319920C30020C30A20FBED563E00C600CA0520F33E55D3073E00FBC9"
My Problem is I assumed that this would be padded with zeros such that each block of code is at the requested addresses 0000H, 0038H, and 2000H in program memory.
Immediately I can see a work around of manually doing the padding, but how are Z80 processors loaded with the above program, to be at the correct addresses?
Code
STACK .EQU 2099H
.ORG 0000H
ld SP, STACK
jp 2000H
.ORG 0038H
jp service_routine
.ORG 2000H
EI
IM 1
LD A, 00H
LOOP:
ADD A, 00H
jp z, LOOP
service_routine:
DI
ld A, 55H
out (07H),A
ld A, 00H
EI
ret
The
ORG
directive merely tells the assembler what you think the PC is at that point in the code. The assembler can then use this to compute the correct code for a relative jump. It does not direct the assembler or the loader to actually load the code at that address.