kl_new_frame_fly equ &bcd7
mc_sound_register equ &bd34
kl_del_frame_fly equ &bcdd
org 8000h
jp play_music
jp stop_music
play_music:
xor a
ld (counter),a
ld (count_active),a
ld hl,ff_event_block
ld b,&81
ld c,0
ld de,ff_event_routine
call kl_new_frame_fly
ret
stop_music:
ld hl,ff_event_block
call kl_del_frame_fly
ret
ff_event_block:
defs 10
ff_event_routine:
ld a,(count_active)
or a
jr z,packet_begin
ld a,(counter)
dec a
ld (counter),a
or a
ret nz
xor a
ld (count_active),a
ld hl,(pos)
jr cont_from_counter
packet_begin:
ld hl,(pos)
packet_cont:
ld a,(hl)
or a
jr nz,counter_set
cont_from_counter:
inc hl
ld a,(hl)
cp 0ffh
jr z,music_end
cp 0feh
jr z,skip
ld a,(hl)
inc hl
ld c,(hl)
inc hl
call mc_sound_register
jr packet_cont
counter_set:
ld (pos),hl
ld (counter),a
ld (count_active),a
ret
skip:
inc hl
inc hl
ld (pos),hl
ret
music_end:
ld hl,notas
ld (pos),hl
jr packet_cont
count_active: defb 0
counter: defb 0
pos: dw notas
notas:
db 000h, 007h, 038h, 000h, 008h, 000h, 000h, 009h, 000h
db 000h, 010h, 000h, 000h, 000h, 0fch, 000h, 001h, 000h
db 000h, 008h, 00fh, 019h, 000h, 07eh, 000h, 002h, 0fch
db 000h, 003h, 000h, 00dh, 000h, 0a8h, 000h, 002h, 07eh
db 000h, 004h, 0fch, 000h, 005h, 000h, 019h, 000h, 0fch
db 000h, 002h, 0a8h, 000h, 004h, 07eh, 019h, 000h, 08dh
db 000h, 002h, 0fch, 000h, 004h, 0a8h, 019h, 000h, 0fch
db 000h, 002h, 08dh, 000h, 004h, 0fch, 00dh, 000h, 0bdh
db 000h, 002h, 0fch, 000h, 004h, 08dh, 019h, 002h, 0bdh
db 000h, 004h, 0fch, 019h, 000h, 08dh, 000h, 002h, 0a8h
db 000h, 009h, 00fh, 000h, 004h, 0bdh, 019h, 000h, 0fch
db 000h, 002h, 08dh, 000h, 009h, 000h, 000h, 004h, 0a8h
db 00dh, 002h, 0fch, 000h, 004h, 08dh, 00dh, 000h, 07eh
db 000h, 002h, 0a8h, 000h, 009h, 00fh, 000h, 004h, 0fch
db 00dh, 008h, 000h, 000h, 009h, 000h, 00dh, 008h, 00fh
db 000h, 009h, 00fh, 000h, 004h, 07eh, 019h, 000h, 0fch
db 000h, 002h, 07eh, 000h, 009h, 000h, 000h, 004h, 0a8h
db 00dh, 000h, 08dh, 000h, 002h, 0a8h, 000h, 009h, 00fh
db 000h, 004h, 0fch, 00dh, 008h, 000h, 000h, 009h, 000h
db 00dh, 008h, 00fh, 000h, 002h, 0bdh, 000h, 009h, 00fh
db 000h, 004h, 08dh, 00dh, 008h, 000h, 000h, 009h, 000h
db 00dh, 000h, 096h, 000h, 008h, 00fh, 000h, 009h, 00fh
db 00dh, 008h, 000h, 000h, 009h, 000h, 00dh, 000h, 0fch
db 000h, 008h, 00fh, 000h, 002h, 096h, 000h, 004h, 0bdh
db 00dh, 000h, 0a8h, 000h, 001h, 001h, 000h, 002h, 0fch
db 000h, 004h, 096h, 003h, 002h, 0a8h, 000h, 003h, 001h
db 000h, 004h, 0fch, 003h, 004h, 0a8h, 000h, 005h, 001h
db 013h, 000h, 0f8h, 00dh, 000h, 0fch, 000h, 001h, 000h
db 000h, 002h, 050h, 000h, 009h, 00fh, 000h, 004h, 0f8h
db 00dh, 008h, 000h, 000h, 009h, 000h, 00dh, 008h, 00fh
db 000h, 009h, 00fh, 000h, 004h, 0fch, 000h, 005h, 000h
db 00dh, 008h, 000h, 000h, 009h, 000h, 026h, 000h, 0a8h
db 000h, 008h, 00fh, 000h, 002h, 0d4h, 000h, 003h, 000h
db 000h, 009h, 00fh, 000h, 004h, 01bh, 000h, 005h, 001h
db 000h, 00ah, 00fh, 019h, 004h, 0fch, 000h, 005h, 000h
db 00dh, 004h, 01bh, 000h, 005h, 001h, 00dh, 004h, 0fch
db 000h, 005h, 000h, 00dh, 004h, 01bh, 000h, 005h, 001h
db 026h, 000h, 096h, 000h, 002h, 0bdh, 000h, 004h, 0a8h
db 00dh, 000h, 0f8h, 000h, 001h, 001h, 000h, 002h, 096h
db 000h, 009h, 000h, 000h, 004h, 0bdh, 000h, 005h, 000h
db 000h, 00ah, 000h, 00dh, 000h, 096h, 000h, 001h, 000h
db 000h, 002h, 0bdh, 000h, 009h, 00fh, 000h, 004h, 0fch
db 000h, 00ah, 00fh, 00dh, 004h, 096h, 000h, 00ah, 000h
db 00dh, 004h, 0fch, 000h, 00ah, 00fh, 00dh, 004h, 096h
db 000h, 00ah, 000h, 019h, 000h, 0a8h, 000h, 002h, 0d4h
db 002h, 004h, 0a8h, 00bh, 000h, 0fch, 000h, 002h, 0a8h
db 000h, 009h, 000h, 000h, 004h, 0d4h, 003h, 002h, 0fch
db 000h, 004h, 0a8h, 003h, 004h, 0fch, 006h, 002h, 0f8h
db 000h, 003h, 001h, 000h, 009h, 00fh, 00dh, 002h, 0fch
db 000h, 003h, 000h, 000h, 004h, 050h, 000h, 005h, 001h
db 000h, 00ah, 00fh, 00dh, 009h, 000h, 000h, 004h, 0fch
db 000h, 005h, 000h, 000h, 00ah, 000h, 00dh, 009h, 00fh
db 000h, 004h, 050h, 000h, 005h, 001h, 000h, 00ah, 00fh
db 00dh, 009h, 000h, 000h, 004h, 0fch, 000h, 005h, 000h
db 000h, 00ah, 000h, 00dh, 002h, 0f8h, 000h, 003h, 001h
db 000h, 009h, 00fh, 00dh, 002h, 0a8h, 019h, 008h, 000h
db 000h, 009h, 000h, 000h, 0ffh, 000h