-#endif\r
-SDL_SBStopSample(void)\r
-{\r
- byte is;\r
-\r
-asm pushf\r
-asm cli\r
-\r
- if (sbSamplePlaying)\r
- {\r
- sbSamplePlaying = false;\r
-\r
- sbWriteDelay();\r
- sbOut(sbWriteCmd,0xd0); // Turn off DSP DMA\r
-\r
- is = inportb(0x21); // Restore interrupt mask bit\r
- if (sbOldIntMask & (1 << sbInterrupt))\r
- is |= (1 << sbInterrupt);\r
- else\r
- is &= ~(1 << sbInterrupt);\r
- outportb(0x21,is);\r
- }\r
-\r
-asm popf\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-// SDL_SBPlaySeg() - Plays a chunk of sampled sound on the SoundBlaster\r
-// Insures that the chunk doesn't cross a bank boundary, programs the DMA\r
-// controller, and tells the SB to start doing DMA requests for DAC\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-static dword\r
-SDL_SBPlaySeg(volatile byte huge *data,dword length)\r
-{\r
- unsigned datapage;\r
- dword dataofs,uselen;\r
-\r
- uselen = length;\r
- datapage = FP_SEG(data) >> 12;\r
- dataofs = ((FP_SEG(data) & 0xfff) << 4) + FP_OFF(data);\r
- if (dataofs >= 0x10000)\r
- {\r
- datapage++;\r
- dataofs -= 0x10000;\r
- }\r
-\r
- if (dataofs + uselen > 0x10000)\r
- uselen = 0x10000 - dataofs;\r
-\r
- uselen--;\r
-\r
- // Program the DMA controller\r
-asm pushf\r
-asm cli\r
- outportb(0x0a,sbDMA | 4); // Mask off DMA on channel sbDMA\r
- outportb(0x0c,0); // Clear byte ptr flip-flop to lower byte\r
- outportb(0x0b,0x49); // Set transfer mode for D/A conv\r
- outportb(sbDMAa2,(byte)dataofs); // Give LSB of address\r
- outportb(sbDMAa2,(byte)(dataofs >> 8)); // Give MSB of address\r
- outportb(sbDMAa1,(byte)datapage); // Give page of address\r
- outportb(sbDMAa3,(byte)uselen); // Give LSB of length\r
- outportb(sbDMAa3,(byte)(uselen >> 8)); // Give MSB of length\r
- outportb(0x0a,sbDMA); // Re-enable DMA on channel sbDMA\r
-\r
- // Start playing the thing\r
- sbWriteDelay();\r
- sbOut(sbWriteCmd,0x14);\r
- sbWriteDelay();\r
- sbOut(sbWriteData,(byte)uselen);\r
- sbWriteDelay();\r
- sbOut(sbWriteData,(byte)(uselen >> 8));\r
-asm popf\r
-\r
- return(uselen + 1);\r
-}\r
-\r
-///////////////////////////////////////////////////////////////////////////\r
-//\r
-// SDL_SBService() - Services the SoundBlaster DMA interrupt\r
-//\r
-///////////////////////////////////////////////////////////////////////////\r
-/*static*/ void interrupt\r
-SDL_SBService(void)\r