summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorISSOtm <eldredhabert0@gmail.com>2018-06-06 00:43:42 +0200
committerISSOtm <eldredhabert0@gmail.com>2018-06-06 00:44:41 +0200
commita9519e401db0c8db0b96cee3c0130c3fe8a4a58b (patch)
tree846df4dbab2f7ac99d429af9dc0312901e4fe4ae
parente9a8f8a769f77c289a4aa38423a39e00425b4813 (diff)
Disassemble map script function
Part 1 of disassembling map loading functions
-rw-r--r--home/map.asm26
-rw-r--r--shim.sym2
-rw-r--r--wram.asm4
3 files changed, 29 insertions, 3 deletions
diff --git a/home/map.asm b/home/map.asm
new file mode 100644
index 0000000..2583643
--- /dev/null
+++ b/home/map.asm
@@ -0,0 +1,26 @@
+INCLUDE "constants.asm"
+
+SECTION "Map functions", ROM0[$20FF]
+
+; Runs a map script indexed by wMapScriptNumber
+RunMapScript:: ; 20ff
+ push hl
+ push de
+ push bc
+ ld a, [wMapScriptNumber]
+ add a, a
+ add a, a
+ ld d, 0
+ ld e, a
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .return
+ push de
+ jp hl
+.return
+ pop bc
+ pop de
+ pop hl
+ ret
diff --git a/shim.sym b/shim.sym
index f704139..0c6ab65 100644
--- a/shim.sym
+++ b/shim.sym
@@ -111,7 +111,7 @@
; Structure:
; byte Map group ($ff = end)
; byte Map ID
-; ptr Copied to c5e9, also byte pointed to written at wUnknownIdc5e8
+; ptr Copied to c5e9, also byte pointed to written at wMapScriptNumber
; ptr Copied to c5eb
; word Unknown (2 bytes)
05:470e UnknownMapBufferPointers
diff --git a/wram.asm b/wram.asm
index 0dd872f..f98b66c 100644
--- a/wram.asm
+++ b/wram.asm
@@ -98,8 +98,8 @@ SECTION "Unknown map buffer?", WRAM0[$C5E8]
wMapBuffer::
wMapScriptNumber:: db ; c5e8
-wUnknownIdC5E8Location:: dw ; c5e9
-wUnknownMapPointer:: dw ; c5eb
+wMapScriptNumberLocation:: dw ; c5e9
+wUnknownMapPointer:: dw ; c5eb ; TODO
ds 19 ; TODO
wMapBufferEnd:: ; c600