Prev: 9542 Up: Map Next: 962E
9618: Random number generator
Output
A Random byte
rng_seed 9618 DEFB $7B,$2D,$E9 Seed / initial state
This entry point is used by the routines at animate_meters, sfx_cornering, setup_transition, print_chatter, smash_handler, spawn_cars and main_loop_18.
rng 961B LD HL,$9618 Point at rng_seed / state bytes
961E LD A,(HL) rng_seed[0] -= 141
961F SUB $8D
9621 LD (HL),A
9622 INC HL rng_seed[1] += 3
9623 INC (HL)
9624 INC (HL)
9625 INC (HL)
9626 ADD A,(HL) A = rng_seed[0] + rng_seed[1]
9627 INC HL
9628 RRCA Rotate A by 1
9629 RRC (HL) Rotate rng_seed[2] by 1
962B ADD A,(HL) rng_seed[2] += A
962C LD (HL),A
962D RET Return
Prev: 9542 Up: Map Next: 962E