VOGONS


Huge Bug in VdmSound 2.04 !

Topic actions

  • This topic is locked. You cannot reply or edit posts.

First post, by Lassar

User metadata
Rank Newbie
Rank
Newbie

😳 I have been testing DmaPlay by Mike Huff.

I was storing sounds in strings and testing it out.

This is what I found. VdmSound 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 3 of 3, by HunterZ

User metadata
Rank l33t++
Rank
l33t++

Topic is locked due to a likely issue in the supplied test program. Please continue the discussion in the thread linked in my previous post above.

Sorry if this causes any inconvenince, but I want to prevent two threads about the same issue from diverging.