Prev: 23847 Up: Map Next: 25620
25600: Get Random Number
Output
A Random number
Random numbers are just data pulled from addresses between 30976-31487 (sequentially).
GetRandomNumber 25600 PUSH HL Stash HL on the stack.
25601 LD HL,(30750) HL=*RandomNumberSeed.
25604 LD A,(HL) A=*HL.
25605 INC L Increment L by one.
25606 JR NZ,UpdateRandomNumberSeed Jump to UpdateRandomNumberSeed if L is not zero.
25608 INC H Increment H by one.
25609 BIT 2,H Jump to UpdateRandomNumberSeed if bit 2 of H is not set.
25611 JR Z,UpdateRandomNumberSeed
Bit 2 is set, this means that H has reached 124 so pull the range back down to 121.
25613 LD H,121 H=121.
UpdateRandomNumberSeed 25615 LD (30750),HL Write HL to *RandomNumberSeed.
25618 POP HL Restore HL from the stack.
25619 RET Return.
Prev: 23847 Up: Map Next: 25620