summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-06-06 16:11:16 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2018-06-06 16:11:16 -0400
commit884e0f67f8cd0151784c90fa18682ef45cd3bf6a (patch)
tree0c6750172578aa3e8230a7a34b4aca5e4ac07a98
parentbad561848af1a20143ac290a92ecdfb9748a14e0 (diff)
Disassemble home calls to Multiply and Divide
-rw-r--r--home/print_text.asm21
-rw-r--r--home/util.asm53
-rw-r--r--macros/farcall.asm2
-rw-r--r--shim.sym2
4 files changed, 73 insertions, 5 deletions
diff --git a/home/print_text.asm b/home/print_text.asm
index e8b4eeb..0a17688 100644
--- a/home/print_text.asm
+++ b/home/print_text.asm
@@ -48,4 +48,23 @@ PrintLetterDelay:: ; 33a3 (0:33a3)
pop de
pop hl
ret
-; 0x33e3 \ No newline at end of file
+; 0x33e3
+
+CopyDataUntil:: ; 33e3
+; Copy [hl .. bc) to de.
+
+; In other words, the source data is
+; from hl up to but not including bc,
+; and the destination is de.
+
+.asm_33e3: ; 00:33e3
+ ld a, [hli]
+ ld [de], a
+ inc de
+ ld a, h
+ cp b
+ jr nz, .asm_33e3
+ ld a, l
+ cp c
+ jr nz, .asm_33e3
+ ret
diff --git a/home/util.asm b/home/util.asm
index 6591da2..8efe322 100644
--- a/home/util.asm
+++ b/home/util.asm
@@ -1,12 +1,59 @@
INCLUDE "constants.asm"
if DEBUG
-SECTION "Misc Utility Functions", ROM0[$341F]
+SECTION "Misc Utility Functions", ROM0[$33EF]
else
-SECTION "Misc Utility Functions", ROM0[$33E3]
+SECTION "Misc Utility Functions", ROM0[$33B3]
endc
-_341F:: ; 341f
+Function33ef::
+ ; hl = src
+ ; de = dest
+ ; b = y
+ ; c = x
+ push hl
+ push de
+ push bc
+ ld a, b
+ dec a
+ dec a
+ ld b, $0
+.asm_33f7: ; 00:33f7
+ add hl, bc
+ dec a
+ jr nz, .asm_33f7
+ pop bc
+ dec b
+ ld a, b
+ push hl
+ add hl, bc
+ ld d, h
+ ld e, l
+ pop hl
+.asm_3403: ; 00:3403
+ push af
+ push bc
+ call CopyBytes
+ pop bc
+ push bc
+ ld a, c
+ xor $ff
+ ld c, a
+ ld b, $ff
+ inc bc
+ add hl, bc
+ ld d, h
+ ld e, l
+ add hl, bc
+ pop bc
+ pop af
+ dec a
+ jr nz, .asm_3403
+ pop hl
+ pop de
+ jp CopyBytes
+
+SkipNames:: ; 341f
; Returns hl + a * 6
and a
ret z
diff --git a/macros/farcall.asm b/macros/farcall.asm
index 05bb7b1..5e39410 100644
--- a/macros/farcall.asm
+++ b/macros/farcall.asm
@@ -12,7 +12,7 @@ callab: MACRO ; address, bank
ENDM
homecall: MACRO
- ld a, [hROMBank]
+ ldh a, [hROMBank]
push af
ld a, BANK(\1)
call Bankswitch
diff --git a/shim.sym b/shim.sym
index 704fb3e..dd2b1f6 100644
--- a/shim.sym
+++ b/shim.sym
@@ -57,6 +57,8 @@
01:6445 Function6445
01:66B1 Function66b1
01:6713 Function6713
+01:6810 _Multiply
+01:6870 _Divide
01:68F3 ItemAttributes
02:4000 Function8000