First post, by Nabsterikz
Hi, i'm trying programing DSP for Auto-Init record with DMA, but i have a trouble, don't know because of my hands or dosbox:). Procs:
setupdma08 proc near
push ax
mov al,00000101b;mask 1 dma channel
out 0Ah,al
mov al,01010101b;dma-mode single transfer, addr increasing, auto-init, device2mem, 1 channel
out 0Bh,al
xor al,al
out 0Ch,al;switch to Lo-Hi
push cs
pop ax
mov bx,10h
mul bx
add ax,offset sbuf08
push ax
adc dl,00h
mov al,dl
out 83h,al;page, first 4bit in 24bit addr
pop ax;offset
out 02h,al
mov al,ah
out 02h,al
mov ax,537Ch;size
dec ax
out 03h,al
mov al,ah
out 03h,al
mov al,00000001b;unmask
out 0Ah,al
pop ax
setupdma08 endp
setupdsp08 proc near
push ax
mov ah,00CEh;dsp cmd Cxh,6-playback,E-recording
call dspcmd
xor ah,ah
call dspcmd;unsigned,mono
mov ax,29BEh;size
dec ax
xchg ah,al
call dspcmd
mov ah,al
call dspcmd
pop ax
ret
setupdsp08 endp
dspinit proc near
push dx ax cx
mov dx,226h;reset
mov al,01h
out dx,al
mov cx,99h;delay
waitffin:
xor al,al
loop waitffin
out dx,al
call dspreadata
mov ah,09h
cmp al,00AAh
je dspinited
mov dx,offset mninited
int 21h
jmp dspinitext
dspinited:
mov dx,offset minited
int 21h
mov ah,41h;frequency for output
call dspcmd
mov ah,1Fh
call dspcmd
mov ah,40h
call dspcmd
mov ah,42h;frequency for input
call dspcmd
mov ah,1Fh;hi
call dspcmd
mov ah,40h;lo
call dspcmd
dspinitext:
pop cx ax dx
ret
dspinit endp
dspcmd proc near
push dx ax
waitfacmd:
mov dx,022Ch
in al,dx
and al,10000000b
jnz waitfacmd
mov al,ah
out dx,al
pop ax dx
ret
dspcmd endp
dspreadata proc near
push dx
mov dx,022Eh
waitfrdata:
in al,dx
and al,10000000b
jz waitfrdata
mov dx,022Ah
in al,dx
pop dx
ret
dspreadata endp
I am coding chat,like skype under dos, and at the same time, program must record and playback data, so i am using 8bit for playback and 16bit for record(on higth sample,8bit-record). When i wrote 16bit recording, i heard a noise, then i corrected 8bit to recoding, and load wav-file to buffer, and i heard this music. I try to change dma mode,etc..But same thing, every time it's playback. I compared with another program, they are same.