VOGONS


First post, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

I found a pretty good article concerning playing sound using a Sound Blaster in Quick Basic here: http://www.phatcode.net/articles.php?id=208 and used it to create my own wave file player: https://github.com/PeterSwinkels/Quick-Basic- … in/PlayWav2.bas

I got everything to work fine, but I realized I didn't quite understand the code regarding the DMA controller. I have questions about these code fragments:

  OUT &HA, SB.DMAchan + &H4   'Reset the DMA controller by setting the mask
' bit in the DMA mask register and clearing
OUT &HC, &H0 ' any current transfers by sending a 0 to the
' DMA clear register.

What exactly is a mask bit and what does the DMA clear register do? And:

  OUT &HB, SB.DMAchan + &H48                    'Set the transfer mode to
' "output" with the DMA mode
' register.

"Set the transfer mode to 'output' with the DMA mode register." Why is the code also supplying the Sound Blaster's DMA port?

Also I suspect we have yet another case of not understanding the difference between arithmetic addition and bitwise OR. (Sigh.) Shouldn't bitwise OR be used in those code snippets?

Also what little info I could find online directly relating to the specific DMA stuff I am doing was this: http://helppc.netcore2k.net/hardware/ports - It's very helpful (not):

00A Mask register
00B Mode register
00C Clear MSB/LSB flip flop

All very nice, but no where is it explained what a mask is or what modes there are, etc, etc.

Can anyone help me out with these questions? Thank you.

Do not read if you don't like attention seeking self-advertisements!

Did you read it anyway? Well, you can find all sorts of stuff I made using various programming languages over here:
https://github.com/peterswinkels

Reply 1 of 6, by Bondi

User metadata
Rank Oldbie
Rank
Oldbie

This is the topic I'm trying to look into as well. While hoping that more knowledgeable forum members will make their input to this topic, here are some links that can be useful to look at.
237A HIGH PERFORMANCEPROGRAMMABLE DMA CONTROLLER https://pdos.csail.mit.edu/6.828/2010/reading … dware/8237A.pdf
Interrupt controller https://github.com/leonardo-ono/Assembly8086S … /interrupts.pdf
SB principles of operation explained http://tubetime.us/index.php/2019/01/19/sound … s-of-operation/

as well as assembly code for SB DMA output
Single cycle https://github.com/leonardo-ono/Assembly8086S … master/sbsc.asm
Autoinitialize https://github.com/leonardo-ono/Assembly8086S … master/sbai.asm

PCMCIA Sound Cards chart
archive.org: PCMCIA software, manuals, drivers

Reply 2 of 6, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

@Bandi: thank you! Your links already answered my questions regarding the bit operations (bitwise OR should indeed have been used here) and I now know what I/O port &HA is used for. I may have more questions in the future.

Do not read if you don't like attention seeking self-advertisements!

Did you read it anyway? Well, you can find all sorts of stuff I made using various programming languages over here:
https://github.com/peterswinkels

Reply 3 of 6, by root42

User metadata
Rank l33t
Rank
l33t

Neat that someone actually uses the SB in Quick Basic! If you still have questions I would be happy to also help with answers. I did two videos about single cycle and autoinit DMA playback, but in C. However in the videos I more or less also explain which register to program in which way, which applies to either BASIC or C, or whatever language you are using:

https://youtu.be/hn-9oL-ClCE
https://youtu.be/dqeLS6Tv2Lo

Keep in mind that the DMA controller in the PC stems from the predecessor of the 8086, the 8o80 and supports only 16 bit addresses, hence the 64 KiB limitation. And that's why the programming of the DMA controller is such a crappy mess. Hence the extra address lines for accessing any segment up to 1 MiB are at port 0x081 to 0x083, instead of 0x000 to 0x00F.

YouTube and Bonus
80486DX@33 MHz, 16 MiB RAM, Tseng ET4000 1 MiB, SnarkBarker & GUSar Lite, PC MIDI Card+X2+SC55+MT32, OSSC

Reply 4 of 6, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

@root42:
Thank you for the links! I made some changes to my program:

https://github.com/PeterSwinkels/Quick-Basic- … in/PlayWav2.bas

I now have only one question left:
What is the MSB/LSB flip flop thing? Why do I need to write a null value to it? I know MSB/LSB means most/least significant bit, but what does that have to do with DMA?

Do not read if you don't like attention seeking self-advertisements!

Did you read it anyway? Well, you can find all sorts of stuff I made using various programming languages over here:
https://github.com/peterswinkels

Reply 5 of 6, by Tiido

User metadata
Rank l33t
Rank
l33t

DMA controller has one port to write high and low byte and it keeps an internal flag to know which register the data goes to. That write is for resetting the ordering to be sure that you won't get swapped data written which will lead to effects that are certainly not pleasant 🤣.

T-04YBSC, a new YMF71x based sound card & Official VOGONS thread about it
Newly made 4MB 60ns 30pin SIMMs ~
mida sa loed ? nagunii aru ei saa 😜

Reply 6 of 6, by Peter Swinkels

User metadata
Rank Oldbie
Rank
Oldbie

@Tiido: thank you!

Do not read if you don't like attention seeking self-advertisements!

Did you read it anyway? Well, you can find all sorts of stuff I made using various programming languages over here:
https://github.com/peterswinkels