Prev: 5D27 Up: Map Next: 6414
6400: Get Random Number
Used by the routines at 64AA, 6500, 7088, 709D, InitialiseNewLevel and DemoModeInput.
Output
A Random number
GetRandomNumber 6400 PUSH HL Stash HL on the stack.
6401 LD HL,($781E) HL=*RandomNumberSeed.
6404 LD A,(HL) A=*HL.
6405 INC L Increment L by one.
6406 JR NZ,GetRandomNumber_0 Jump to GetRandomNumber_0 if L is not zero.
6408 INC H Increment H by one.
6409 BIT 2,H Jump to GetRandomNumber_0 if bit 2 of H is not set.
640B JR Z,GetRandomNumber_0
640D LD H,$79 H=79.
GetRandomNumber_0 640F LD ($781E),HL Write HL to *RandomNumberSeed.
6412 POP HL Restore HL from the stack.
6413 RET Return.
Prev: 5D27 Up: Map Next: 6414