![]() |
Routines |
Prev: 29731 | Up: Map |
Continues from the routine at 29668. Checks whether Sam is standing next to a fuse, door, light switch or telephone, and updates the icon panel as appropriate.
|
||||||||||
29733 | LD A,(HL) | A=Sam's y-coordinate | ||||||||
29734 | LD DE,29647 | Point DE at the list of x-coordinates of the house doors (at 29647) | ||||||||
29737 | CP 31 | 31 is the y-coordinate of the house doors | ||||||||
29739 | JR Z,29747 | Jump if Sam's y-coordinate is 31 | ||||||||
29741 | CP 33 | 33 is the y-coordinate of the shop doors | ||||||||
29743 | JR NZ,29765 | Jump unless Sam's y-coordinate is 33 | ||||||||
29745 | LD E,220 | DE=29660 (list of x-coordinates of shop doors) | ||||||||
29747 | DEC L | L=1 | ||||||||
29748 | LD A,(DE) | A=x-coordinate of a door (or 255) | ||||||||
29749 | INC E | Point DE at the next x-coordinate in the list | ||||||||
29750 | INC A | Have we reached the end of the list? | ||||||||
29751 | JR Z,29765 | Jump if so (Sam's not standing next to a door) | ||||||||
29753 | DEC A | A=x-coordinate of the door | ||||||||
29754 | CP (HL) | Is Sam's x-coordinate the same? | ||||||||
29755 | JR NZ,29748 | Jump back if not to check the next door | ||||||||
This entry point is used by the routine at 29668.
|
||||||||||
29757 | LD A,(32680) | Set bit 6 at 32680: door icon | ||||||||
29760 | SET 6,A | |||||||||
29762 | LD (32680),A | |||||||||
29765 | LD L,4 | Point HL at byte 4 of Sam's buffer | ||||||||
29767 | BIT 0,(HL) | Is Sam indoors? | ||||||||
29769 | JP Z,29680 | Update the icon panel now if not | ||||||||
29772 | LD L,2 | A=Sam's y-coordinate | ||||||||
29774 | LD A,(HL) | |||||||||
29775 | CP 33 | Is Sam inside a shop? | ||||||||
29777 | JR Z,29800 | Jump if so | ||||||||
29779 | SUB 6 | Keep subtracting 6 (the height of a floor) from Sam's y-coordinate until it's negative | ||||||||
29781 | JR NC,29779 | |||||||||
29783 | CP 251 | Is Sam's y-coordinate 1, 7, 13, 19, 25 or 31? | ||||||||
29785 | JP NZ,29680 | Update the icon panel now if not (Sam's on a staircase) | ||||||||
29788 | CALL 30116 | Is Sam standing next to a fuse that has not been blown yet? | ||||||||
29791 | JR NZ,29800 | Jump if not | ||||||||
29793 | LD HL,32680 | Set bit 7 at 32680: fuse icon | ||||||||
29796 | SET 7,(HL) | |||||||||
29798 | LD H,230 | 230=Sam | ||||||||
29800 | CALL 62518 | Is Sam standing next to a light switch? | ||||||||
29803 | JR Z,29812 | Jump if not | ||||||||
29805 | LD HL,32680 | Set bit 5 at 32680: light bulb icon | ||||||||
29808 | SET 5,(HL) | |||||||||
29810 | LD H,230 | 230=Sam | ||||||||
29812 | CALL 29854 | Is Sam standing next to a telephone? | ||||||||
29815 | JP Z,29680 | Update the icon panel now if not | ||||||||
Sam is standing next to a telephone. Before showing the telephone icon, we need to update the icon graphic depending on whether the phone is ringing.
|
||||||||||
29818 | LD HL,32680 | Set bit 4 at 32680: telephone icon | ||||||||
29821 | SET 4,(HL) | |||||||||
29823 | JR C,29841 | Jump if the telephone is not ringing | ||||||||
29825 | LD A,(23672) | Collect the value of the system variable FRAMES, which is incremented every 20ms | ||||||||
29828 | BIT 5,A | Bit 5 of FRAMES alternates every 0.64s | ||||||||
29830 | JR Z,29841 | Jump if it's zero now | ||||||||
29832 | LD A,(20654) | This is the display file address for the byte in the top-left corner of the telephone icon | ||||||||
29835 | DEC A | Is the telephone icon in the ringing phase at the moment? | ||||||||
29836 | CALL Z,28660 | If not, make it so | ||||||||
29839 | JR 29848 | |||||||||
29841 | LD A,(20654) | This is the display file address for the byte in the top-left corner of the telephone icon | ||||||||
29844 | DEC A | Is the telephone icon in the ringing phase at the moment? | ||||||||
29845 | CALL NZ,28666 | If so, make it appear still (as when between rings) | ||||||||
29848 | JP 29680 | Update the icon panel |
Prev: 29731 | Up: Map |