summaryrefslogtreecommitdiff
path: root/home/jumptable.asm
blob: 15d414b66da82b17a33e126ee79c224404b867cf (plain)
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
INCLUDE "constants.asm"

if DEBUG
SECTION "Jumptable functions", ROM0[$35cd]
else
SECTION "Jumptable functions", ROM0[$3591]
endc

CallJumptable:: ; 35cd (0:35cd)
; CallJumptable
; Call function whose pointer is
; at index a in 2-byte pointer table
; pointed to by hl.
; Clobbers: a, hl
;
; This ultimately wound up at rst $28 in
; GSC
	push de
	ld d, $00
	ld e, a
	add hl, de
	add hl, de
	pop de
	ld a, [hli]
	ld h, [hl]
	ld l, a
	jp hl

CallFar_atHL::
; CallFar_atHL
; Call the function pointed to by
; the 3-byte pointer at hl
; Clobbers: a, hl
	ldh a, [hROMBank]
	push af
	ld a, [hli]
	call Bankswitch
	ld a, [hli]
	ld h, [hl]
	ld l, a
	call .jump
	pop hl
	ld a, h
	call Bankswitch
	ret
.jump: ; 35eb (0:35eb)
	jp hl