2014-11-29 23:18:40 +00:00
|
|
|
; Loads a song in .M format ([func] = SND_LOAD_SONG) or a sound effect bank in
|
|
|
|
; .EFC format ([func] = SND_LOAD_SE) into the respective work buffer of the
|
|
|
|
; sound driver. If MIDI is used, 'md' is appended to the file name.
|
|
|
|
|
2015-02-23 10:47:22 +00:00
|
|
|
; void DEFCONV snd_load(const char *fn, int func)
|
|
|
|
proc_defconv snd_load
|
2014-11-29 23:18:40 +00:00
|
|
|
@@fn = DPTR_ (cPtrSize + 2)
|
|
|
|
@@func = word ptr (cPtrSize + 2 + dPtrSize)
|
|
|
|
|
|
|
|
push bp
|
|
|
|
mov bp, sp
|
|
|
|
push si
|
|
|
|
push ds
|
|
|
|
mov cx, SND_LOAD_FN_LEN
|
|
|
|
xor si, si
|
|
|
|
|
|
|
|
@@memcpy:
|
|
|
|
les bx, [bp+@@fn]
|
|
|
|
add bx, si
|
|
|
|
mov al, es:[bx]
|
2015-02-23 10:47:22 +00:00
|
|
|
mov _snd_load_fn[si], al
|
2014-11-29 23:18:40 +00:00
|
|
|
inc si
|
|
|
|
loop @@memcpy
|
|
|
|
mov ax, [bp+@@func]
|
|
|
|
cmp ax, SND_LOAD_SONG
|
|
|
|
jnz short @@load
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp _snd_midi_active, 0
|
2014-11-29 23:18:40 +00:00
|
|
|
jz short @@load
|
|
|
|
xor bx, bx
|
|
|
|
|
|
|
|
@@strlen:
|
|
|
|
inc bx
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp _snd_load_fn[bx], 0
|
2014-11-29 23:18:40 +00:00
|
|
|
jnz short @@strlen
|
2015-02-23 10:47:22 +00:00
|
|
|
mov _snd_load_fn[bx], 'm'
|
|
|
|
mov (_snd_load_fn+1)[bx], 'd'
|
|
|
|
mov (_snd_load_fn+2)[bx], 0
|
2014-11-29 23:18:40 +00:00
|
|
|
|
|
|
|
@@load:
|
2015-02-23 10:47:22 +00:00
|
|
|
mov dx, offset _snd_load_fn
|
2014-11-29 23:18:40 +00:00
|
|
|
mov ax, 3D00h
|
|
|
|
int 21h
|
|
|
|
mov bx, ax
|
|
|
|
mov ax, [bp+@@func]
|
|
|
|
cmp ax, SND_LOAD_SONG
|
|
|
|
jnz short @@PMD
|
2015-02-23 10:47:22 +00:00
|
|
|
cmp _snd_midi_active, 0
|
2014-11-29 23:18:40 +00:00
|
|
|
jz short @@PMD
|
|
|
|
int 61h
|
|
|
|
jmp short @@read
|
|
|
|
|
|
|
|
@@PMD:
|
|
|
|
int 60h
|
|
|
|
|
|
|
|
@@read:
|
|
|
|
mov ax, 3F00h
|
|
|
|
mov cx, 5000h
|
|
|
|
int 21h
|
|
|
|
pop ds
|
|
|
|
mov ah, 3Eh
|
|
|
|
int 21h
|
|
|
|
pop si
|
|
|
|
pop bp
|
|
|
|
ret
|
2015-02-23 10:47:22 +00:00
|
|
|
endp_defconv
|