summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/compare.asm35
-rw-r--r--home/queue_script.asm12
2 files changed, 47 insertions, 0 deletions
diff --git a/home/compare.asm b/home/compare.asm
new file mode 100644
index 000000000..26b7567fd
--- /dev/null
+++ b/home/compare.asm
@@ -0,0 +1,35 @@
+CompareBytes::
+; Compare c bytes at de and hl.
+; Return z if they all match.
+.loop
+ ld a, [de]
+ cp [hl]
+ ret nz
+ inc de
+ inc hl
+ dec c
+ jr nz, .loop
+ ret
+
+CompareBytesLong::
+; Compare bc bytes at de and hl.
+; Return carry if they all match.
+.loop
+ ld a, [de]
+ cp [hl]
+ jr nz, .diff
+
+ inc de
+ inc hl
+ dec bc
+
+ ld a, b
+ or c
+ jr nz, .loop
+
+ scf
+ ret
+
+.diff:
+ and a
+ ret
diff --git a/home/queue_script.asm b/home/queue_script.asm
new file mode 100644
index 000000000..40a971dc9
--- /dev/null
+++ b/home/queue_script.asm
@@ -0,0 +1,12 @@
+QueueScript::
+; Push pointer hl in the current bank to wQueuedScriptBank.
+ ld a, [hROMBank]
+
+FarQueueScript::
+; Push pointer a:hl to wQueuedScriptBank.
+ ld [wQueuedScriptBank], a
+ ld a, l
+ ld [wQueuedScriptAddr], a
+ ld a, h
+ ld [wQueuedScriptAddr + 1], a
+ ret