Hello i'm writing a game for school project and i'm having problems to play an audio file. I was able to play the file but the problem is that then the program freezes and stop responding to the user
The music file code
proc read Near ; Read next sample
push bx
push cx
push dx
mov ah, 3Fh
mov bx, [filehandle]
mov cx, 1
lea dx, [Buffer]
int 21h
jc errorcode
mov al, [Buffer]
xor ah, ah
mov bx, 54
mul bx
; mov ax, dx ; Result is in DX because we need to div by 65536 which is all of AX
shr ax, 8
pop dx
pop cx
pop bx
ret
endp
proc br Near; Print line break
push dx
push ax
mov dl, 10
mov ah, 2
int 21h
mov dl, 13
mov ah, 2
int 21h
pop ax
pop dx
ret
endp
proc PlayMusic Near
mov ah, 3Dh
xor al, al
lea dx, [filename]
int 21h
mov [filehandle], ax
call br
mov al, 90h
out 43h, al
in al, 61h
or al, 3
out 61h, al
cli
mov ax, 0
totalloop:
call read ; Read file
out 42h, al ; Send data
mov bx, ax
mov cx, [delay]
portloop:
loop portloop
mov ax, bx
out 42h, ax ; Send data
mov cx, [delay]
rloop:
loop rloop
call read
jmp totalloop
ret
errorcode:
; Close
sti
mov al, 86h
out 43h, al
mov ah, 3Eh
mov bx, [filehandle]
int 21h
pop dx
pop cx
pop bx
ret
endp PlayMusic
and after i call this proc i'm calling int 16h to read a key from the user but the music file blocks the IO someone have an idea what I need to do? sorry for my bad English by the way and i'm kind of new in assembly so i'm not so good