mirror of
https://github.com/pret/pokeyellow.git
synced 2026-05-13 06:21:55 -05:00
49 lines
918 B
NASM
49 lines
918 B
NASM
Predef:: ; 3eb4 (0:3eb4)
|
|
; Call predefined function a.
|
|
; To preserve other registers, have the
|
|
; destination call GetPredefRegisters.
|
|
|
|
; Save the predef id for GetPredefPointer.
|
|
ld [wPredefID], a
|
|
|
|
; A hack for LoadDestinationWarpPosition.
|
|
; See LoadTilesetHeader (predef $19).
|
|
ld a, [H_LOADEDROMBANK]
|
|
ld [wPredefParentBank], a
|
|
|
|
push af
|
|
ld a, BANK(GetPredefPointer)
|
|
ld [H_LOADEDROMBANK], a
|
|
ld [MBC1RomBank], a
|
|
|
|
call GetPredefPointer
|
|
|
|
ld a, [wPredefBank]
|
|
call BankswitchCommon
|
|
|
|
ld de, .done
|
|
push de
|
|
jp [hl]
|
|
.done
|
|
|
|
pop af
|
|
call BankswitchCommon
|
|
ret
|
|
|
|
GetPredefRegisters:: ; 3ed7 (0:3ed7)
|
|
; Restore the contents of register pairs
|
|
; when GetPredefPointer was called.
|
|
ld a, [wPredefRegisters + 0]
|
|
ld h, a
|
|
ld a, [wPredefRegisters + 1]
|
|
ld l, a
|
|
ld a, [wPredefRegisters + 2]
|
|
ld d, a
|
|
ld a, [wPredefRegisters + 3]
|
|
ld e, a
|
|
ld a, [wPredefRegisters + 4]
|
|
ld b, a
|
|
ld a, [wPredefRegisters + 5]
|
|
ld c, a
|
|
ret
|