Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/home/bankswitch.asm
1270 views
1
BankswitchHome::
2
; switches to bank # in a
3
; Only use this when in the home bank!
4
ld [wBankswitchHomeTemp], a
5
ldh a, [hLoadedROMBank]
6
ld [wBankswitchHomeSavedROMBank], a
7
ld a, [wBankswitchHomeTemp]
8
ldh [hLoadedROMBank], a
9
ld [rROMB], a
10
ret
11
12
BankswitchBack::
13
; returns from BankswitchHome
14
ld a, [wBankswitchHomeSavedROMBank]
15
ldh [hLoadedROMBank], a
16
ld [rROMB], a
17
ret
18
19
Bankswitch::
20
; self-contained bankswitch, use this when not in the home bank
21
; switches to the bank in b
22
ldh a, [hLoadedROMBank]
23
push af
24
ld a, b
25
ldh [hLoadedROMBank], a
26
ld [rROMB], a
27
ld bc, .Return
28
push bc
29
jp hl
30
.Return
31
pop bc
32
ld a, b
33
ldh [hLoadedROMBank], a
34
ld [rROMB], a
35
ret
36
37