summaryrefslogtreecommitdiff
path: root/engine/rng.asm
diff options
context:
space:
mode:
authorU-Fish-PC\Daniel <corrnondacqb@yahoo.com>2014-05-22 18:13:20 -0400
committerU-Fish-PC\Daniel <corrnondacqb@yahoo.com>2014-05-22 18:13:20 -0400
commit15427f532085846ab6b51719be687951a094cb6c (patch)
treeedea9b189e91641a12dd521756894df84aeeace7 /engine/rng.asm
parentea3ba4cde3706b7c77efb705555ec0c86321cbe2 (diff)
Pull a lot of engine out of main.asm
Diffstat (limited to 'engine/rng.asm')
-rwxr-xr-xengine/rng.asm13
1 files changed, 13 insertions, 0 deletions
diff --git a/engine/rng.asm b/engine/rng.asm
new file mode 100755
index 00000000..a0e0daa7
--- /dev/null
+++ b/engine/rng.asm
@@ -0,0 +1,13 @@
+GenRandom_: ; 13a8f (4:7a8f)
+; generate a random 16-bit integer and store it at $FFD3,$FFD4
+ ld a,[rDIV]
+ ld b,a
+ ld a,[H_RAND1]
+ adc b
+ ld [H_RAND1],a
+ ld a,[rDIV]
+ ld b,a
+ ld a,[H_RAND2]
+ sbc b
+ ld [H_RAND2],a
+ ret