Prev: 27022 Up: Map Next: 27159
27044: Ring the bell if necessary
Called from the main loop at 25129.
27044 LD HL,(31940) Pick up the bell's location in the current maze.
27047 LD A,H Has Horace already sounded the alarm?
27048 OR L
27049 JR NZ,27088 Jump if not.
Horace has already sounded the alarm. Produce an appropriate delay in place of the bell sound.
27051 LD A,(31842) Pick up the game speed parameter in A.
27054 LD E,A HL=350+30*A.
27055 LD HL,350
27058 LD BC,30
27061 ADD HL,BC
27062 DEC E
27063 JR NZ,27058
27065 XOR A Clear A for no apparent reason.
27066 LD A,(27402) Pick up the active guard counter (0-3) in A.
27069 RLA Subtract 128*A from HL.
27070 RLA
27071 RLA
27072 RLA
27073 RLA
27074 RLA
27075 LD B,0
27077 LD C,A
27078 SBC HL,BC
27080 SBC HL,BC
27082 PUSH HL Copy HL to BC.
27083 POP BC
27084 CALL 27404 Wait for 26*BC+5 T states.
27087 RET
Horace has not sounded the alarm yet. Produce an appropriate bell sound if necessary.
27088 LD A,(31942) Pick up the bell animation frame counter.
27091 AND 63 Keep only bits 0-5.
27093 CP 0 Is the frame counter a multiple of 64 at the moment? (This instruction is redundant.)
27095 JR NZ,27126 Jump if not.
27097 LD HL,31849 Pick up the sound on/off indicator in A.
27100 LD A,(HL)
27101 CP 31 Is the sound on?
27103 JR NZ,27051 Jump if not.
27105 LD DE,22 Call the ROM to make a short sound effect.
27108 LD HL,403
27111 CALL 949
27114 DI Disable interrupts after the ROM call.
27115 LD DE,26 Call the ROM again to make another short sound effect.
27118 LD HL,360
27121 CALL 949
27124 DI Disable interrupts after the ROM call.
27125 RET
27126 CP 32 Is the bell animation frame counter a multiple of 32 at the moment?
27128 JR NZ,27051 Jump if not.
27130 LD HL,31849 Pick up the sound on/off indicator in A.
27133 LD A,(HL)
27134 CP 31 Is the sound on?
27136 JR NZ,27051 Jump if not.
27138 LD DE,26 Call the ROM to make a short sound effect.
27141 LD HL,360
27144 CALL 949
27147 DI Disable interrupts after the ROM call.
27148 LD DE,22 Call the ROM again to make another short sound effect.
27151 LD HL,403
27154 CALL 949
27157 DI Disable interrupts after the ROM call.
27158 RET
Prev: 27022 Up: Map Next: 27159