Prev: 6483 Up: Map Next: 64C7
6498: Routine at 6498
Used by the routine at GameInit.
6498 LD BC,$7CD6 BC=7CD6 (one byte past the end of MapPoints).
649B LD A,R A=random number.
Limit the number to 0-63.
649D AND %00111111 Keep only bits 0-5.
649F LD D,A Store the result in D.
64A0 LD HL,$0000 HL=0000.
64A3 ADD HL,DE DE=HL + DE.
64A4 EX DE,HL
64A5 LD HL,$7813 HL=7813.
64A8 LD A,(HL) A=HL.
64A9 CP $20 If A is 20 jump to HandlerSpriteCup.
64AB JR Z,HandlerSpriteCup
64AD CP $60 If A is not 60 jump to 64BC.
64AF JR NZ,$64BC
64B1 LD (HL),$20
HandlerSpriteCup 64B3 DEC HL Decrease HL by one.
64B4 LD A,(DE) A=DE.
64B5 INC DE Increment DE by one.
64B6 AND %01111111 Keep only bits 0-6.
64B8 ADD A,$20 A=A + 20.
64BA LD (HL),A Store A at HL.
64BB INC HL Increment HL by one.
64BC INC HL Increment HL by three.
64BD INC HL
64BE INC HL
64BF PUSH HL Stash HL on the stack.
64C0 AND A
64C1 SBC HL,BC
64C3 POP HL Restore HL from the stack.
64C4 JR C,$64A8 If ... jump to 64A8.
64C6 RET Return.
Prev: 6483 Up: Map Next: 64C7