Prev: C01A Up: Map Next: C033
C026: Take a voice's next note
Used by the routine at TUNE_PLAY_NOTE.
A voice's first word is the address of the note last played, and the byte after it is the next. $40 marks a voice's end; the voice then carries on from the address in its second word (TUNE_RESTART_VOICE), which for both voices is their last note, a rest, so the tune plays once and then rests for ever.
Input
HL A voice's two words (at offset 3 or 7 of VOICE_ONE_NOTE)
Output
A The note
TUNE_NEXT_NOTE C026 LD E,(HL) DE: the address after the note last played.
C027 INC HL
C028 LD D,(HL)
C029 INC DE
This entry point is used by the routine at TUNE_RESTART_VOICE.
TUNE_NEXT_NOTE_0 C02A LD A,(DE) The voice's end?
C02B CP $40
C02D JR Z,TUNE_RESTART_VOICE
C02F LD (HL),D No: DE is the voice's place now.
C030 DEC HL
C031 LD (HL),E
C032 RET
Prev: C01A Up: Map Next: C033