summaryrefslogtreecommitdiff
path: root/home/util.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/util.asm')
-rw-r--r--home/util.asm32
1 files changed, 30 insertions, 2 deletions
diff --git a/home/util.asm b/home/util.asm
index bfc4ce4..6591da2 100644
--- a/home/util.asm
+++ b/home/util.asm
@@ -1,6 +1,21 @@
INCLUDE "constants.asm"
-SECTION "Misc Utility Functions", ROM0[$3429]
+if DEBUG
+SECTION "Misc Utility Functions", ROM0[$341F]
+else
+SECTION "Misc Utility Functions", ROM0[$33E3]
+endc
+
+_341F:: ; 341f
+; Returns hl + a * 6
+ and a
+ ret z
+ ld bc, 6
+.loop:
+ add hl, bc
+ dec a
+ jr nz, .loop
+ ret
AddNTimes:: ; 3429 (0:3429)
and a
@@ -10,4 +25,17 @@ AddNTimes:: ; 3429 (0:3429)
dec a
jr nz, .asm_342b
ret
-; 0x3430 \ No newline at end of file
+; 0x3430
+
+memcmp:: ; 3430
+; Compare c bytes at hl and de
+; Returns z if all equal, nz otherwise.
+.loop:
+ ld a, [de]
+ cp [hl]
+ ret nz
+ inc de
+ inc hl
+ dec c
+ jr nz, .loop
+ ret