___sdcc_bcall.s (593B)
1 .include "global.s" 2 3 .area _HOME 4 5___sdcc_bcall:: 6banked_call:: ; Performs a long call. 7 pop hl ; Get the return address 8 ldh a,(__current_bank) 9 push af ; Push the current bank onto the stack 10 ld a,(hl+) ; Fetch the call address 11 ld e, a 12 ld a,(hl+) 13 ld d, a 14 ld a,(hl+) ; ...and page 15 inc hl ; Yes this should be here 16 push hl ; Push the real return address 17 ldh (__current_bank),a 18 ld (.MBC_ROM_PAGE),a ; Perform the switch 19 ld l,e 20 ld h,d 21 rst 0x20 22banked_ret:: 23 pop hl ; Get the return address 24 pop af ; Pop the old bank 25 ldh (__current_bank),a 26 ld (.MBC_ROM_PAGE),a 27 jp (hl)