Prev: AFEE Up: Map Next: B01C
AFF6: Turn Light Vertically
Used by the routines at MoveLightLeft and TurnLightHorizontally.
Tries to turn a light so that it goes up or down. If neither of the cells is part of the frame then the light is turned round, and the routine tries again, but only once.
Input
DE Address of the attribute that the light is in
IX Light
TurnLightVertically AFF6 LD L,E Point HL at the cell that the light is in.
AFF7 LD H,D
AFF8 LD BC,$0020 Use a row of 20 characters.
AFFB AND A Take it off to find the cell above.
AFFC SBC HL,BC
AFFE LD A,(HL) Fetch the attribute of the cell.
AFFF CP $48 Jump to turn up if it is part of the frame.
B001 JR Z,SetLightUp
B003 ADD HL,BC Move down to the cell below.
B004 ADD HL,BC
B005 LD A,(HL) Fetch the attribute of the cell.
B006 CP $48 Jump to turn down if it is part of the frame.
B008 JR Z,SetLightDown
B00A LD A,($9629) Fetch the flag that says that the light has turned.
B00D AND A Return if it has.
B00E RET NZ
B00F OR $01 Set the flag...
B011 LD ($9629),A ...and store it.
B014 LD A,(IX+$00) Fetch the type of the light.
B017 XOR $08 Turn the light round, and store it.
B019 LD (IX+$00),A
Prev: AFEE Up: Map Next: B01C