Prev: 6704 Up: Map Next: 6720
670E: Generate Random Number
Output
A The random number
GenerateRandomNumber 670E PUSH HL Stash HL and BC on the stack.
670F PUSH BC
6710 LD HL,($65DB) HL=*RandomNumberSeed.
6713 LD B,(HL) Fetch a byte from *HL and store it in B.
6714 INC HL Increment the seed pointer by one.
6715 LD A,$38 Keep H within 00-38.
6717 AND H
6718 LD H,A
6719 LD A,B Copy the random byte into A.
671A LD ($65DB),HL Write the updated seed back to *RandomNumberSeed.
671D POP BC Restore BC and HL from the stack.
671E POP HL
671F RET Return.
Prev: 6704 Up: Map Next: 6720