Prev: A368 Up: Map Next: A3AE
A375: Pseudo-random number generator
Seed from A0A1 , $A0A2 and $A0A3
Used by the routines at 969B, 98AF, 9AC5, 9D71, BA5C, BCDD, BD6B, C03A, C05A, C1CA, C531, C540, C54D, C577, C9CA, CA13, CA71 and CAA7.
Output
A Pseudo-random number
A375 PUSH HL
A376 LD A,($A0A1)
A379 SLA A
A37B SLA A
A37D LD HL,$A0A1
A380 ADD A,(HL)
A381 ADD A,$15
A383 LD ($A0A1),A
A386 POP HL
A387 RET
Used by the routines at 9AC5, 9E8A, BA5C, C13B and CA49.
A388 PUSH HL
A389 LD ($A093),BC
A38D LD B,$08
A38F LD A,($A0A1)
A392 AND $48
A394 ADC A,$38
A396 RLA
A397 RLA
A398 LD HL,$A0A3
A39B RL (HL)
A39D DEC HL
A39E RL (HL)
A3A0 DEC HL
A3A1 RL (HL)
A3A3 DJNZ $A38F
A3A5 LD A,($A0A1)
A3A8 LD BC,($A093)
A3AC POP HL
A3AD RET
Prev: A368 Up: Map Next: A3AE