Prev: AEE0 Up: Map Next: AF19
AEED: Start Light
Used by the routine at MoveLights.
Starts a new light, in a slot that is not in use. The light is given a random colour and direction, and a random delay. It starts at the top left of the frame of the screen, which is made of attributes of the value 48. The lights then move along the frame, one cell a frame.
Input
HL Address of the slot of the light
StartLight AEED PUSH HL Copy the address of the slot into IX...
AEEE POP IX Pop it into IX.
AEF0 LD A,($9617) Fetch the random number...
AEF3 LD E,A ...and keep it in E.
AEF4 AND $03 Keep the low two bits...
AEF6 LD L,A
AEF7 LD H,$00 ...and clear H.
AEF9 LD BC,$AF19 Point BC at LightColours.
AEFC ADD HL,BC Add the offset.
AEFD LD D,(HL) Fetch the colour...
AEFE LD A,E ...and fetch the random number again.
AEFF AND $18 Keep the bits that choose the direction, and add the colour.
AF01 OR D
AF02 LD (IX+$00),A Store the type of the light.
AF05 LD A,($9617) Fetch the random number again...
AF08 AND $3F ...keep a number between 00 and 3F, and add 20 to it...
AF0A OR $20
AF0C LD (IX+$01),A ...to find the time before the light can finish.
AF0F LD (IX+$02),$21 Store the low byte of the address of the attribute, 21...
AF13 LD (IX+$03),$58 ...and the high byte, 58.
AF17 JR MoveLights_Update Jump to move the lights.
Prev: AEE0 Up: Map Next: AF19