Prev: F800 Up: Map Next: FAF9
FAC1: Play Next Level Jingle
Used by the routine at Print_HighScore.
PlaySound_NextLevelJingle FAC1 LD HL,$FAF9 Load HL with a pointer to Audio_NextLevelJingle.
This entry point is used by the routine at Handle_Level_Complete.
PlaySound FAC4 NOP No operation.
PlaySound_Loop FAC5 LD A,(HL) Fetch the music data from *HL.
FAC6 CP $FF Return if this is the terminator (FF).
FAC8 RET Z
FAC9 OR A Jump to PlaySound_Rest if this is a rest.
FACA JR Z,PlaySound_Rest
FACC XOR A Set the speaker port to off.
FACD OUT ($FE),A
FACF LD E,(HL) Load the pitch period into both E (reset value) and D (countdown).
FAD0 LD D,E
FAD1 INC HL Load the note duration into C.
FAD2 LD C,(HL)
PlaySound_NoteLoop FAD3 OUT ($FE),A Send to the speaker to play the note.
FAD5 DEC D Decrease the period counter by one.
FAD6 JR NZ,PlaySound_NoteInnerLoop Jump to PlaySound_NoteInnerLoop if the period hasn't elapsed yet.
FAD8 LD D,E Reset the period counter from E.
FAD9 XOR %00011000 Toggle the speaker and MIC outputs.
PlaySound_NoteInnerLoop FADB DJNZ PlaySound_NoteLoop Decrease counter by one and loop back to PlaySound_NoteLoop until counter is zero.
FADD DEC C Decrease the duration counter.
FADE JR NZ,PlaySound_NoteLoop Jump back to PlaySound_NoteLoop until the full duration has elapsed.
FAE0 INC HL Advance to the next sound data entry.
FAE1 LD A,$BF Read from the keyboard;
Port Number Bit
0 1 2 3 4
BF ENTER L K J H
FAE3 IN A,($FE)
FAE5 AND %00000001 Return if "ENTER" has been pressed.
FAE7 RET Z
FAE8 JR PlaySound_Loop Jump back to PlaySound_Loop.
PlaySound_Rest FAEA INC HL Increment HL by one.
FAEB LD C,(HL) C=*HL.
PlaySound_RestOuterLoop FAEC NOP No operation.
PlaySound_RestInnerLoop FAED NOP No operation.
FAEE NOP No operation.
FAEF NOP No operation.
FAF0 NOP No operation.
FAF1 DJNZ PlaySound_RestInnerLoop Decrease the counter by one and loop back to PlaySound_RestInnerLoop until counter is zero.
FAF3 DEC C Decrease the rest duration counter.
FAF4 JR NZ,PlaySound_RestOuterLoop Jump back to PlaySound_RestOuterLoop until the full rest duration has elapsed.
FAF6 INC HL Advance to the next sound data entry.
FAF7 JR PlaySound_Loop Jump back to PlaySound_Loop.
Prev: F800 Up: Map Next: FAF9