Prev: E30B Up: Map Next: E361
E349: Get Random Number
Output
A The random number
(((B + C) % 0100 + AB) % 0100) * 0100 + (C + CD) % 0100
GetRandomNumber E349 PUSH BC Stash BC on the stack.
E34A LD BC,($F343) BC=*RandomNumberSeed.
E34E XOR A Reset the flags.
E34F LD A,C B=B+C.
E350 ADD A,B
E351 LD B,A
E352 XOR A Reset the flags.
E353 LD A,$CD C=CD+C.
E355 ADD A,C
E356 LD C,A
E357 LD A,$AB B+=AB.
E359 ADC A,B
E35A LD B,A
E35B LD ($F343),BC Write the updated BC backit to *RandomNumberSeed.
E35F POP BC Restore BC from the stack.
E360 RET Return.
Prev: E30B Up: Map Next: E361