Prev: 44942 Up: Map Next: 45020
44974: Move Light Left
Moves a light one cell to the left, along the frame of the screen, if the cell on the left is part of the frame. If it is not then the light turns. A light that gets back to the top left of the frame after its delay has run out is finished.
Input
DE Address of the attribute that the light is in
IX Light
MoveLightLeft 44974 LD L,E Point HL at the cell on the left.
44975 LD H,D
44976 DEC L
This entry point is used by the routine at MoveLightRight.
MoveLightLeft_Move 44977 LD A,(HL) Fetch the attribute of the cell.
44978 CP 72 Jump to turn the light if it is not part of the frame.
44980 JR NZ,TurnLightVertically
This entry point is used by the routines at MoveLightUp and SetLightUp.
MoveLight_Move 44982 LD A,72 Restore the attribute of the frame in the cell that the light is leaving.
44984 LD (DE),A
44985 EX DE,HL Put the address of the new cell in DE.
44986 LD A,(IX+1) Fetch the delay of the light.
44989 AND A Jump to show the light if the delay has not run out.
44990 JR NZ,MoveLight_Show
44992 LD HL,22561 Point HL at the top left of the frame.
44995 AND A Jump to show the light if it has not got there.
44996 SBC HL,DE
44998 JR NZ,MoveLight_Show
45000 LD (IX+0),0 Otherwise the light has finished, so free its slot...
45004 RET ...and return.
MoveLight_Show 45005 LD A,(IX+0) Fetch the type of the light.
45008 AND 7 Keep the colour...
45010 OR 72 ...and add the attribute of the frame.
45012 LD (DE),A Show the light in the new cell.
45013 LD (IX+2),E Store the address of the cell...
45016 LD (IX+3),D ...in the light.
45019 RET Return.
Prev: 44942 Up: Map Next: 45020