Prev: 6478 Up: Map Next: 64AB
6491: Return a random 8-bit number in A
Used by the routines at 5E00, 61F3 and 64B7.
6491 LD HL,($5CB0) Seed value
6494 LD DE,($5DCF) Get the random number counter
6498 INC DE
6499 LD ($5DCF),DE Increment it for the next round
649D LD A,L
649E ADD A,H
649F ADD A,A
64A0 ADD A,H
64A1 AND $07
64A3 LD H,A
64A4 LD A,(HL)
64A5 ADD HL,DE
64A6 LD ($5CB0),HL Store new seed value
64A9 ADD A,L
64AA RET
Prev: 6478 Up: Map Next: 64AB