I'm writing a sound system for DOS real mode. The program hangs under DOS when the interrupt is generated. Can you do a read() inside of an interrupt or will this cause DOS to re-enter itself?
Problem is that real mode cannot just load all of the samples into memory all at once so I'm caching from the disk. Each sample has a 8192 bytes buffer to cache with. The DMA transfer is 4096 bytes. Slow because of the read(), but the other alt is EMS which is not hard, but haven't done it yet.
So on interrupt I'm reading in a new block of data in the block that just played, mixing it, and playing the block that was just loaded. The read() is causing the system to freeze with the disk hard disk light on. When I comment it out, everything works and I send ACK to the DSP and EOI to the PIC and everyone gets along fine.
If I cannot read while inside of an interrupt (also cannot do a printf()) then I guess I will have to go PM or use EMS.
Is there any other way to do this?
I think DOS is re-entering itself but I cannot CLI because read requires a DOS interrupt just like printf. Since both of these functions cause the system to crash and will even bring Windows to its knees this is my take on what's happening.
No errors or warnings in compile and circular buffer works fine.
At point 1 I set the PlayOffset to 4096 and the LoadOffset to 0.
Load all samples from their respective files and mix all sample buffers into one global sample output buffer.
At point 2 I set the PlayOffset to 0 and the LoadOffset to 4096.
Load all samples from their respective files and mix all sample
buffer into one global sample output buffer.
The whole cycle continues until done playing(point 2 is the same as the start point of the diagram).