11 lines
569 B
Z80 Assembly
11 lines
569 B
Z80 Assembly
Dispatch: ;remember, you need to CALL this address for it to work properly. Otherwise your program will most likely crash.
|
|
add a ;this is a table of 16-bit values, so multiply the index by 2.
|
|
ld a,(hl) ;get the low byte of the function addr. you wish to call
|
|
push af
|
|
inc hl
|
|
ld a,(hl) ;get the high byte of the function addr. you wish to call
|
|
ld H,a ;store the high byte in H
|
|
pop af
|
|
ld L,a ;store the low byte in L
|
|
jp (HL) ;now you've jumped to the desired function. Its RET will return execution to the instruction just after "CALL Dispatch"
|