Prev: 44768 Up: Map Next: 44825
44781: 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 72. The lights then move along the frame, one cell a frame.
Input
HL Address of the slot of the light
StartLight 44781 PUSH HL Copy the address of the slot into IX...
44782 POP IX Pop it into IX.
44784 LD A,(38423) Fetch the random number...
44787 LD E,A ...and keep it in E.
44788 AND 3 Keep the low two bits...
44790 LD L,A
44791 LD H,0 ...and clear H.
44793 LD BC,44825 Point BC at LightColours.
44796 ADD HL,BC Add the offset.
44797 LD D,(HL) Fetch the colour...
44798 LD A,E ...and fetch the random number again.
44799 AND 24 Keep the bits that choose the direction, and add the colour.
44801 OR D
44802 LD (IX+0),A Store the type of the light.
44805 LD A,(38423) Fetch the random number again...
44808 AND 63 ...keep a number between 0 and 63, and add 32 to it...
44810 OR 32
44812 LD (IX+1),A ...to find the time before the light can finish.
44815 LD (IX+2),33 Store the low byte of the address of the attribute, 33...
44819 LD (IX+3),88 ...and the high byte, 88.
44823 JR MoveLights_Update Jump to move the lights.
Prev: 44768 Up: Map Next: 44825