Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

And now: int 0x21 in hw interrupt handler? (Developers)

posted by myrkraverk, 15.12.2012, 15:52

> As Japheth and Tom have both eluded to, trying to call INT 21h from inside
> an IRQ handler is a REALLY bad idea. Sometimes it's possible, and
> sometimes it's not. You really shouldn't even try unless you have no other
> choice.

Here is something I got in the email, from Eric:

> You want to check the INDOS flag to see if int21
> is already busy. Also you want to check if your
> own handler is already busy and you may want to
> enable IRQ at some point, normally they are off
> until your IRQ handler finishes. But there are
> many howtos about such things on the web :-)

Another "option" might be to wrap all my int 0x21 calls with CLI/STI but I'm not sure that's a good idea either.

> Japheth's suggestion is probably the easiest to implement. You just need
> some kind of a memory buffer, though it doesn't necessarily need to be in
> XMS. You need to have one process that reads the file when it's safe to do
> (definitely not from inside an IRQ handler), and puts data into the buffer.
> As a separate process, you extract data from the buffer in the IRQ
> handler. Obviously, you need some sort of "communication" between the two
> (independent) processes to manage the buffer.

Yes, I can either busy wait for the interrupt, using some sort of semaphore, or manipulate the stack in a fashion that IRET will bring me to an application level handler [thread, in a sense] which then returns control to the program where the IRQ was raised.

For now the question is: what do I want to do while the PCM data is being fed to the Sound Blaster. If nothing, I can busy wait - something that might be a good idea as a "first try."

Maybe a more "sane" general way is to simply check in my main loop if audio needs processing [the same semaphore as before] and then feed in the next PCM data.

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum