Prev: 31986 Up: Map Next: 32034
31987: Sound burbler
Loop over a sequence of pitch/length pairs, calling the beeper with each. The data sequence is at the caller location, so this picks it up from the return address.
This contains the rolling border effect which accompanies the end of game siren, etc.
It walks the sequence and stops when DE is pointing to a zero byte. It returns to that location+1
sound_burbler 31987 LD (_BURBLER_DE_STASH),DE Save DE somewhere
31991 POP DE DE takes return address from the stack
31992 PUSH BC Save
31993 PUSH AF Save
31994 PUSH HL Save
31995 LD A,(_PORT254_SHADOW) Pick up port 254 shadow
31998 AND 56 Bottom 3 bits zero
32000 RRCA Rotate down 3 bits, sets the border colour
32001 RRCA
32002 RRCA
32003 OR 8 Set the MIC bit
32005 LD (_BURBLER_PORT254_SHADOW),A Save result, it's picked up by the beeper routine
sound_burbler_0 32008 LD A,(DE) DE was pointing to something interesting
32009 INC DE Next byte, whatever it is
32010 OR A If it's zero we're done and DE is pointing to the location to return to
32011 JR Z,sound_burbler_2
32013 LD L,A Low byte from (DE) into L, it's a count of something
32014 LD A,(DE) High byte from (DE) into A, it's the pitch
32015 INC DE Move on ready for next one
32016 LD C,A Pitch goes into C
sound_burbler_1 32017 CALL click_speaker Toggle beeper bit according to pitch
32020 DEC L Reduce the counter and do it again
32021 JR NZ,sound_burbler_1
32023 JR sound_burbler_0 Next note, or whatever it is
sound_burbler_2 32025 POP HL Restore
32026 POP AF Restore
32027 POP BC Restore
32028 PUSH DE Restore return address
32029 LD DE,(_BURBLER_DE_STASH) Put DE back as it was at entry
32033 RET
Prev: 31986 Up: Map Next: 32034