summaryrefslogtreecommitdiff
path: root/home/overworld.asm
diff options
context:
space:
mode:
authorEldred Habert <eldredhabert0@gmail.com>2018-06-03 20:32:40 +0200
committerGitHub <noreply@github.com>2018-06-03 20:32:40 +0200
commit63ee9c801200b64108dbfcfbc31fe2f5eda975c9 (patch)
treec9b94852c7bb0d7e107b6b84c3c7103e08e5efb0 /home/overworld.asm
parent3a7ac51071ad9f3ae277046c29d7482b56754d1d (diff)
parent02051b9e0e213fb7d2e349e3cce220bb7a983472 (diff)
Merge pull request #2 from PikalaxALT/build_more_roms
Build all four ROMs in the dump
Diffstat (limited to 'home/overworld.asm')
-rw-r--r--home/overworld.asm66
1 files changed, 66 insertions, 0 deletions
diff --git a/home/overworld.asm b/home/overworld.asm
new file mode 100644
index 0000000..2a4671a
--- /dev/null
+++ b/home/overworld.asm
@@ -0,0 +1,66 @@
+INCLUDE "constants.asm"
+
+if DEBUG
+SECTION "Startmenu and Select Button Check", ROM0[$2C05]
+else
+SECTION "Startmenu and Select Button Check", ROM0[$2BDF]
+endc
+
+OverworldStartButtonCheck:: ; 2c05 (0:2c05)
+ ldh a, [hJoyState]
+ bit START_F, a
+ ret z
+if DEBUG
+ and (START | B_BUTTON)
+ cp (START | B_BUTTON)
+ jr nz, .regularMenu
+ ld a, [wce63]
+ bit 1, a
+ ret z ; debug disabled
+ ld a, BANK(InGameDebugMenu)
+ ld hl, InGameDebugMenu
+ call FarCall_hl
+ jr CheckStartmenuSelectHook
+.regularMenu
+endc
+ ld a, BANK(DisplayStartMenu)
+ ld hl, DisplayStartMenu
+ call FarCall_hl
+ jr CheckStartmenuSelectHook
+SelectButtonFunction:: ; 2c2a (0:2c2a)
+ ld hl, CheckRegisteredItem
+ ld a, BANK(CheckRegisteredItem)
+ call FarCall_hl
+CheckStartmenuSelectHook:
+ ldh a, [hStartmenuCloseAndSelectHookEnable]
+ and a
+ ret z ; hook is disabled
+ ld hl, StartmenuCloseAndSelectHookPtr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld a, [StartmenuCloseAndSelectHookBank]
+ call FarCall_hl
+ ld hl, hStartmenuCloseAndSelectHookEnable
+ xor a
+ ld [hli], a ; clear hook enable and ???
+ ld [hl], a
+ dec a
+ ret
+
+if DEBUG
+SECTION "Install StartMenu Hook Function", ROM0[$35EC]
+else
+SECTION "Install StartMenu Hook Function", ROM0[$35B0]
+endc
+
+InstallStartmenuCloseAndSelectHook::
+; Install a function that is called as soon as
+; the start menu is closed or directly after
+; the select button function ran
+ ld [StartmenuCloseAndSelectHookBank], a
+ ld a, l
+ ld [StartmenuCloseAndSelectHookPtr], a
+ ld a, h
+ ld [StartmenuCloseAndSelectHookPtr + 1], a
+ ret