Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Waiting for 3 (or 3.3) microseconds? 286 and up. (Developers)

posted by myrkraverk, 09.12.2012, 23:41

Hi all,

Context. I've been playing with Sound Blaster coding, so far in DOSBox. The initialization routine is supposed to wait for 3 or 3.3 microseconds between the first two writes for the actual hardware. The docs I've found don't seem to agree on which. And at this point, it probably doesn't matter.

What is a good way to guarantee a wait for a few microseconds? Can I use the same code on a 286 while still guaranteeing long enough delay on a 64bit cpu who happens to be talking to a real sound blaster in an ISA slot? Those motherboards exists [even though I don't have one, nor a real sound blaster].

So far, I've just used interrupt 0x15 with ah=0x86 for a 1000 microsecond delay; which is long enough though quite excessive.

I believe I'm looking at the official documents, where they use a delay loop of "dec al; jnz delay" where al has been initialized to 0. Hence looping 255 times. I'm not sure that method is "future proof" or even sufficient with a modern CPU.

Also related. The Sound Blaster is said to take 100 microseconds to initialize itself. What steps can I take to wait just that long until there is 0xaa from the status port of the card? Again, those steps should ideally work on both real 286 and a modern CPU.

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 233 users online (0 registered, 233 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum