diff options
Diffstat (limited to 'home/random.asm')
-rw-r--r-- | home/random.asm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/home/random.asm b/home/random.asm new file mode 100644 index 0000000..e150312 --- /dev/null +++ b/home/random.asm @@ -0,0 +1,32 @@ +include "constants.asm" + +if DEBUG +SECTION "Random Number Generation", ROM0 [$3270] +else +SECTION "Random Number Generation", ROM0 [$3234] +endc + +Random:: + push bc + ldh a, [rLY] + ld c, a + swap a + ld b, a + ldh a, [rDIV] + adc b + ld b, a + ldh a, [hRandomAdd] + adc b + ldh [hRandomAdd], a + ldh a, [rLY] + swap a + ld b, a + ldh a, [rDIV] + adc b + adc c + ld b, a + ldh a, [hRandomSub] + sbc b + ldh [hRandomSub], a + pop bc + ret |