_PAS16.H 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. /*
  2. Copyright (C) 1994-1995 Apogee Software, Ltd.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. /**********************************************************************
  16. module: _PAS16.H
  17. author: James R. Dose
  18. date: March 27, 1994
  19. Private header for for PAS16.C
  20. (c) Copyright 1994 James R. Dose. All Rights Reserved.
  21. **********************************************************************/
  22. #ifndef ___PAS16_H
  23. #define ___PAS16_H
  24. #define TRUE ( 1 == 1 )
  25. #define FALSE ( !TRUE )
  26. #define VALID ( 1 == 1 )
  27. #define INVALID ( !VALID )
  28. #define lobyte( num ) ( ( int )*( ( char * )&( num ) ) )
  29. #define hibyte( num ) ( ( int )*( ( ( char * )&( num ) ) + 1 ) )
  30. #define STEREO 1
  31. #define SIXTEEN_BIT 2
  32. #define MONO_8BIT 0
  33. #define STEREO_8BIT ( STEREO )
  34. #define MONO_16BIT ( SIXTEEN_BIT )
  35. #define STEREO_16BIT ( STEREO | SIXTEEN_BIT )
  36. #define PAS_MaxMixMode STEREO_16BIT
  37. #define MONO_8BIT_SAMPLE_SIZE 1
  38. #define MONO_16BIT_SAMPLE_SIZE 2
  39. #define STEREO_8BIT_SAMPLE_SIZE ( 2 * MONO_8BIT_SAMPLE_SIZE )
  40. #define STEREO_16BIT_SAMPLE_SIZE ( 2 * MONO_16BIT_SAMPLE_SIZE )
  41. #define PAS_RevisionBits 0xe0
  42. #define AudioFilterControl 0xb8a
  43. #define InterruptControl 0xb8b
  44. #define InterruptStatus 0xb89
  45. #define PCMDataRegister 0xf88
  46. #define CrossChannelControl 0xf8a
  47. #define SampleRateTimer 0x1388
  48. #define SampleBufferCount 0x1389
  49. #define LocalSpeakerTimerCount 0x138a
  50. #define LocalTimerControl 0x138b
  51. #define SampleSizeConfiguration 0x8389
  52. #define AudioMuteFlag 0x20
  53. #define SampleRateTimerGateFlag 0x40
  54. #define SampleBufferCountGateFlag 0x80
  55. #define SampleRateInterruptFlag 0x04
  56. #define SampleBufferInterruptFlag 0x08
  57. #define PAS_SampleSizeMask 0xf3
  58. #define PAS_SignedSampleMask 0xe3
  59. #define PAS_16BitSampleFlag 0x04
  60. #define PAS_UnsignedSampleFlag 0x10
  61. //bSC2msbinv equ 00010000b ;; invert MSB from standard method
  62. #define PAS_OverSamplingMask 0xfc
  63. #define PAS_1xOverSampling 0x00
  64. #define PAS_2xOverSampling 0x01
  65. #define PAS_4xOverSampling 0x03
  66. #define PAS_StereoFlag 0x20
  67. #define PAS_AudioMuteFlag 0x20
  68. #define DEFAULT_BASE ( 0x0388 ^ 0x388 ) /* default base I/O address */
  69. #define ALT_BASE_1 ( 0x0384 ^ 0x388 ) /* first alternate address */
  70. #define ALT_BASE_2 ( 0x038C ^ 0x388 ) /* second alternate address */
  71. #define ALT_BASE_3 ( 0x0288 ^ 0x388 ) /* third alternate address */
  72. #define PAS_DMAEnable 0x80
  73. #define PAS_ChannelConnectMask 0x0f
  74. #define PAS_PCMStartDAC 0xD0
  75. #define PAS_PCMStartADC 0xC0
  76. #define PAS_PCMStopMask 0x3f
  77. #define RECORD 0
  78. #define PLAYBACK 1
  79. #define SelectSampleRateTimer 0x36 // 00110110b
  80. #define SelectSampleBufferCount 0x74 // 01110100b
  81. #define CalcTimeInterval( rate ) \
  82. ( 1193180UL / ( rate ) )
  83. #define CalcSamplingRate( interval ) \
  84. ( 1193180UL / ( interval ) )
  85. #define MV_Signature 0x4d56
  86. #define MV_SoundInt 0x2f
  87. #define MV_CheckForDriver 0xbc00
  88. #define MV_GetVersion 0xbc01
  89. #define MV_GetPointerToStateTable 0xbc02
  90. #define MV_GetPointerToFunctionTable 0xbc03
  91. #define MV_GetDmaIrqInt 0xbc04
  92. #define MV_SendCommandStructure 0xbc05
  93. #define MV_GetDriverMessage 0xbc06
  94. #define MV_SetHotkeyScanCodes 0xbc0a
  95. #define MV_GetPathToDriver 0xbc0b
  96. #define OUTPUTMIXER 0x00 /* output mixer H/W select */
  97. #define INPUTMIXER 0x40 /* input mixer select */
  98. #define DEFMIXER -1 /* use last mixer selected */
  99. /* left channel values */
  100. #define L_FM 0x01
  101. #define L_IMIXER 0x02
  102. #define L_EXT 0x03
  103. #define L_INT 0x04
  104. #define L_MIC 0x05
  105. #define L_PCM 0x06
  106. #define L_SPEAKER 0x07
  107. #define L_FREE 0x00
  108. #define L_SBDAC 0x00
  109. /* right channel values */
  110. #define R_FM 0x08
  111. #define R_IMIXER 0x09
  112. #define R_EXT 0x0A
  113. #define R_INT 0x0B
  114. #define R_MIC 0x0C
  115. #define R_PCM 0x0D
  116. #define R_SPEAKER 0x0E
  117. #define R_FREE 0x0F
  118. #define R_SBDAC 0x0F
  119. typedef struct
  120. {
  121. unsigned char sysspkrtmr; /* 42 System Speaker Timer Address */
  122. unsigned char systmrctlr; /* 43 System Timer Control */
  123. unsigned char sysspkrreg; /* 61 System Speaker Register */
  124. unsigned char joystick; /* 201 Joystick Register */
  125. unsigned char lfmaddr; /* 388 Left FM Synth Address */
  126. unsigned char lfmdata; /* 389 Left FM Synth Data */
  127. unsigned char rfmaddr; /* 38A Right FM Synth Address */
  128. unsigned char rfmdata; /* 38B Right FM Synth Data */
  129. unsigned char dfmaddr; /* 788 Dual FM Synth Address */
  130. unsigned char dfmdata; /* 789 Dual FM Synth Data */
  131. unsigned char RESRVD1[1]; /* reserved */
  132. unsigned char paudiomixr; /* 78B Paralllel Audio Mixer Control*/
  133. unsigned char audiomixr; /* B88 Audio Mixer Control */
  134. unsigned char intrctlrst; /* B89 Interrupt Status */
  135. unsigned char audiofilt; /* B8A Audio Filter Control */
  136. unsigned char intrctlr; /* B8B Interrupt Control */
  137. unsigned char pcmdata; /* F88 PCM Data I/O Register */
  138. unsigned char RESRVD2; /* reserved */
  139. unsigned char crosschannel; /* F8A Cross Channel */
  140. unsigned char RESRVD3; /* reserved */
  141. unsigned short samplerate; /* 1388 Sample Rate Timer */
  142. unsigned short samplecnt; /* 1389 Sample Count Register */
  143. unsigned short spkrtmr; /* 138A Shadow Speaker Timer Count */
  144. unsigned char tmrctlr; /* 138B Shadow Speaker Timer Control */
  145. unsigned char mdirqvect; /* 1788 MIDI IRQ Vector Register */
  146. unsigned char mdsysctlr; /* 1789 MIDI System Control Register */
  147. unsigned char mdsysstat; /* 178A MIDI IRQ Status Register */
  148. unsigned char mdirqclr; /* 178B MIDI IRQ Clear Register */
  149. unsigned char mdgroup1; /* 1B88 MIDI Group #1 Register */
  150. unsigned char mdgroup2; /* 1B89 MIDI Group #2 Register */
  151. unsigned char mdgroup3; /* 1B8A MIDI Group #3 Register */
  152. unsigned char mdgroup4; /* 1B8B MIDI Group #4 Register */
  153. } MVState;
  154. typedef struct
  155. {
  156. unsigned long SetMixer;
  157. unsigned long SetVolume;
  158. unsigned long SetFilter;
  159. unsigned long SetCrossChannel;
  160. unsigned long GetMixer;
  161. unsigned long GetVolume;
  162. unsigned long GetFilter;
  163. unsigned long GetCrossChannel;
  164. unsigned long ReadSound;
  165. unsigned long FMSplit;
  166. } MVFunc;
  167. int PAS_CheckForDriver( void );
  168. MVState *PAS_GetStateTable( void );
  169. MVFunc *PAS_GetFunctionTable( void );
  170. int PAS_GetCardSettings( void );
  171. void PAS_EnableInterrupt( void );
  172. void PAS_DisableInterrupt( void );
  173. void interrupt far PAS_ServiceInterrupt( void );
  174. //void interrupt PAS_ServiceInterrupt( void );
  175. void PAS_Write( int Register, int Data );
  176. int PAS_Read( int Register );
  177. void PAS_SetSampleRateTimer( void );
  178. void PAS_SetSampleBufferCount( void );
  179. int PAS_SetupDMABuffer( char *BufferPtr, int BufferSize, int mode );
  180. int PAS_GetFilterSetting( int rate );
  181. void PAS_BeginTransfer( int mode );
  182. int PAS_TestAddress( int address );
  183. int PAS_FindCard( void );
  184. int PAS_CallMVFunction( unsigned long function, int ebx, int ecx, int edx );
  185. void PAS_SaveState( void );
  186. void PAS_RestoreState( void );
  187. #pragma aux PAS_TestAddress = \
  188. "mov dx, 0b8bh", \
  189. "xor dx, ax", \
  190. "in al, dx", \
  191. "cmp al, 0ffh", \
  192. "je TestExit", \
  193. "mov ah, al", \
  194. "xor al, 0e0h", \
  195. "out dx, al", \
  196. "jmp TestDelay1", \
  197. "TestDelay1:", \
  198. "jmp TestDelay2", \
  199. "TestDelay2:", \
  200. "in al, dx", \
  201. "xchg al, ah", \
  202. "out dx, al", \
  203. "sub al, ah", \
  204. "TestExit:", \
  205. "and eax, 0ffh" \
  206. parm [ eax ] modify exact [ eax dx ];
  207. #endif