Prev: A095 Up: Map Next: A0C9
A09E: Ring bell
This rings the alarm bell. It is called three times from main_loop.
Used by the routine at main_loop.
ring_bell A09E LD HL,$A130 Point HL at bell ring counter/flag
A0A1 LD A,(HL) Fetch its value
A0A2 CP $FF If it's bell_STOP then return
A0A4 RET Z
A0A5 AND A If it's bell_RING_PERPETUAL then jump over the decrement code
A0A6 JR Z,ring_bell_0
Decrement the ring counter.
A0A8 DEC A Decrement and store
A0A9 LD (HL),A
A0AA JR NZ,ring_bell_0 If it didn't hit zero then jump over the stop code
Counter hit zero - stop ringing.
A0AC LD A,$FF Stop the bell
A0AE LD (HL),A
A0AF RET Return
Fetch visible state of bell from the screen.
ring_bell_0 A0B0 LD A,($518E) Fetch the bell ringing graphic from the screen
A0B3 CP $3F Is it $3F? (63)
A0B5 JP Z,ring_bell_2 If so, jump to plot "off" code
A0B8 JP ring_bell_1 Bug: Pointless jump to adjacent instruction
Plot UDG for the bell ringer "on" and make the bell sound
ring_bell_1 A0BB LD DE,$A153 Point DE at bell_ringer_bitmap_on
A0BE CALL plot_ringer Plot ringer
A0C1 LD BC,$2530 Play the "bell ringing" sound, exiting via it
A0C4 JR play_speaker
Plot UDG for the bell ringer "off".
ring_bell_2 A0C6 LD DE,$A147 Point DE at bell_ringer_bitmap_on
FALL THROUGH to plot_ringer.
Prev: A095 Up: Map Next: A0C9