2020-06-27 19:32:24 +00:00
|
|
|
GetPredefPointer::
|
2014-05-26 21:04:56 +00:00
|
|
|
; Store the contents of the register
|
|
|
|
; pairs (hl, de, bc) at wPredefRegisters.
|
|
|
|
; Then put the bank and address of predef
|
|
|
|
; wPredefID in [wPredefBank] and hl.
|
|
|
|
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, h
|
|
|
|
ld [wPredefRegisters], a
|
|
|
|
ld a, l
|
|
|
|
ld [wPredefRegisters + 1], a
|
|
|
|
|
|
|
|
ld hl, wPredefRegisters + 2
|
|
|
|
ld a, d
|
|
|
|
ld [hli], a
|
|
|
|
ld a, e
|
|
|
|
ld [hli], a
|
|
|
|
|
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], c
|
|
|
|
|
|
|
|
ld hl, PredefPointers
|
|
|
|
ld de, 0
|
|
|
|
|
|
|
|
ld a, [wPredefID]
|
|
|
|
ld e, a
|
2014-05-26 21:04:56 +00:00
|
|
|
add a
|
|
|
|
add e
|
2017-12-30 00:54:27 +00:00
|
|
|
ld e, a
|
2016-06-12 04:30:05 +00:00
|
|
|
jr nc, .nocarry
|
2014-05-22 22:13:20 +00:00
|
|
|
inc d
|
|
|
|
|
2016-06-12 04:30:05 +00:00
|
|
|
.nocarry
|
2017-12-30 00:54:27 +00:00
|
|
|
add hl, de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
|
|
; get bank of predef routine
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [de]
|
|
|
|
ld [wPredefBank], a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
|
|
; get pointer
|
|
|
|
inc de
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [de]
|
|
|
|
ld l, a
|
2014-05-22 22:13:20 +00:00
|
|
|
inc de
|
2017-12-30 00:54:27 +00:00
|
|
|
ld a, [de]
|
|
|
|
ld h, a
|
2014-05-22 22:13:20 +00:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
2020-06-23 21:50:50 +00:00
|
|
|
INCLUDE "data/predef_pointers.asm"
|