| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 | GetPredefPointer::
; 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.
	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
	add a
	add e
	ld e, a
	jr nc, .nocarry
	inc d
.nocarry
	add hl, de
	ld d, h
	ld e, l
	; get bank of predef routine
	ld a, [de]
	ld [wPredefBank], a
	; get pointer
	inc de
	ld a, [de]
	ld l, a
	inc de
	ld a, [de]
	ld h, a
	ret
INCLUDE "data/predef_pointers.asm"
 |