Prev: AF8E Up: Map Next: AFDC
AFAE: 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 AFAE LD L,E Point HL at the cell on the left.
AFAF LD H,D
AFB0 DEC L
This entry point is used by the routine at MoveLightRight.
MoveLightLeft_Move AFB1 LD A,(HL) Fetch the attribute of the cell.
AFB2 CP $48 Jump to turn the light if it is not part of the frame.
AFB4 JR NZ,TurnLightVertically
This entry point is used by the routines at MoveLightUp and SetLightUp.
MoveLight_Move AFB6 LD A,$48 Restore the attribute of the frame in the cell that the light is leaving.
AFB8 LD (DE),A
AFB9 EX DE,HL Put the address of the new cell in DE.
AFBA LD A,(IX+$01) Fetch the delay of the light.
AFBD AND A Jump to show the light if the delay has not run out.
AFBE JR NZ,MoveLight_Show
AFC0 LD HL,$5821 Point HL at the top left of the frame.
AFC3 AND A Jump to show the light if it has not got there.
AFC4 SBC HL,DE
AFC6 JR NZ,MoveLight_Show
AFC8 LD (IX+$00),$00 Otherwise the light has finished, so free its slot...
AFCC RET ...and return.
MoveLight_Show AFCD LD A,(IX+$00) Fetch the type of the light.
AFD0 AND $07 Keep the colour...
AFD2 OR $48 ...and add the attribute of the frame.
AFD4 LD (DE),A Show the light in the new cell.
AFD5 LD (IX+$02),E Store the address of the cell...
AFD8 LD (IX+$03),D ...in the light.
AFDB RET Return.
Prev: AF8E Up: Map Next: AFDC