Routines
 Prev: 7423 Up: Map Next: 749B
7425: Show or hide the fuse, door, light bulb or phone in the icon panel (2)
Continues from the routine at 73E4. Checks whether Sam is standing next to a fuse, door, light switch or telephone, and updates the icon panel as appropriate.
Input
HL E602 (byte 0x02 of Sam's buffer)
7425 LD A,(HL) A=Sam's y-coordinate
7426 LD DE,\$73CF Point DE at the list of x-coordinates of the house doors (at 73CF)
7429 CP \$1F 31 is the y-coordinate of the house doors
742B JR Z,\$7433 Jump if Sam's y-coordinate is 31
742D CP \$21 33 is the y-coordinate of the shop doors
742F JR NZ,\$7445 Jump unless Sam's y-coordinate is 33
7431 LD E,\$DC DE=73DC (list of x-coordinates of shop doors)
7433 DEC L L=0x01
7434 LD A,(DE) A=x-coordinate of a door (or 0xFF)
7435 INC E Point DE at the next x-coordinate in the list
7436 INC A Have we reached the end of the list?
7437 JR Z,\$7445 Jump if so (Sam's not standing next to a door)
7439 DEC A A=x-coordinate of the door
743A CP (HL) Is Sam's x-coordinate the same?
743B JR NZ,\$7434 Jump back if not to check the next door
This entry point is used by the routine at 73E4.
743D LD A,(\$7FA8) Set bit 6 at 7FA8: door icon
7440 SET 6,A
7442 LD (\$7FA8),A
7445 LD L,\$04 Point HL at byte 0x04 of Sam's buffer
7447 BIT 0,(HL) Is Sam indoors?
7449 JP Z,\$73F0 Update the icon panel now if not
744C LD L,\$02 A=Sam's y-coordinate
744E LD A,(HL)
744F CP \$21 Is Sam inside a shop?
7451 JR Z,\$7468 Jump if so
7453 SUB \$06 Keep subtracting 6 (the height of a floor) from Sam's y-coordinate until it's negative
7455 JR NC,\$7453
7457 CP \$FB Is Sam's y-coordinate 1, 7, 13, 19, 25 or 31?
7459 JP NZ,\$73F0 Update the icon panel now if not (Sam's on a staircase)
745C CALL \$75A4 Is Sam standing next to a fuse that has not been blown yet?
745F JR NZ,\$7468 Jump if not
7461 LD HL,\$7FA8 Set bit 7 at 7FA8: fuse icon
7464 SET 7,(HL)
7466 LD H,\$E6 0xE6=Sam
7468 CALL \$F436 Is Sam standing next to a light switch?
746B JR Z,\$7474 Jump if not
746D LD HL,\$7FA8 Set bit 5 at 7FA8: light bulb icon
7470 SET 5,(HL)
7472 LD H,\$E6 0xE6=Sam
7474 CALL \$749E Is Sam standing next to a telephone?
7477 JP Z,\$73F0 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.
747A LD HL,\$7FA8 Set bit 4 at 7FA8: telephone icon
747D SET 4,(HL)
747F JR C,\$7491 Jump if the telephone is not ringing
7481 LD A,(\$5C78) Collect the value of the system variable FRAMES, which is incremented every 20ms
7484 BIT 5,A Bit 5 of FRAMES alternates every 0.64s
7486 JR Z,\$7491 Jump if it's zero now
7488 LD A,(\$50AE) This is the display file address for the byte in the top-left corner of the telephone icon
748B DEC A Is the telephone icon in the ringing phase at the moment?
748C CALL Z,\$6FF4 If not, make it so
748F JR \$7498
7491 LD A,(\$50AE) This is the display file address for the byte in the top-left corner of the telephone icon
7494 DEC A Is the telephone icon in the ringing phase at the moment?
7495 CALL NZ,\$6FFA If so, make it appear still (as when between rings)
7498 JP \$73F0 Update the icon panel
 Prev: 7423 Up: Map Next: 749B