Prev: 26372 Up: Map Next: 26400
26382: Generate Random Number
Output
A The random number
GenerateRandomNumber 26382 PUSH HL Stash HL and BC on the stack.
26383 PUSH BC
26384 LD HL,(26075) HL=*RandomNumberSeed.
26387 LD B,(HL) Fetch a byte from *HL and store it in B.
26388 INC HL Increment the seed pointer by one.
26389 LD A,56 Keep H within 0-56.
26391 AND H
26392 LD H,A
26393 LD A,B Copy the random byte into A.
26394 LD (26075),HL Write the updated seed back to *RandomNumberSeed.
26397 POP BC Restore BC and HL from the stack.
26398 POP HL
26399 RET Return.
Prev: 26372 Up: Map Next: 26400