Prev: 45046 Up: Map Next: 45119
45084: Turn Light Horizontally
Used by the routine at MoveLightUp.
Tries to turn a light so that it goes left or right. If neither of the cells is part of the frame then the light is turned round, and the routine tries to turn it vertically instead, but only once.
Input
DE Address of the attribute that the light is in
IX Light
TurnLightHorizontally 45084 LD L,E Point HL at the cell on the left.
45085 LD H,D
45086 DEC L
45087 LD A,(HL) Fetch the attribute of the cell.
45088 CP 72 Jump to turn left if it is part of the frame.
45090 JR Z,SetLightLeft
45092 INC L Move to the cell on the right.
45093 INC L
45094 LD A,(HL) Fetch the attribute of the cell.
45095 CP 72 Jump to turn right if it is part of the frame.
45097 JR Z,SetLightRight
45099 LD A,(38441) Fetch the flag that says that the light has turned.
45102 AND A Return if it has.
45103 RET NZ
45104 OR 1 Set the flag...
45106 LD (38441),A ...and store it.
45109 LD A,(IX+0) Fetch the type of the light.
45112 XOR 8 Turn the light round, and store it.
45114 LD (IX+0),A
45117 JR TurnLightVertically Jump to try to turn the light vertically.
Prev: 45046 Up: Map Next: 45119