Prev: CA64 Up: Map Next: CAA3
CA7C: Sound: "180"
Used by the routine at Handler_Bust.
Plays 1-bit PCM speech for the "ONE HUNDRED AND EIGHTY!" announcement.
Sound_180Speech CA7C LD HL,$D500 Set a pointer to the speech data in HL to Data_Speech.
CA7F LD DE,$0800 Set the data length counter in DE to 0800 bytes.
SpeechProcessByte CA82 LD B,$08 Set a counter in B for 08 bits per byte.
SpeechProcessBit CA84 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.
CA86 LD A,%00010000 Set the speaker bit to ON.
CA88 JR C,SpeechOutputSample Jump to SpeechOutputSample if the carry bit is set.
CA8A XOR A Set the speaker bit to OFF.
Output the sample.
SpeechOutputSample CA8B OUT ($FE),A Send A to the speaker.
Introduce a tiny delay.
CA8D LD C,$12 Set a delay counter in C.
SpeechDelay_Loop CA8F DEC C Decrease the delay counter by one.
CA90 JR NZ,SpeechDelay_Loop Jump to SpeechDelay_Loop until the delay counter is zero.
CA92 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.
CA94 INC HL Move to the next byte of speech data.
CA95 DEC DE Decrease the data length counter by one.
CA96 LD A,D Jump to SpeechProcessByte until all the bytes have been processed.
CA97 OR E
CA98 JR NZ,SpeechProcessByte
All done, re-enable the interrupts and return.
CA9A EI Enable interrupts.
CA9B RET Return.
Minor timing tweaks (probably).
SpeechWasteCycles CA9C NOP No operation.
CA9D NOP
CA9E NOP
CA9F NOP
CAA0 NOP
CAA1 JR SpeechProcessBit Jump to SpeechProcessBit.
Prev: CA64 Up: Map Next: CAA3