Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef rcall
- #define rcall saveSScreen
- #endif
- push hl
- push de
- push bc
- push af
- ld hl,rcall+1
- .db 36h \ jp (hl)
- dec hl
- .db 36h \ pop hl
- ex de,hl
- call rcall
- ;HL now points here
- discovered_addr:
- ;At this point, we are going to load a routine for relative jumps
- push hl
- ld bc,reljump-discovered_addr
- add hl,bc
- ld bc,reljump_end-reljump
- ldir
- pop af
- pop bc
- pop de
- pop hl
- ;At this point, you can "call rcall \ .dw offset"
- ;Your code goes here
- ret
- reljump:
- ex sp,(hl)
- push de
- or a ;in the case of ADL mode, we need to make sure UDE = 0
- ex de,hl ;
- sbc hl,hl ;
- ex de,hl ;
- ld e,(hl)
- inc hl
- ld d,(hl)
- inc hl
- inc sp
- inc sp
- inc sp
- inc sp
- push hl
- add hl,de
- dec sp
- dec sp
- dec sp
- dec sp
- pop de
- jp (hl)
- reljump_end:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement