data equ 378h
status equ 379h
command equ 37Ah
org 100h
;turn on sound source
mov dx, command
mov al, 4h
out dx, al
;try to overflow the FIFO
mov cx, 32
sendloop:
;send some dummy bytes
mov dx, data
mov al, 80h
out dx, al
mov dx, command
mov al, 0Ch
out dx, al
nop
nop
nop
nop
mov al, 4h
out dx, al
loop sendloop
mov dx, status
in al, dx
test al, 40h
jnz found
;code reaches this if there is no sound source
mov si, offset strnotfound
call print
mov dx, command
mov al, 0Ch
out dx, al
ret
;code reaches this is sound source is found
found:
mov si, offset strfound
call print
mov dx, command
mov al, 0Ch
out dx, al
ret
print:
pushf
cld
printnext:
lodsb
cmp al, 0
jz printdone
mov ah, 0Eh
int 10h
jmp print
printdone:
popf
ret
strfound db 'Sound Source found', 13, 10, 0
strnotfound db 'Sound Source not found', 13, 10, 0