Prev: EE5E Up: Map Next: EE9E
EE6E: Setup the next music pattern
Used by the routine at play_music_48k.
Decrements the repeat count held in the operand at next_pattern and returns while repeats remain. On zero it falls into np_next, which reads the next (repetitions, data offset) pair from the pattern list, self-modifies the repeat count and the pattern pointer, and points playback at the music data that starts at music_data. A repeat count of $FF ends the list: np_restart follows the address word stored after it and starts over.
Keep playing current pattern until this counter becomes zero.
next_pattern EE6E LD A,$00 Load number of pattern repetitions. Self modified by EE7E, and below.
EE70 DEC A Decrease
EE71 LD ($EE6F),A Self modify next_pattern above
EE74 RET NZ Return if non-zero
np_next EE75 LD HL,$0000 Load address of current pattern. Self modified by EE83.
This entry point is used by the routine at reset_music.
next_pattern_at_addr EE78 LD A,(HL) Read new repetition count
EE79 INC HL
EE7A CP $FF Jump to np_restart if it's $FF (end of patterns)
EE7C JR Z,np_restart
EE7E LD ($EE6F),A Self modify next_pattern above with new repetition count
EE81 LD C,(HL) Read music data offset
EE82 INC HL
EE83 LD ($EE76),HL Self modify np_next above (pattern addr)
Calculate address of music data.
EE86 LD B,$00 BC = C
EE88 LD HL,$F111 Load address of base of music data
EE8B ADD HL,BC Combine with offset
EE8C LD A,(HL) A = *HL++ -- load first byte of music data
EE8D INC HL
EE8E LD ($EEBA),A Self modify pm_delay_complete (first byte of pattern)
EE91 LD ($EEAE),A Self modify pm_delay_1 (first byte of pattern)
EE94 LD ($EECA),HL Self modify pm_reset_pattern (addr of second music data byte in pattern)
EE97 RET Return
np_restart EE98 LD A,(HL) HL = wordat(HL); HL++
EE99 INC HL
EE9A LD H,(HL)
EE9B LD L,A
EE9C JR next_pattern_at_addr Jump to next_pattern_at_addr
Prev: EE5E Up: Map Next: EE9E