Mike Chambers
Veteran Member
- Joined
- Sep 2, 2006
- Messages
- 2,621
i'm writing some code in QB to play audio through the sound blaster using the auto-init DMA mode with buffering to prevent that annoying clicking sound you get using the single-cycle DMA playback mode..
problem is, there's nothing built into QB to let me trap hardware interrupts so i know when to get the next buffer segment ready for the SB'S DSP. i'll be telling the SB's DSP that the length of the audio block is half of the real size that i tell the DMA controller so that an interrupt is called in the middle of playback that lets me load new audio data into the half of the block that just finished playing while it continues to play the second half of the block.
i know how to manually assign an arbitrary location to jump to on a hardware interrupt using a few POKEs. i was going to have a small bit of binary code in a string that it jumps to and then have that code modify a 1 byte QB string that i can keep checking and resetting to see if the interrupt occured or not.
i know what i want the ASM code to do but i'm not sure about the syntax because i never use ASM. here's how it should work:
1. hardware interrupt triggers machine to jump to the location my binary code stored in a string.
2. the code in the string needs to change the value of 1 byte at the segment+offset i want. i'll need to dynamically determine that location during runtime while creating the binary code string using VARSEG and VARPTR
3. return to my program
iirc, it would simply be comprised of a (few?) MOV operations and then a RETF?
do i also need to push the registers upon entry and pop them back when my code is finished? what exactly is the binary code i'd need in the string to accomplish this?
hope i'm being clear enough. can anybody help out? thanks!
problem is, there's nothing built into QB to let me trap hardware interrupts so i know when to get the next buffer segment ready for the SB'S DSP. i'll be telling the SB's DSP that the length of the audio block is half of the real size that i tell the DMA controller so that an interrupt is called in the middle of playback that lets me load new audio data into the half of the block that just finished playing while it continues to play the second half of the block.
i know how to manually assign an arbitrary location to jump to on a hardware interrupt using a few POKEs. i was going to have a small bit of binary code in a string that it jumps to and then have that code modify a 1 byte QB string that i can keep checking and resetting to see if the interrupt occured or not.
i know what i want the ASM code to do but i'm not sure about the syntax because i never use ASM. here's how it should work:
1. hardware interrupt triggers machine to jump to the location my binary code stored in a string.
2. the code in the string needs to change the value of 1 byte at the segment+offset i want. i'll need to dynamically determine that location during runtime while creating the binary code string using VARSEG and VARPTR
3. return to my program
iirc, it would simply be comprised of a (few?) MOV operations and then a RETF?
do i also need to push the registers upon entry and pop them back when my code is finished? what exactly is the binary code i'd need in the string to accomplish this?
hope i'm being clear enough. can anybody help out? thanks!