VOGONS


First post, by Lassar

User metadata
Rank Newbie
Rank
Newbie

😲 Yes I posted the same post on VdmSound !
Are VdmSound and DosBox sound routines related !?

I have been testing DmaPlay by Mike Huff.

I was storing sounds in strings and testing it out.

This is what I found. DosBos only works with some Segments and offsets.

Other Segments and Offsets It will get messed up and try to play a
sound from the wrong memory location !

Here is the QuickBasic Routine with Comments added in.

SUB DMAPlay (Segment&, Offset&, Length&, Freq&)
' Transfers and plays the contents of the buffer.
Length& = Length& - 1
Page% = 0
MemLoc& = Segment& * 16 + Offset&
SELECT CASE Channel%
CASE 0
PgPort% = &H87
AddPort% = &H0
LenPort% = &H1
ModeReg% = &H48
CASE 1
PgPort% = &H83
AddPort% = &H2
LenPort% = &H3
ModeReg% = &H49
CASE 2
PgPort% = &H81
AddPort% = &H4
LenPort% = &H5
ModeReg% = &H4A
CASE 3
PgPort% = &H82
AddPort% = &H6
LenPort% = &H7
ModeReg% = &H4B
CASE ELSE
PRINT "DMA channels 0-3 only are supported."
EXIT SUB
END SELECT

OUT &HA, &H4 + Channel%
OUT &HC, &H0
OUT &HB, ModeReg%

'**************************************************
' Apparently the VdmSound error has to do with getting the correct
'segment and offset adress from the ports

OUT AddPort%, MemLoc& AND &HFF
OUT AddPort%, (MemLoc& AND &HFFFF&) \ &H100
IF (MemLoc& AND 65536) THEN Page% = Page% + 1
IF (MemLoc& AND 131072) THEN Page% = Page% + 2
IF (MemLoc& AND 262144) THEN Page% = Page% + 4
IF (MemLoc& AND 524288) THEN Page% = Page% + 8
OUT PgPort%, Page%

'VmdSound Must have a problem with addport or PagePort%
' This Looks like a real bad bug.
' How did it get thru ?

'************************************************

OUT LenPort%, Length& AND &HFF
OUT LenPort%, (Length& AND &HFFFF&) \ &H100
OUT &HA, Channel%

IF Freq& < 23000 THEN
TimeConst% = 256 - 1000000 \ Freq&
WriteDSP &H40
WriteDSP TimeConst%
WriteDSP &H14
WriteDSP (Length& AND &HFF)
WriteDSP ((Length& AND &HFFFF&) \ &H100)
ELSE
IF DSPVersion! >= 3 THEN
TimeConst% = ((65536 - 256000000 \ Freq&) AND &HFFFF&) \ &H100
WriteDSP &H40
WriteDSP TimeConst%
WriteDSP (Length& AND &HFF)
WriteDSP ((Length& AND &HFFFF&) \ &H100)
WriteDSP &H91
ELSE
PRINT "You need a Sound Blaster with a DSP v3.x+ to play at high speed."
EXIT SUB
END IF
END IF
END SUB

I hope

Reply 1 of 4, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

This seems to be a cross-post of Huge Bug in VdmSound 2.04 !

Considering that you're seeing the same behavior in both VDMSound and DOSBox, are you sure that your code isn't at fault? (have you tested in a real DOS environment?)

Reply 2 of 4, by Lassar

User metadata
Rank Newbie
Rank
Newbie

Yes I tested it out in dos under Windows XP.

It worked just fined,

I then did a test in dos box and vdmsound showing the segments and offsets.
And it failed on certian offsets.

I also tested a game out on different segments and it failed on some segments. It got the wrong adress and gave me part of one sound and part of another sound.

I had also tested this game out in dosbox.

Who would imagine such a big bug ?

Conquer the FCC GROL, & Amatuer Radio test

Reply 3 of 4, by Freddo

User metadata
Rank Oldbie
Rank
Oldbie
Lassar wrote:

Yes I tested it out in dos under Windows XP.

That's not a real DOS enviroment. The "Soundblaster" in Windows XP is emulated, just like the ones in DOSBox and VDMSound.

Reply 4 of 4, by canadacow

User metadata
Rank Member
Rank
Member

Yes, if you more closely inspect the DMA documentation, you'll see that a DMA transfer cannot cross a page boundary. This is probably what your code is doing and your code would fail on legacy machine the same way it fails in DosBox. Of course, the real failure here is in Windows XP's DOS emulation layer.