X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fid_sd.c;h=943dede1093f35034ae12af43622597ae39e953a;hb=8f10eae936d84f146fe1490e0fe29932b1a6b05d;hp=2a73fc690f377d82c186e41b2d0311c64081b285;hpb=b932f865a55d4be5f9f814b9d884bbce6cbe55b4;p=16.git diff --git a/src/lib/id_sd.c b/src/lib/id_sd.c index 2a73fc69..943dede1 100755 --- a/src/lib/id_sd.c +++ b/src/lib/id_sd.c @@ -23,8 +23,9 @@ // // ID Engine // ID_SD.c - Sound Manager for Wolfenstein 3D -// v1.2 +// v1.2w // By Jason Blochowiak +// Open Watcom port by sparky4 // // @@ -52,45 +53,36 @@ #pragma hdrstop // Wierdo thing with MUSE +#include - -//#ifdef _MUSE_ // Will be defined in ID_Types.h +#ifndef _MUSE_ // Will be defined in ID_Types.h #include "src/lib/id_sd.h" -//#else -//#include "ID_HEADS.H" -//#endif +#else +#include "src/lib/16_head.h" +#endif #pragma hdrstop #pragma warn -pia -#ifdef nil -#undef nil -#endif -#define nil 0 - #define SDL_SoundFinished() {SoundNumber = SoundPriority = 0;} -// Macros for SoundBlaster stuff -#define sbOut(n,b) outportb((n) + sbLocation,b) -#define sbIn(n) inportb((n) + sbLocation) -#define sbWriteDelay() while (sbIn(sbWriteStat) & 0x80); -#define sbReadDelay() while (sbIn(sbDataAvail) & 0x80); - // Macros for AdLib stuff #define selreg(n) outportb(alFMAddr,n) #define writereg(n) outportb(alFMData,n) #define readstat() inportb(alFMStatus) +#define SD_USECATA3DSETTIMERSPEED + // Imports from ID_SD_A.ASM -/*extern*/ void SDL_SetDS(void), - SDL_IndicatePC(boolean on); +#if 0 +/*extern*/ void SDL_SetDS(void); /*extern*/ void interrupt SDL_t0ExtremeAsmService(void), SDL_t0FastAsmService(void), SDL_t0SlowAsmService(void); +#endif + void SDL_IndicatePC(boolean on); // Global variables - boolean SoundSourcePresent, - AdLibPresent, - SoundBlasterPresent,SBProPresent, + boolean AdLibPresent, NeedsDigitized,NeedsMusic, SoundPositioned; SDMode SoundMode; @@ -100,23 +92,17 @@ word HackCount; word *SoundTable; // Really * _seg *SoundTable, but that don't work boolean ssIsTandy; - word ssPort = 2; int DigiMap[LASTSOUND]; // Internal variables static boolean SD_Started; boolean nextsoundpos; + word/*boolean_+*/ TimerDone; + word TimerVal,TimerDelay10,TimerDelay25,TimerDelay100; dword TimerDivisor,TimerCount; static char *ParmStrings[] = { "noal", - "nosb", - "nopro", - "noss", - "sst", - "ss1", - "ss2", - "ss3", nil }; static void (*SoundUserHook)(void); @@ -134,31 +120,7 @@ static void (*SoundUserHook)(void); static boolean DigiMissed,DigiLastSegment; static memptr DigiNextAddr; static word DigiNextLen; - -// SoundBlaster variables -static boolean sbNoCheck,sbNoProCheck; -static volatile boolean sbSamplePlaying; -static byte sbOldIntMask = -1; -static volatile byte huge *sbNextSegPtr; -static byte sbDMA = 1, - sbDMAa1 = 0x83,sbDMAa2 = 2,sbDMAa3 = 3, - sba1Vals[] = {0x87,0x83,0,0x82}, - sba2Vals[] = {0,2,0,6}, - sba3Vals[] = {1,3,0,7}; -static int sbLocation = -1,sbInterrupt = 7,sbIntVec = 0xf, - sbIntVectors[] = {-1,-1,0xa,0xb,-1,0xd,-1,0xf,-1,-1,-1}; -static volatile dword sbNextSegLen; -static volatile SampledSound huge *sbSamples; -static void interrupt (*sbOldIntHand)(void); -static byte sbpOldFMMix,sbpOldVOCMix; - -// SoundSource variables - boolean ssNoCheck; - boolean ssActive; - word ssControl,ssStatus,ssData; - byte ssOn,ssOff; - volatile byte far *ssSample; - volatile dword ssLengthLeft; + boolean pcindicate; // PC Sound variables volatile byte pcLastSample,far *pcSound; @@ -183,9 +145,9 @@ static byte carriers[9] = { 3, 4, 5,11,12,13,19,20,21}, // Sequencer variables boolean sqActive; static word alFXReg; -static ActiveTrack *tracks[sqMaxTracks], - mytracks[sqMaxTracks]; -static word sqMode,sqFadeStep; +static ActiveTrack *tracks[sqMaxTracks];//, +//-- mytracks[sqMaxTracks]; +//--static word sqMode,sqFadeStep; word far *sqHack,far *sqHackPtr,sqHackLen,sqHackSeqLen; long sqHackTime; @@ -233,6 +195,7 @@ SDL_SetIntsPerSec(word ints) SDL_SetTimer0(1192030 / ints); } +#ifndef SD_USECATA3DSETTIMERSPEED static void SDL_SetTimerSpeed(void) { @@ -266,626 +229,130 @@ SDL_SetTimerSpeed(void) TimerRate = rate; } } - -#if 0 -// -// SoundBlaster code -// - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_SBStopSample() - Stops any active sampled sound and causes DMA -// requests from the SoundBlaster to cease -// -/////////////////////////////////////////////////////////////////////////// -#ifdef _MUSE_ -void #else static void -#endif -SDL_SBStopSample(void) -{ - byte is; - -asm pushf -asm cli - - if (sbSamplePlaying) - { - sbSamplePlaying = false; - - sbWriteDelay(); - sbOut(sbWriteCmd,0xd0); // Turn off DSP DMA - - is = inportb(0x21); // Restore interrupt mask bit - if (sbOldIntMask & (1 << sbInterrupt)) - is |= (1 << sbInterrupt); - else - is &= ~(1 << sbInterrupt); - outportb(0x21,is); - } - -asm popf -} - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_SBPlaySeg() - Plays a chunk of sampled sound on the SoundBlaster -// Insures that the chunk doesn't cross a bank boundary, programs the DMA -// controller, and tells the SB to start doing DMA requests for DAC -// -/////////////////////////////////////////////////////////////////////////// -static dword -SDL_SBPlaySeg(volatile byte huge *data,dword length) -{ - unsigned datapage; - dword dataofs,uselen; - - uselen = length; - datapage = FP_SEG(data) >> 12; - dataofs = ((FP_SEG(data) & 0xfff) << 4) + FP_OFF(data); - if (dataofs >= 0x10000) - { - datapage++; - dataofs -= 0x10000; - } - - if (dataofs + uselen > 0x10000) - uselen = 0x10000 - dataofs; - - uselen--; - - // Program the DMA controller -asm pushf -asm cli - outportb(0x0a,sbDMA | 4); // Mask off DMA on channel sbDMA - outportb(0x0c,0); // Clear byte ptr flip-flop to lower byte - outportb(0x0b,0x49); // Set transfer mode for D/A conv - outportb(sbDMAa2,(byte)dataofs); // Give LSB of address - outportb(sbDMAa2,(byte)(dataofs >> 8)); // Give MSB of address - outportb(sbDMAa1,(byte)datapage); // Give page of address - outportb(sbDMAa3,(byte)uselen); // Give LSB of length - outportb(sbDMAa3,(byte)(uselen >> 8)); // Give MSB of length - outportb(0x0a,sbDMA); // Re-enable DMA on channel sbDMA - - // Start playing the thing - sbWriteDelay(); - sbOut(sbWriteCmd,0x14); - sbWriteDelay(); - sbOut(sbWriteData,(byte)uselen); - sbWriteDelay(); - sbOut(sbWriteData,(byte)(uselen >> 8)); -asm popf - - return(uselen + 1); -} - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_SBService() - Services the SoundBlaster DMA interrupt -// -/////////////////////////////////////////////////////////////////////////// -/*static*/ void interrupt -SDL_SBService(void) +SDL_SetTimerSpeed(void) { - dword used; - - sbIn(sbDataAvail); // Ack interrupt to SB + word rate; - if (sbNextSegPtr) - { - used = SDL_SBPlaySeg(sbNextSegPtr,sbNextSegLen); - if (sbNextSegLen <= used) - sbNextSegPtr = nil; - else - { - sbNextSegPtr += used; - sbNextSegLen -= used; - } - } + if (MusicMode == smm_AdLib) + rate = TickBase * 8; else - { - SDL_SBStopSample(); - SDL_DigitizedDone(); - } - - outportb(0x20,0x20); // Ack interrupt + rate = TickBase * 2; + SDL_SetIntsPerSec(rate); } - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_SBPlaySample() - Plays a sampled sound on the SoundBlaster. Sets up -// DMA to play the sound -// -/////////////////////////////////////////////////////////////////////////// -#ifdef _MUSE_ -void -#else -static void #endif -SDL_SBPlaySample(byte huge *data,dword len) -{ - dword used; - - SDL_SBStopSample(); - -asm pushf -asm cli - - used = SDL_SBPlaySeg(data,len); - if (len <= used) - sbNextSegPtr = nil; - else - { - sbNextSegPtr = data + used; - sbNextSegLen = len - used; - } - - // Save old interrupt status and unmask ours - sbOldIntMask = inportb(0x21); - outportb(0x21,sbOldIntMask & ~(1 << sbInterrupt)); - - sbWriteDelay(); - sbOut(sbWriteCmd,0xd4); // Make sure DSP DMA is enabled - - sbSamplePlaying = true; - -asm popf -} - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_PositionSBP() - Sets the attenuation levels for the left and right -// channels by using the mixer chip on the SB Pro. This hits a hole in -// the address map for normal SBs. -// -/////////////////////////////////////////////////////////////////////////// -static void -SDL_PositionSBP(int leftpos,int rightpos) -{ - byte v; - - if (!SBProPresent) - return; - - leftpos = 15 - leftpos; - rightpos = 15 - rightpos; - v = ((leftpos & 0x0f) << 4) | (rightpos & 0x0f); - -asm pushf -asm cli - - sbOut(sbpMixerAddr,sbpmVoiceVol); - sbOut(sbpMixerData,v); - -asm popf -} /////////////////////////////////////////////////////////////////////////// // -// SDL_CheckSB() - Checks to see if a SoundBlaster resides at a -// particular I/O location +// SDL_TimingService() - Used by SDL_InitDelay() to determine a timing +// value for the current system that we're running on // /////////////////////////////////////////////////////////////////////////// -static boolean -SDL_CheckSB(int port) +//static void interrupt +void interrupt +SDL_TimingService(void) { - int i; - - sbLocation = port << 4; // Initialize stuff for later use - - sbOut(sbReset,true); // Reset the SoundBlaster DSP -asm mov dx,0x388 // Wait >4usec -asm in al, dx -asm in al, dx -asm in al, dx -asm in al, dx -asm in al, dx -asm in al, dx -asm in al, dx -asm in al, dx -asm in al, dx - - sbOut(sbReset,false); // Turn off sb DSP reset -asm mov dx,0x388 // Wait >100usec -asm mov cx,100 -#ifdef __WATCOMC__ + //TimerVal = _CX; __asm { -#endif -usecloop: -asm in al,dx -asm loop usecloop -#ifdef __WATCOMC__ - } -#endif - - for (i = 0;i < 100;i++) - { - if (sbIn(sbDataAvail) & 0x80) // If data is available... - { - if (sbIn(sbReadData) == 0xaa) // If it matches correct value - return(true); - else - { - sbLocation = -1; // Otherwise not a SoundBlaster - return(false); - } - } - } - sbLocation = -1; // Retry count exceeded - fail - return(false); -} - -/////////////////////////////////////////////////////////////////////////// -// -// Checks to see if a SoundBlaster is in the system. If the port passed is -// -1, then it scans through all possible I/O locations. If the port -// passed is 0, then it uses the default (2). If the port is >0, then -// it just passes it directly to SDL_CheckSB() -// -/////////////////////////////////////////////////////////////////////////// -static boolean -SDL_DetectSoundBlaster(int port) -{ - int i; - - if (port == 0) // If user specifies default, use 2 - port = 2; - if (port == -1) - { - if (SDL_CheckSB(2)) // Check default before scanning - return(true); - - if (SDL_CheckSB(4)) // Check other SB Pro location before scan - return(true); - - for (i = 1;i <= 6;i++) // Scan through possible SB locations - { - if ((i == 2) || (i == 4)) - continue; - - if (SDL_CheckSB(i)) // If found at this address, - return(true); // return success - } - return(false); // All addresses failed, return failure + mov TimerVal,cx } - else - return(SDL_CheckSB(port)); // User specified address or default -} - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_SBSetDMA() - Sets the DMA channel to be used by the SoundBlaster -// code. Sets up sbDMA, and sbDMAa1-sbDMAa3 (used by SDL_SBPlaySeg()). -// -/////////////////////////////////////////////////////////////////////////// -void -SDL_SBSetDMA(byte channel) -{ - if (channel > 3) - Quit("SDL_SBSetDMA() - invalid SoundBlaster DMA channel"); + TimerDone = 1; - sbDMA = channel; - sbDMAa1 = sba1Vals[channel]; - sbDMAa2 = sba2Vals[channel]; - sbDMAa3 = sba3Vals[channel]; + outportb(0x20,0x20); // Ack interrupt } /////////////////////////////////////////////////////////////////////////// // -// SDL_StartSB() - Turns on the SoundBlaster +// SDL_InitDelay() - Sets up TimerDelay's for SDL_Delay() // /////////////////////////////////////////////////////////////////////////// static void -SDL_StartSB(void) +SDL_InitDelay(void) { - byte timevalue,test; - - sbIntVec = sbIntVectors[sbInterrupt]; - if (sbIntVec < 0) - Quit("SDL_StartSB: Illegal or unsupported interrupt number for SoundBlaster"); - - sbOldIntHand = getvect(sbIntVec); // Get old interrupt handler - setvect(sbIntVec,SDL_SBService); // Set mine - - sbWriteDelay(); - sbOut(sbWriteCmd,0xd1); // Turn on DSP speaker + int i; + word timer; - // Set the SoundBlaster DAC time constant for 7KHz - timevalue = 256 - (1000000 / 7000); - sbWriteDelay(); - sbOut(sbWriteCmd,0x40); - sbWriteDelay(); - sbOut(sbWriteData,timevalue); + setvect(8,SDL_TimingService); // Set to my timer 0 ISR - SBProPresent = false; - if (sbNoProCheck) - return; + SDL_SetIntsPerSec(1000); // Time 1ms - // Check to see if this is a SB Pro - sbOut(sbpMixerAddr,sbpmFMVol); - sbpOldFMMix = sbIn(sbpMixerData); - sbOut(sbpMixerData,0xbb); - test = sbIn(sbpMixerData); - if (test == 0xbb) + for (i = 0,timer = 0;i < 10;i++) // Do timing test 10 times { - // Boost FM output levels to be equivilent with digitized output - sbOut(sbpMixerData,0xff); - test = sbIn(sbpMixerData); - if (test == 0xff) - { - SBProPresent = true; - - // Save old Voice output levels (SB Pro) - sbOut(sbpMixerAddr,sbpmVoiceVol); - sbpOldVOCMix = sbIn(sbpMixerData); - - // Turn SB Pro stereo DAC off - sbOut(sbpMixerAddr,sbpmControl); - sbOut(sbpMixerData,0); // 0=off,2=on + __asm { + xor dx,dx // Zero DX + mov cx,0xffff // Put starting value in CX + mov [TimerDone],cx // TimerDone = false - 1 +#ifdef __BORLANDC__ } - } -} - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_ShutSB() - Turns off the SoundBlaster -// -/////////////////////////////////////////////////////////////////////////// -static void -SDL_ShutSB(void) -{ - SDL_SBStopSample(); - - if (SBProPresent) - { - // Restore FM output levels (SB Pro) - sbOut(sbpMixerAddr,sbpmFMVol); - sbOut(sbpMixerData,sbpOldFMMix); - - // Restore Voice output levels (SB Pro) - sbOut(sbpMixerAddr,sbpmVoiceVol); - sbOut(sbpMixerData,sbpOldVOCMix); - } - - setvect(sbIntVec,sbOldIntHand); // Set vector back -} #endif - -// Sound Source Code - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_SSStopSample() - Stops a sample playing on the Sound Source -// -/////////////////////////////////////////////////////////////////////////// -#ifdef _MUSE_ -void -#else -static void +startloop: +#ifdef __BORLANDC__ + __asm { #endif -SDL_SSStopSample(void) -{ -asm pushf -asm cli - - (long)ssSample = 0; - -asm popf -} - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_SSService() - Handles playing the next sample on the Sound Source -// -/////////////////////////////////////////////////////////////////////////// -static void -SDL_SSService(void) -{ - //boolean gotit; - boolean doneflag=false; - byte v; - - while (ssSample) - { - __asm { - mov dx,[ssStatus] // Check to see if FIFO is currently empty - in al,dx - test al,0x40 - jnz done // Nope - don't push any more data out - jmp end + or [TimerDone],0 + jnz startloop // Make sure we're at the start #ifdef __BORLANDC__ - } + } #endif - done: +loop_: #ifdef __BORLANDC__ - __asm { + __asm { #endif - mov doneflag,1 + test [TimerDone],1 // See if TimerDone flag got hit + jnz done // Yep - drop out of the loop + loop loop_ #ifdef __BORLANDC__ - } + } #endif - end: +done: #ifdef __WATCOMC__ } #endif - if(!doneflag) - { - v = *ssSample++; - if (!(--ssLengthLeft)) - { - (long)ssSample = 0; - SDL_DigitizedDone(); - } - __asm { - mov dx,[ssData] // Pump the value out - mov al,[v] - out dx,al - - mov dx,[ssControl] // Pulse printer select - mov al,[ssOff] - out dx,al - push ax - pop ax - mov al,[ssOn] - out dx,al - - push ax // Delay a short while - pop ax - push ax - pop ax -done:; - } - } + if (0xffff - TimerVal > timer) + timer = 0xffff - TimerVal; } -} + timer += timer / 2; // Use some slop + TimerDelay10 = timer / (1000 / 10); + TimerDelay25 = timer / (1000 / 25); + TimerDelay100 = timer / (1000 / 100); -/////////////////////////////////////////////////////////////////////////// -// -// SDL_SSPlaySample() - Plays the specified sample on the Sound Source -// -/////////////////////////////////////////////////////////////////////////// -#ifdef _MUSE_ -void -#else -static void -#endif -SDL_SSPlaySample(byte huge *data,dword len) -{ -asm pushf -asm cli - - ssLengthLeft = len; - ssSample = (volatile byte far *)data; + SDL_SetTimer0(0); // Reset timer 0 -asm popf + setvect(8,t0OldService); // Set back to old ISR } /////////////////////////////////////////////////////////////////////////// // -// SDL_StartSS() - Sets up for and turns on the Sound Source +// SDL_Delay() - Delays the specified amount of time // /////////////////////////////////////////////////////////////////////////// static void -SDL_StartSS(void) -{ - if (ssPort == 3) - ssControl = 0x27a; // If using LPT3 - else if (ssPort == 2) - ssControl = 0x37a; // If using LPT2 - else - ssControl = 0x3be; // If using LPT1 - ssStatus = ssControl - 1; - ssData = ssStatus - 1; - - ssOn = 0x04; - if (ssIsTandy) - ssOff = 0x0e; // Tandy wierdness - else - ssOff = 0x0c; // For normal machines - - outportb(ssControl,ssOn); // Enable SS -} - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_ShutSS() - Turns off the Sound Source -// -/////////////////////////////////////////////////////////////////////////// -static void -SDL_ShutSS(void) -{ - outportb(ssControl,ssOff); -} - -/////////////////////////////////////////////////////////////////////////// -// -// SDL_CheckSS() - Checks to see if a Sound Source is present at the -// location specified by the sound source variables -// -/////////////////////////////////////////////////////////////////////////// -static boolean -SDL_CheckSS(void) +SDL_Delay(word delay) { - boolean present = false, chkdone=0; - dword lasttime; - - // Turn the Sound Source on and wait awhile (4 ticks) - SDL_StartSS(); - - lasttime = TimeCount; - while (TimeCount < lasttime + 4) - {} + if (!delay) + return; __asm { - mov dx,[ssStatus] // Check to see if FIFO is currently empty - in al,dx - test al,0x40 - jnz checkdone // Nope - Sound Source not here - - mov cx,32 // Force FIFO overflow (FIFO is 16 bytes) + mov cx,[delay] #ifdef __BORLANDC__ } #endif -outloop: +loop_: #ifdef __BORLANDC__ __asm { #endif - mov dx,[ssData] // Pump a neutral value out - mov al,0x80 - out dx,al - - mov dx,[ssControl] // Pulse printer select - mov al,[ssOff] - out dx,al - push ax - pop ax - mov al,[ssOn] - out dx,al - - push ax // Delay a short while before we do this again - pop ax - push ax - pop ax - - loop outloop - - mov dx,[ssStatus] // Is FIFO overflowed now? - in al,dx - test al,0x40 - jz checkdone // Nope, still not - Sound Source not here - jmp end + test [TimerDone],0 // Useless code - just for timing equivilency + jnz done + loop loop_ #ifdef __BORLANDC__ } #endif -checkdone: -#ifdef __BORLANDC__ - __asm { -#endif - mov chkdone,1 -#ifdef __BORLANDC__ - } -#endif - end: +done: #ifdef __WATCOMC__ } #endif - - if(!chkdone) present = true; // Yes - it's here! - -//checkdone: - SDL_ShutSS(); - return(present); -} - -static boolean -SDL_DetectSoundSource(void) -{ - for (ssPort = 1;ssPort <= 3;ssPort++) - if (SDL_CheckSS()) - return(true); - return(false); } // @@ -930,7 +397,7 @@ SDL_PCStopSample(void) asm pushf asm cli - (long)pcSound = 0; + /*(long)*/pcSound = 0; SDL_IndicatePC(false); @@ -978,7 +445,7 @@ SDL_PCStopSound(void) asm pushf asm cli - (long)pcSound = 0; + /*(long)*/pcSound = 0; asm in al,0x61 // Turn the speaker off asm and al,0xfd // ~2 @@ -987,7 +454,6 @@ asm out 0x61,al asm popf } -#if 0 /////////////////////////////////////////////////////////////////////////// // // SDL_PCService() - Handles playing the next sample in a PC sound @@ -1041,7 +507,6 @@ SDL_PCService(void) } } } -#endif /////////////////////////////////////////////////////////////////////////// // @@ -1067,7 +532,7 @@ asm popf // Stuff for digitized sounds // memptr -SDL_LoadDigiSegment(word page) +SDL_LoadDigiSegment(word page, global_game_variables_t *gvar) { memptr addr; @@ -1081,8 +546,8 @@ asm mov al,10 // bright green asm out dx,al #endif - addr = PM_GetSoundPage(page, gvar); - PM_SetPageLock(PMSoundStart + page,pml_Locked); + addr = PM_GetSoundPage(page); + PM_SetPageLock(gvar->pm.fi.PMSoundStart + page,pml_Locked, gvar); #if 0 // for debugging asm mov dx,STATUS_REGISTER_1 @@ -1107,17 +572,17 @@ SDL_PlayDigiSegment(memptr addr,word len) case sds_PC: SDL_PCPlaySample(addr,len); break; - case sds_SoundSource: - SDL_SSPlaySample(addr,len); - break; - case sds_SoundBlaster: - SDL_SBPlaySample(addr,len); - break; +//SS case sds_SoundSource: +//SS SDL_SSPlaySample(addr,len); +//SS break; +//SB case sds_SoundBlaster: +//SB SDL_SBPlaySample(addr,len); +//SB break; } } void -SD_StopDigitized(void) +SD_StopDigitized(global_game_variables_t *gvar) { int i; @@ -1139,24 +604,24 @@ asm cli case sds_PC: SDL_PCStopSample(); break; - case sds_SoundSource: - SDL_SSStopSample(); - break; - case sds_SoundBlaster: - SDL_SBStopSample(); - break; +//SS case sds_SoundSource: +//SS SDL_SSStopSample(); +//SS break; +//SB case sds_SoundBlaster: +//SB SDL_SBStopSample(); +//SB break; } asm popf for (i = DigiLastStart;i < DigiLastEnd;i++) - PM_SetPageLock(i + PMSoundStart,pml_Unlocked); + PM_SetPageLock(i + gvar->pm.fi.PMSoundStart,pml_Unlocked, gvar); DigiLastStart = 1; DigiLastEnd = 0; } void -SD_Poll(void) +SD_Poll(global_game_variables_t *gvar) { if (DigiLeft && !DigiNextAddr) { @@ -1164,7 +629,7 @@ SD_Poll(void) DigiLeft -= DigiNextLen; if (!DigiLeft) DigiLastSegment = true; - DigiNextAddr = SDL_LoadDigiSegment(DigiPage++); + DigiNextAddr = SDL_LoadDigiSegment(DigiPage++, gvar); } if (DigiMissed && DigiNextAddr) { @@ -1181,7 +646,7 @@ SD_Poll(void) } void -SD_SetPosition(int leftpos,int rightpos) +SD_SetPosition(int leftpos,int rightpos, global_game_variables_t *gvar) { if ( @@ -1191,18 +656,18 @@ SD_SetPosition(int leftpos,int rightpos) || (rightpos > 15) || ((leftpos == 15) && (rightpos == 15)) ) - Quit("SD_SetPosition: Illegal position"); + Quit(gvar, "SD_SetPosition: Illegal position"); switch (DigiMode) { - case sds_SoundBlaster: - SDL_PositionSBP(leftpos,rightpos); - break; +//SB case sds_SoundBlaster: +//SB SDL_PositionSBP(leftpos,rightpos); +//SB break; } } void -SD_PlayDigitized(word which,int leftpos,int rightpos) +SD_PlayDigitized(word which,int leftpos,int rightpos, global_game_variables_t *gvar) { word len; memptr addr; @@ -1210,11 +675,11 @@ SD_PlayDigitized(word which,int leftpos,int rightpos) if (!DigiMode) return; - SD_StopDigitized(); + SD_StopDigitized(gvar); if (which >= NumDigi) - Quit("SD_PlayDigitized: bad sound number"); + Quit(gvar, "SD_PlayDigitized: bad sound number"); - SD_SetPosition(leftpos,rightpos); + SD_SetPosition(leftpos,rightpos, gvar); DigiPage = DigiList[(which * 2) + 0]; DigiLeft = DigiList[(which * 2) + 1]; @@ -1223,7 +688,7 @@ SD_PlayDigitized(word which,int leftpos,int rightpos) DigiLastEnd = DigiPage + ((DigiLeft + (PMPageSize - 1)) / PMPageSize); len = (DigiLeft >= PMPageSize)? PMPageSize : (DigiLeft % PMPageSize); - addr = SDL_LoadDigiSegment(DigiPage++); + addr = SDL_LoadDigiSegment(DigiPage++, gvar); DigiPlaying = true; DigiLastSegment = false; @@ -1233,7 +698,7 @@ SD_PlayDigitized(word which,int leftpos,int rightpos) if (!DigiLeft) DigiLastSegment = true; - SD_Poll(); + SD_Poll(gvar); } void @@ -1265,14 +730,14 @@ SDL_DigitizedDone(void) } void -SD_SetDigiDevice(SDSMode mode) +SD_SetDigiDevice(SDSMode mode, global_game_variables_t *gvar) { boolean devicenotpresent; if (mode == DigiMode) return; - SD_StopDigitized(); + SD_StopDigitized(gvar); devicenotpresent = false; switch (mode) @@ -1294,42 +759,42 @@ SD_SetDigiDevice(SDSMode mode) if (!devicenotpresent) { - if (DigiMode == sds_SoundSource) - SDL_ShutSS(); +//SS if (DigiMode == sds_SoundSource) +//SS SDL_ShutSS(); DigiMode = mode; - if (mode == sds_SoundSource) - SDL_StartSS(); +//SS if (mode == sds_SoundSource) +//SS SDL_StartSS(); SDL_SetTimerSpeed(); } } void -SDL_SetupDigi(void) +SDL_SetupDigi(global_game_variables_t *gvar) { memptr list; word far *p, pg; int i; - PM_UnlockMainMem(); - MM_GetPtr(&list,PMPageSize); - PM_CheckMainMem(); - p = (word far *)MK_FP(PM_GetPage(ChunksInFile - 1),0); + PM_UnlockMainMem(gvar); + MM_GetPtr(&list,PMPageSize, gvar); + PM_CheckMainMem(gvar); + p = (word far *)MK_FP(PM_GetPage(gvar->pm.fi.ChunksInFile - 1, gvar),0); _fmemcpy((void far *)list,(void far *)p,PMPageSize); - pg = PMSoundStart; + pg = gvar->pm.fi.PMSoundStart; for (i = 0;i < PMPageSize / (sizeof(word) * 2);i++,p += 2) { - if (pg >= ChunksInFile - 1) + if (pg >= gvar->pm.fi.ChunksInFile - 1) break; pg += (p[1] + (PMPageSize - 1)) / PMPageSize; } - PM_UnlockMainMem(); - MM_GetPtr((memptr *)&DigiList,i * sizeof(word) * 2); + PM_UnlockMainMem(gvar); + MM_GetPtr(MEMPTRCONV DigiList,i * sizeof(word) * 2, gvar); _fmemcpy((void far *)DigiList,(void far *)list,i * sizeof(word) * 2); - MM_FreePtr(&list); + MM_FreePtr(&list, gvar); NumDigi = i; for (i = 0;i < LASTSOUND;i++) @@ -1349,69 +814,79 @@ alOut(byte n,byte b) asm pushf asm cli -asm mov dx,0x388 -asm mov al,[n] -asm out dx,al -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm inc dx -asm mov al,[b] -asm out dx,al +asm mov dx,0x388 +asm mov al,[n] +asm out dx,al +#if 0 + SDL_Delay(TimerDelay10); +#else +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +#endif + +asm mov dx,0x389 +asm mov al,[b] +asm out dx,al asm popf -asm dec dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx +#if 0 + SDL_Delay(TimerDelay25); +#else +asm mov dx,0x388 +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx -asm in al,dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +asm in al, dx +#endif } -#if 0 +//#if 0 /////////////////////////////////////////////////////////////////////////// // // SDL_SetInstrument() - Puts an instrument into a generator // /////////////////////////////////////////////////////////////////////////// -static void +//static void +void SDL_SetInstrument(int track,int which,Instrument far *inst,boolean percussive) { byte c,m; @@ -1448,7 +923,7 @@ SDL_SetInstrument(int track,int which,Instrument far *inst,boolean percussive) alOut(which + alFeedCon,inst->nConn); // DEBUG - I think this is right } -#endif +//#endif /////////////////////////////////////////////////////////////////////////// // @@ -1466,7 +941,7 @@ SDL_ALStopSound(void) asm pushf asm cli - (long)alSound = 0; + /*(long)*/alSound = 0; alOut(alFreqH + 0,0); asm popf @@ -1505,9 +980,9 @@ void #else static void #endif -SDL_ALPlaySound(AdLibSound far *sound) +SDL_ALPlaySound(AdLibSound far *sound, global_game_variables_t *gvar) { - Instrument far *inst; + Instrument __far *inst; byte huge *data; SDL_ALStopSound(); @@ -1526,7 +1001,7 @@ asm cli if (!(inst->mSus | inst->cSus)) { asm popf - Quit("SDL_ALPlaySound() - Bad instrument"); + Quit(gvar, "SDL_ALPlaySound() - Bad instrument"); } SDL_AlSetFXInst(&alZeroInst); // DEBUG @@ -1535,7 +1010,7 @@ asm cli asm popf } -#if 0 +//#if 0 /////////////////////////////////////////////////////////////////////////// // // SDL_ALSoundService() - Plays the next sample out through the AdLib card @@ -1560,21 +1035,37 @@ SDL_ALSoundService(void) if (!(--alLengthLeft)) { - (long)alSound = 0; + /*(long)*/alSound = 0; alOut(alFreqH + 0,0); SDL_SoundFinished(); } } } -#endif +//#endif #if 0 +/////////////////////////////////////////////////////////////////////////// +// +// SDL_SelectMeasure() - sets up sequencing variables for a given track +// +/////////////////////////////////////////////////////////////////////////// +void +SDL_SelectMeasure(ActiveTrack *track) +{ + track->seq = track->moods[track->mood]; + track->nextevent = 0; +} +#endif + +//#if 0 void SDL_ALService(void) { byte a,v; word w; + a=v=0; + if (!sqActive) return; @@ -1596,7 +1087,7 @@ SDL_ALService(void) alTimeCount = sqHackTime = 0; } } -#endif +//#endif /////////////////////////////////////////////////////////////////////////// // @@ -1667,9 +1158,9 @@ SDL_DetectAdLib(void) status1 = readstat(); alOut(2,0xff); // Set timer 1 alOut(4,0x21); // Start timer 1 -#if 0 SDL_Delay(TimerDelay100); -#else + +#if 0 __asm { mov dx,0x388 mov cx,100 @@ -1703,19 +1194,20 @@ usecloop: return(false); } -#if 0 /////////////////////////////////////////////////////////////////////////// // // SDL_t0Service() - My timer 0 ISR which handles the different timings and // dispatches to whatever other routines are appropriate // /////////////////////////////////////////////////////////////////////////// -static void interrupt +//static void interrupt +void interrupt SDL_t0Service(void) { static word count = 1; + boolean myackflag = 0; -#if 1 // for debugging +//00#if 0 // for debugging asm mov dx,STATUS_REGISTER_1 asm in al,dx asm mov dx,ATR_INDEX @@ -1723,14 +1215,14 @@ asm mov al,ATR_OVERSCAN asm out dx,al asm mov al,4 // red asm out dx,al -#endif +//00#endif HackCount++; if ((MusicMode == smm_AdLib) || (DigiMode == sds_SoundSource)) { SDL_ALService(); - SDL_SSService(); +//SS SDL_SSService(); // if (!(++count & 7)) if (!(++count % 10)) { @@ -1773,17 +1265,33 @@ asm out dx,al } } -asm mov ax,[WORD PTR TimerCount] -asm add ax,[WORD PTR TimerDivisor] -asm mov [WORD PTR TimerCount],ax -asm jnc myack - t0OldService(); // If we overflow a word, time to call old int handler -asm jmp olddone -myack:; - outportb(0x20,0x20); // Ack the interrupt -olddone:; + __asm { + mov ax,[WORD PTR TimerCount] + add ax,[WORD PTR TimerDivisor] + mov [WORD PTR TimerCount],ax + jnc myack + jmp end1 +#ifdef __BORLANDC__ + } +#endif +myack: +#ifdef __BORLANDC__ + __asm { +#endif + mov myackflag,1 +#ifdef __BORLANDC__ + } +#endif +end1: +#ifdef __WATCOMC__ + } +#endif + if(!myackflag) + t0OldService(); // If we overflow a word, time to call old int handler + else + outportb(0x20,0x20); // Ack the interrupt -#if 1 // for debugging +//00#if 0 // for debugging asm mov dx,STATUS_REGISTER_1 asm in al,dx asm mov dx,ATR_INDEX @@ -1793,9 +1301,8 @@ asm mov al,3 // blue asm out dx,al asm mov al,0x20 // normal asm out dx,al -#endif +//00#endif } -#endif //////////////////////////////////////////////////////////////////////////// // @@ -1845,7 +1352,19 @@ SDL_StartDevice(void) } SoundNumber = SoundPriority = 0; } +#if 0 +static void +SDL_SetTimerSpeed(void) +{ + word rate; + if (MusicMode == smm_AdLib) + rate = TickBase * 8; + else + rate = TickBase * 2; + SDL_SetIntsPerSec(rate); +} +#endif // Public routines /////////////////////////////////////////////////////////////////////////// @@ -1854,12 +1373,12 @@ SDL_StartDevice(void) // /////////////////////////////////////////////////////////////////////////// boolean -SD_SetSoundMode(SDMode mode) +SD_SetSoundMode(SDMode mode, global_game_variables_t *gvar) { boolean result = false; word tableoffset; - SD_StopSound(); + SD_StopSound(gvar); #ifndef _MUSE_ if ((mode == sdm_AdLib) && !AdLibPresent) @@ -1894,7 +1413,7 @@ SD_SetSoundMode(SDMode mode) SDL_ShutDevice(); SoundMode = mode; #ifndef _MUSE_ - SoundTable = (word *)(&audiosegs[tableoffset]); + SoundTable = (word *)(&gvar->ca.audiosegs[tableoffset]); #endif SDL_StartDevice(); } @@ -1948,20 +1467,20 @@ SD_SetMusicMode(SMMode mode) // /////////////////////////////////////////////////////////////////////////// void -SD_Startup(void) +SD_Startup(global_game_variables_t *gvar) { int i; if (SD_Started) return; - SDL_SetDS(); +//?? SDL_SetDS(); ssIsTandy = false; - ssNoCheck = false; +//SS ssNoCheck = false; alNoCheck = false; - sbNoCheck = false; - sbNoProCheck = false; +//SB sbNoCheck = false; +//SB sbNoProCheck = false; #ifndef _MUSE_ for (i = 1;i < _argc;i++) { @@ -1970,30 +1489,30 @@ SD_Startup(void) case 0: // No AdLib detection alNoCheck = true; break; - case 1: // No SoundBlaster detection - sbNoCheck = true; - break; - case 2: // No SoundBlaster Pro detection - sbNoProCheck = true; - break; - case 3: - ssNoCheck = true; // No Sound Source detection - break; +//SB case 1: // No SoundBlaster detection +//SB sbNoCheck = true; +//SB break; +//SB case 2: // No SoundBlaster Pro detection +//SB sbNoProCheck = true; +//SB break; +//SS case 3: +//SS ssNoCheck = true; // No Sound Source detection +//SS break; case 4: // Tandy Sound Source handling ssIsTandy = true; break; - case 5: // Sound Source present at LPT1 - ssPort = 1; - ssNoCheck = SoundSourcePresent = true; - break; - case 6: // Sound Source present at LPT2 - ssPort = 2; - ssNoCheck = SoundSourcePresent = true; - break; - case 7: // Sound Source present at LPT3 - ssPort = 3; - ssNoCheck = SoundSourcePresent = true; - break; +//SS case 5: // Sound Source present at LPT1 +//SS ssPort = 1; +//SS ssNoCheck = SoundSourcePresent = true; +//SS break; +//SS case 6: // Sound Source present at LPT2 +//SS ssPort = 2; +//SS ssNoCheck = SoundSourcePresent = true; +//SS break; +//SS case 7: // Sound Source present at LPT3 +//SS ssPort = 3; +//SS ssNoCheck = SoundSourcePresent = true; +//SS break; } } #endif @@ -2002,85 +1521,88 @@ SD_Startup(void) t0OldService = getvect(8); // Get old timer 0 ISR + SDL_InitDelay(); // SDL_InitDelay() uses t0OldService + + setvect(8,SDL_t0Service); // Set to my timer 0 ISR LocalTime = TimeCount = alTimeCount = 0; - SD_SetSoundMode(sdm_Off); + SD_SetSoundMode(sdm_Off, gvar); SD_SetMusicMode(smm_Off); - if (!ssNoCheck) - SoundSourcePresent = SDL_DetectSoundSource(); +//SS if (!ssNoCheck) +//SS SoundSourcePresent = SDL_DetectSoundSource(); if (!alNoCheck) { AdLibPresent = SDL_DetectAdLib(); - if (AdLibPresent && !sbNoCheck) - { - int port = -1; - char *env = getenv("BLASTER"); - if (env) - { - long temp; - while (*env) - { - while (isspace(*env)) - env++; - - switch (toupper(*env)) - { - case 'A': - temp = strtol(env + 1,&env,16); - if - ( - (temp >= 0x210) - && (temp <= 0x260) - && (!(temp & 0x00f)) - ) - port = (temp - 0x200) >> 4; - else - Quit("SD_Startup: Unsupported address value in BLASTER"); - break; - case 'I': - temp = strtol(env + 1,&env,10); - if - ( - (temp >= 0) - && (temp <= 10) - && (sbIntVectors[temp] != -1) - ) - { - sbInterrupt = temp; - sbIntVec = sbIntVectors[sbInterrupt]; - } - else - Quit("SD_Startup: Unsupported interrupt value in BLASTER"); - break; - case 'D': - temp = strtol(env + 1,&env,10); - if ((temp == 0) || (temp == 1) || (temp == 3)) - SDL_SBSetDMA(temp); - else - Quit("SD_Startup: Unsupported DMA value in BLASTER"); - break; - default: - while (isspace(*env)) - env++; - while (*env && !isspace(*env)) - env++; - break; - } - } - } - SoundBlasterPresent = SDL_DetectSoundBlaster(port); - } +//SB if (AdLibPresent) && !sbNoCheck) +//SB { +//SB int port = -1; +//SB char *env = getenv("BLASTER"); +//SB if (env) +//SB { +//SB long temp; +//SB while (*env) +//SB { +//SB while (isspace(*env)) +//SB env++; +//SB +//SB switch (toupper(*env)) +//SB { +//SB case 'A': +//SB temp = strtol(env + 1,&env,16); +//SB if +//SB ( +//SB (temp >= 0x210) +//SB && (temp <= 0x260) +//SB && (!(temp & 0x00f)) +//SB ) +//SB port = (temp - 0x200) >> 4; +//SB else +//SB Quit(gvar, "SD_Startup: Unsupported address value in BLASTER"); +//SB break; +//SB case 'I': +//SB temp = strtol(env + 1,&env,10); +//SB if +//SB ( +//SB (temp >= 0) +//SB && (temp <= 10) +//SB && (sbIntVectors[temp] != -1) +//SB ) +//SB { +//SB sbInterrupt = temp; +//SB sbIntVec = sbIntVectors[sbInterrupt]; +//SB } +//SB else +//SB Quit(gvar, "SD_Startup: Unsupported interrupt value in BLASTER"); +//SB break; +//SB case 'D': +//SB temp = strtol(env + 1,&env,10); +//SB if ((temp == 0) || (temp == 1) || (temp == 3)) +//SB SDL_SBSetDMA(temp); +//SB else +//SB Quit(gvar, "SD_Startup: Unsupported DMA value in BLASTER"); +//SB break; +//SB default: +//SB while (isspace(*env)) +//SB env++; +//SB while (*env && !isspace(*env)) +//SB env++; +//SB break; +//SB } +//SB } +//SB } +//SB SoundBlasterPresent = SDL_DetectSoundBlaster(port); +//SB } } for (i = 0;i < 255;i++) pcSoundLookup[i] = i * 60; - if (SoundBlasterPresent) - SDL_StartSB(); +//SB if (SoundBlasterPresent) +//SB SDL_StartSB(); - SDL_SetupDigi(); + SDL_SetupDigi(gvar); SD_Started = true; } @@ -2092,7 +1614,7 @@ SD_Startup(void) // /////////////////////////////////////////////////////////////////////////// void -SD_Default(boolean gotit,SDMode sd,SMMode sm) +SD_Default(boolean gotit,SDMode sd,SMMode sm, global_game_variables_t *gvar) { boolean gotsd,gotsm; @@ -2115,7 +1637,7 @@ SD_Default(boolean gotit,SDMode sd,SMMode sm) sd = sdm_PC; } if (sd != SoundMode) - SD_SetSoundMode(sd); + SD_SetSoundMode(sd, gvar); if (gotsm) // Make sure requested music hardware is available @@ -2143,21 +1665,21 @@ SD_Default(boolean gotit,SDMode sd,SMMode sm) // /////////////////////////////////////////////////////////////////////////// void -SD_Shutdown(void) +SD_Shutdown(global_game_variables_t *gvar) { if (!SD_Started) return; SD_MusicOff(); - SD_StopSound(); + SD_StopSound(gvar); SDL_ShutDevice(); SDL_CleanDevice(); - if (SoundBlasterPresent) - SDL_ShutSB(); +//SB if (SoundBlasterPresent) +//SB SDL_ShutSB(); - if (SoundSourcePresent) - SDL_ShutSS(); +//SS if (SoundSourcePresent) +//SS SDL_ShutSS(); asm pushf asm cli @@ -2203,7 +1725,7 @@ SD_PositionSound(int leftvol,int rightvol) // /////////////////////////////////////////////////////////////////////////// boolean -SD_PlaySound(soundnames sound) +SD_PlaySound(soundnames sound, global_game_variables_t *gvar) { boolean ispos; SoundCommon far *s; @@ -2222,7 +1744,7 @@ SD_PlaySound(soundnames sound) s = MK_FP(SoundTable[sound],0); if ((SoundMode != sdm_Off) && !s) - Quit("SD_PlaySound() - Uncached sound"); + Quit(gvar, "SD_PlaySound() - Uncached sound"); if ((DigiMode != sds_Off) && (DigiMap[sound] != -1)) { @@ -2233,7 +1755,7 @@ SD_PlaySound(soundnames sound) SDL_PCStopSound(); - SD_PlayDigitized(DigiMap[sound],lp,rp); + SD_PlayDigitized(DigiMap[sound],lp,rp, gvar); SoundPositioned = ispos; SoundNumber = sound; SoundPriority = s->priority; @@ -2245,14 +1767,14 @@ SD_PlaySound(soundnames sound) if (DigiPriority && !DigiNumber) { asm popf - Quit("SD_PlaySound: Priority without a sound"); + Quit(gvar, "SD_PlaySound: Priority without a sound"); } asm popf if (s->priority < DigiPriority) return(false); - SD_PlayDigitized(DigiMap[sound],lp,rp); + SD_PlayDigitized(DigiMap[sound],lp,rp, gvar); SoundPositioned = ispos; DigiNumber = sound; DigiPriority = s->priority; @@ -2264,7 +1786,7 @@ SD_PlaySound(soundnames sound) if (SoundMode == sdm_Off) return(false); if (!s->length) - Quit("SD_PlaySound() - Zero length sound"); + Quit(gvar, "SD_PlaySound() - Zero length sound"); if (s->priority < SoundPriority) return(false); @@ -2274,7 +1796,7 @@ SD_PlaySound(soundnames sound) SDL_PCPlaySound((void far *)s); break; case sdm_AdLib: - SDL_ALPlaySound((void far *)s); + SDL_ALPlaySound((void far *)s, gvar); break; } @@ -2317,10 +1839,10 @@ SD_SoundPlaying(void) // /////////////////////////////////////////////////////////////////////////// void -SD_StopSound(void) +SD_StopSound(global_game_variables_t *gvar) { if (DigiPlaying) - SD_StopDigitized(); + SD_StopDigitized(gvar); switch (SoundMode) { @@ -2449,6 +1971,7 @@ SD_MusicPlaying(void) return(result); } +#if 0 // SD ASS! void SDL_SetDS() { @@ -2694,12 +2217,12 @@ void interrupt SDL_t0SlowAsmService(void) else outp(0x20,0x20); } - +#endif void SDL_IndicatePC(boolean ind) { pcindicate=ind; } - +#if 0 void SDL_DigitizedDoneInIRQ(void) { @@ -2793,4 +2316,4 @@ void alOutInIRQ(byte n,byte b) in al,dx } } - +#endif