Prev: B9E6 Up: Map Next: BFCF
BFAE: Random number generator (RST $20)
Used by the routine at L8015.
rnd BFAE PUSH IX
BFB0 LD IX,random_number Last random number
BFB4 LD A,(IX+$00) Get byte 0
BFB7 RLCA Rotate left
BFB8 XOR (IX+$00) Flip some bits
BFBB RRCA Rotate right
BFBC INC (IX+$01) Increment byte 1
BFBF ADD A,(IX+$01) Add byte 1
BFC2 AND A Set flags
BFC3 JP PE,rnd_0 Skip ahead if even parity
BFC6 INC (IX+$01) Else increment byte 1
rnd_0 BFC9 LD (IX+$00),A Set byte 0
BFCC POP IX
BFCE RET
Prev: B9E6 Up: Map Next: BFCF