Prev: F251 Up: Map Next: F29D
F269: Play the siren sound effect (128K)
If the siren is enabled this produces an alternating rising and falling siren sound effect. AY channels A and B are used.
Lives at $805D when relocated.
play_siren_sfx_128k F269 LD A,($A239) Return if siren disabled
F26C AND A
F26D RET Z
F26E LD A,($A213) Load channel A fine pitch
F271 LD B,$AA Load 50-50 alternating pattern (self modified @ F260 above)
F273 RLC B Jump to increasing case if top bit was set
F275 JR C,pss_increasing
Decreasing case.
pss_decreasing F277 SUB $03 Decrease fine pitch by 3
F279 CP $5A Jump to set registers if new fine pitch >= 90
F27B JR NC,pss_set_regs
F27D JR pss_change Otherwise went too far: jump to pss_change
Increasing case.
pss_increasing F27F ADD A,$03 Increase fine pitch by 3
F281 CP $8C Jump to set registers if new fine pitch < 140
F283 JR C,pss_set_regs
Arrive here if new fine pitch is outside of 90..139.
pss_change F285 EX AF,AF' Preserve new fine pitch
F286 LD A,B Store rotating pattern (self modifying F271 above)
F287 LD ($8066),A
F28A EX AF,AF' Restore new fine pitch
Arrive here if new fine pitch is 90..139.
pss_set_regs F28B LD ($A213),A Update channel A fine pitch
F28E SUB $04 and store 4 less to channel B fine pitch (~23Hz higher than A)
F290 LD ($A215),A
F293 LD A,($A21A) Set mixer to enable tone A & B
F296 AND $3C
F298 LD ($A21A),A
F29B JR write_audio_registers_128k Exit via write_audio_registers_128k
Prev: F251 Up: Map Next: F29D