summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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