Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/predefs.asm
1270 views
1
GetPredefPointer::
2
; Back up the contents of the registers (hl, de, bc).
3
; Then put the bank and address of predef
4
; wPredefID in [wPredefBank] and hl.
5
6
ld a, h
7
ld [wPredefHL], a
8
ld a, l
9
ld [wPredefHL + 1], a
10
11
ld hl, wPredefDE
12
ld a, d
13
ld [hli], a
14
ld a, e
15
ld [hli], a
16
17
ASSERT wPredefDE + 2 == wPredefBC
18
ld a, b
19
ld [hli], a
20
ld [hl], c
21
22
ld hl, PredefPointers
23
ld de, 0
24
25
ld a, [wPredefID]
26
ld e, a
27
add a
28
add e
29
ld e, a
30
jr nc, .nocarry
31
inc d
32
33
.nocarry
34
add hl, de
35
ld d, h
36
ld e, l
37
38
; get bank of predef routine
39
ld a, [de]
40
ld [wPredefBank], a
41
42
; get pointer
43
inc de
44
ld a, [de]
45
ld l, a
46
inc de
47
ld a, [de]
48
ld h, a
49
50
ret
51
52
INCLUDE "data/predef_pointers.asm"
53
54