Prev: D8AC Up: Map Next: D8E5
D8B0: Routine at D8B0
On exit, holds a random number between $00 and $FF.
Random_Number D8B0 PUSH BC Stashes BC and HL for later.
D8B1 PUSH HL
D8B2 LD A,($D8AE) Decrease D8AE by one.
D8B5 DEC A
D8B6 LD ($D8AE),A
D8B9 JR NZ,Random_Number_01 If the result is not zero jump to Random_Number_01.
D8BB LD HL,($D8AC)
D8BE INC HL
D8BF PUSH HL
D8C0 POP BC
D8C1 ADD HL,HL
D8C2 ADD HL,BC
D8C3 ADD HL,BC
D8C4 ADD HL,BC
D8C5 ADD HL,BC
D8C6 JR Random_Number_02
Random_Number_01 D8C8 LD HL,($D8AC)
D8CB INC HL
D8CC PUSH HL
D8CD POP BC
D8CE ADD HL,HL
D8CF ADD HL,BC
D8D0 ADD HL,BC
D8D1 ADD HL,BC
D8D2 ADD HL,BC
D8D3 ADD HL,BC
D8D4 PUSH HL
D8D5 POP BC
D8D6 ADD HL,HL
Random_Number_02 D8D7 ADD HL,BC
D8D8 DEC HL
D8D9 LD ($D8AC),HL
D8DC LD A,L
D8DD LD HL,$D8AF
D8E0 INC (HL)
D8E1 ADD A,(HL)
D8E2 POP HL
D8E3 POP BC
D8E4 RET
Prev: D8AC Up: Map Next: D8E5