| Routines

29668: Show or hide the fuse, door, light bulb or phone in the icon panel (1)

Used by the routines at 30989 and 61568. Shows or hides the fuse, door, light bulb or phone in the icon panel depending on Sam's current location and activity.
29668 | LD HL,58880 | Point HL at byte 0 of Sam's buffer
29671 | BIT 0,(HL) | Is Sam midstride?
29673 | RET NZ | Return if so
29674 | LD A,(32764) | Collect Sam's status flags from 32764
29677 | AND A | Is Sam engaged in an action at the moment?
29678 | JR Z,29706 | Jump if not
This entry point is used by the routine at 29733. Now that the relevant bits at 32680 have been set or reset, it's time to show or hide the fuse, door, light bulb or phone in the icon panel.
29680 | LD B,4 | There are four icons to show or hide
29682 | LD A,(32680) | Collect the icon panel status flags from 32680
29685 | LD E,166 | E will hold the LSB of the attribute file address for the icon; initialise it to 166
29687 | INC E | Set E to the LSB of the attribute file address for the next icon in the panel
29688 | INC E
29689 | ADD A,A | Set the carry flag if this icon should be shown
29690 | PUSH AF | Save the icon status flags
29691 | PUSH DE | Save the LSB of the attribute file address
29692 | CALL C,28703 | Reveal the icon if necessary
29695 | CALL NC,28707 | Or hide it if necessary
29698 | POP DE | Restore the LSB of the attribute file address to E
29699 | POP AF | Restore the icon status flags to A
29700 | DJNZ 29687 | Jump back until the fuse, door, light bulb and phone icons have been revealed or hidden
29702 | LD (32680),A | Clear all the icon panel status flags at 32680
29705 | RET |
Sam is not engaged in any action at the moment (no status flags at 32764 are set).
29706 | LD A,(32747) | Collect the police flags from 32747
29709 | RLCA | Is Sam in jail?
29710 | JR C,29757 | Jump if so
29712 | LD L,2 | Point HL at byte 2 of Sam's buffer
29714 | JR 29733 | Check whether Sam is standing next to a fuse, door, light switch or telephone, and return here to update the icon panel as appropriate