40 lines
No EOL
839 B
NASM
40 lines
No EOL
839 B
NASM
reset_music:
|
|
mov word [music_index], 0
|
|
mov byte [music_counter], 0
|
|
ret
|
|
|
|
tick_music:
|
|
cmp byte [music_counter], 0
|
|
jne .still_note_remaining
|
|
call sound_off
|
|
mov si, [music_index]
|
|
add si, music_data
|
|
lodsb
|
|
cmp al, 0xff
|
|
je .silence
|
|
call set_note
|
|
call sound_on
|
|
.silence:
|
|
lodsb
|
|
mov [music_counter], al
|
|
add word [music_index], 2
|
|
cmp word [music_index], music_data.end - music_data
|
|
jb .still_data_remaining
|
|
mov word [music_index], 0
|
|
.still_data_remaining:
|
|
.still_note_remaining:
|
|
dec byte [music_counter]
|
|
|
|
ret
|
|
|
|
section data
|
|
music_data:
|
|
db 6,4, 7,4, 6,4, 7,4, 6,4, 7,4, 0xff,12
|
|
db 6,4, 11,4, 0xff,2, 11,4, 7,4, 11,4, 0xff,2, 8,4, 0xff,20
|
|
db 8,4, 5,4, 6,4, 5,4, 0xff,16, 6,8, 5,8, 0xff,24, 6,4, 5,4, 6,4, 5,4, 3,8, 0xff,16
|
|
db 1,8, 3,8, 5,8, 0xff,20
|
|
.end:
|
|
|
|
music_index dw 0
|
|
music_counter db 0
|
|
section code |