Prev: 51812 Up: Map Next: 51875
51836: Sound: "180"
Used by the routine at Handler_Bust.
Plays 1-bit PCM speech for the "ONE HUNDRED AND EIGHTY!" announcement.
Sound_180Speech 51836 LD HL,54528 Set a pointer to the speech data in HL to Data_Speech.
51839 LD DE,2048 Set the data length counter in DE to 2048 bytes.
SpeechProcessByte 51842 LD B,8 Set a counter in B for 8 bits per byte.
SpeechProcessBit 51844 RLC (HL) Rotate *HL left one position to set the next bit to the carry flag.
Set the speaker bit ON or OFF based on if the currently processed bit is set or not.
51846 LD A,%00010000 Set the speaker bit to ON.
51848 JR C,SpeechOutputSample Jump to SpeechOutputSample if the carry bit is set.
51850 XOR A Set the speaker bit to OFF.
Output the sample.
SpeechOutputSample 51851 OUT (254),A Send A to the speaker.
Introduce a tiny delay.
51853 LD C,18 Set a delay counter in C.
SpeechDelay_Loop 51855 DEC C Decrease the delay counter by one.
51856 JR NZ,SpeechDelay_Loop Jump to SpeechDelay_Loop until the delay counter is zero.
51858 DJNZ SpeechWasteCycles Decrease the bit counter by one and loop back to SpeechWasteCycles until all bits in the current byte have been processed.
Finished with this byte, move onto the next.
51860 INC HL Move to the next byte of speech data.
51861 DEC DE Decrease the data length counter by one.
51862 LD A,D Jump to SpeechProcessByte until all the bytes have been processed.
51863 OR E
51864 JR NZ,SpeechProcessByte
All done, re-enable the interrupts and return.
51866 EI Enable interrupts.
51867 RET Return.
Minor timing tweaks (probably).
SpeechWasteCycles 51868 NOP No operation.
51869 NOP
51870 NOP
51871 NOP
51872 NOP
51873 JR SpeechProcessBit Jump to SpeechProcessBit.
Prev: 51812 Up: Map Next: 51875