summaryrefslogtreecommitdiff
path: root/engine/bank3d/random.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/bank3d/random.asm')
-rw-r--r--engine/bank3d/random.asm15
1 files changed, 15 insertions, 0 deletions
diff --git a/engine/bank3d/random.asm b/engine/bank3d/random.asm
new file mode 100644
index 00000000..8c8ead4e
--- /dev/null
+++ b/engine/bank3d/random.asm
@@ -0,0 +1,15 @@
+SECTION "bank3d Random",ROMX[$67DC],BANK[$3D]
+
+Random_::
+; Generate a random 16-bit value.
+ ld a, [rDIV]
+ ld b, a
+ ld a, [hRandomAdd]
+ adc b
+ ld [hRandomAdd], a
+ ld a, [rDIV]
+ ld b, a
+ ld a, [hRandomSub]
+ sbc b
+ ld [hRandomSub], a
+ ret