Prev: 45038 Up: Map Next: 45084
45046: 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 45046 LD L,E Point HL at the cell that the light is in.
45047 LD H,D
45048 LD BC,32 Use a row of 32 characters.
45051 AND A Take it off to find the cell above.
45052 SBC HL,BC
45054 LD A,(HL) Fetch the attribute of the cell.
45055 CP 72 Jump to turn up if it is part of the frame.
45057 JR Z,SetLightUp
45059 ADD HL,BC Move down to the cell below.
45060 ADD HL,BC
45061 LD A,(HL) Fetch the attribute of the cell.
45062 CP 72 Jump to turn down if it is part of the frame.
45064 JR Z,SetLightDown
45066 LD A,(38441) Fetch the flag that says that the light has turned.
45069 AND A Return if it has.
45070 RET NZ
45071 OR 1 Set the flag...
45073 LD (38441),A ...and store it.
45076 LD A,(IX+0) Fetch the type of the light.
45079 XOR 8 Turn the light round, and store it.
45081 LD (IX+0),A
Prev: 45038 Up: Map Next: 45084