dosgus.h
上传用户:wstnjxml
上传日期:2014-04-03
资源大小:7248k
文件大小:18k
源码类别:

Windows CE

开发平台:

C/C++

  1. /* MikMod sound library
  2. (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for
  3. complete list.
  4. This library is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of
  7. the License, or (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. GNU Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  15. 02111-1307, USA.
  16. */
  17. /*==============================================================================
  18.   $Id: dosgus.h,v 1.1 2004/02/01 02:01:17 raph Exp $
  19.   libGUS-alike definitions for DOS
  20. ==============================================================================*/
  21. #ifndef __DOSGUS_H__
  22. #define __DOSGUS_H__
  23. #include <pc.h>
  24. #include "dosdma.h"
  25. #include "dosirq.h"
  26. #include "libgus.h"
  27. /* Private header file for a libGUS-alike library for DOS */
  28. #define JOYSTICK_TIMER (gus.port+0x201) /* 201 */
  29. #define JOYSTICK_DATA (gus.port+0x201) /* 201 */
  30. #define GF1_MIDI_CTRL (gus.port+0x100) /* 3X0 */
  31. #define GF1_MIDI_DATA (gus.port+0x101) /* 3X1 */
  32. #define GF1_VOICESEL (gus.port+0x102) /* 3X2 */
  33. #define GF1_REGSEL (gus.port+0x103) /* 3X3 */
  34. #define GF1_DATA (gus.port+0x104) /* 3X4 */
  35. #define GF1_DATA_LOW (gus.port+0x104) /* 3X4 */
  36. #define GF1_DATA_HIGH (gus.port+0x105) /* 3X5 */
  37. #define GF1_IRQ_STATUS (gus.port+0x006) /* 2X6 */
  38. #define GF1_DRAM (gus.port+0x107) /* 3X7 */
  39. #define GF1_MIX_CTRL (gus.port+0x000) /* 2X0 */
  40. #define GF1_TIMER_CTRL (gus.port+0x008) /* 2X8 */
  41. #define GF1_TIMER_DATA (gus.port+0x009) /* 2X9 */
  42. #define GF1_IRQ_CTRL (gus.port+0x00B) /* 2XB */
  43. #define GF1_REG_CTRL (gus.port+0x00F) /* 2XF */
  44. #define GF1_REVISION (gus.port+0x506) /* 7X6 */
  45. /* The GF1 hardware clock rate */
  46. #define CLOCK_RATE 9878400L
  47. /* GF1 voice-independent registers */
  48. #define GF1R_DMA_CONTROL 0x41
  49. #define GF1R_DMA_ADDRESS 0x42
  50. #define GF1R_DRAM_LOW 0x43
  51. #define GF1R_DRAM_HIGH 0x44
  52. #define GF1R_TIMER_CONTROL 0x45
  53. #define GF1R_TIMER1 0x46
  54. #define GF1R_TIMER2 0x47
  55. #define GF1R_SAMPLE_RATE 0x48
  56. #define GF1R_SAMPLE_CONTROL 0x49
  57. #define GF1R_JOYSTICK 0x4B
  58. #define GF1R_RESET 0x4C
  59. /* GF1 voice-specific registers */
  60. #define GF1R_VOICE_CONTROL 0x00
  61. #define GF1R_FREQUENCY 0x01
  62. #define GF1R_START_HIGH 0x02
  63. #define GF1R_START_LOW 0x03
  64. #define GF1R_END_HIGH 0x04
  65. #define GF1R_END_LOW 0x05
  66. #define GF1R_VOLUME_RATE 0x06
  67. #define GF1R_VOLUME_START 0x07
  68. #define GF1R_VOLUME_END 0x08
  69. #define GF1R_VOLUME 0x09
  70. #define GF1R_ACC_HIGH 0x0a
  71. #define GF1R_ACC_LOW 0x0b
  72. #define GF1R_BALANCE 0x0c
  73. #define GF1R_VOLUME_CONTROL 0x0d
  74. #define GF1R_VOICES 0x0e
  75. #define GF1R_IRQ_SOURCE 0x0f
  76. /* Add this to above registers for reading */
  77. #define GF1R_READ_MASK 0x80
  78. /* MIDI */
  79. #define GF1M_MIDI_RESET 0x03
  80. #define GF1M_MIDI_ENABLE_XMIT 0x20
  81. #define GF1M_MIDI_ENABLE_RCV 0x80
  82. #define GF1M_MIDI_RCV_FULL 0x01
  83. #define GF1M_MIDI_XMIT_EMPTY 0x02
  84. #define GF1M_MIDI_FRAME_ERR 0x10
  85. #define GF1M_MIDI_OVERRUN 0x20
  86. #define GF1M_MIDI_IRQ_PEND 0x80
  87. /* Joystick */
  88. #define GF1M_JOY_POSITION 0x0f
  89. #define GF1M_JOY_BUTTONS 0xf0
  90. /* GF1_IRQ_STATUS (port 2X6) */
  91. #define GF1M_IRQ_MIDI_TX 0x01 /* pending MIDI xmit IRQ */
  92. #define GF1M_IRQ_MIDI_RX 0x02 /* pending MIDI recv IRQ */
  93. #define GF1M_IRQ_TIMER1 0x04 /* general purpose timer */
  94. #define GF1M_IRQ_TIMER2 0x08 /* general purpose timer */
  95. #define GF1M_IRQ_WAVETABLE 0x20 /* pending wavetable IRQ */
  96. #define GF1M_IRQ_ENVELOPE 0x40 /* pending volume envelope IRQ */
  97. #define GF1M_IRQ_DMA_COMPLETE 0x80 /* pending dma transfer complete IRQ */
  98. /* GF1_MIX_CTRL (port 2X0) */
  99. #define GF1M_MIXER_NO_LINE_IN 0x01 /* 0: enable */
  100. #define GF1M_MIXER_NO_OUTPUT 0x02 /* 0: enable */
  101. #define GF1M_MIXER_MIC_IN 0x04 /* 1: enable */
  102. #define GF1M_MIXER_GF1_IRQ 0x08 /* 1: enable */
  103. #define GF1M_GF1_COMBINED_IRQ 0x10 /* 1: IRQ1 == IRQ2 */
  104. #define GF1M_MIDI_LOOPBACK 0x20 /* 1: enable loop back */
  105. #define GF1M_CONTROL_SELECT 0x40 /* 0: DMA latches; 1: IRQ latches */
  106. /* Timer data register (2X9) */
  107. #define GF1M_START_TIMER1 0x01
  108. #define GF1M_START_TIMER2 0x02
  109. #define GF1M_MASK_TIMER1 0x20
  110. #define GF1M_MASK_TIMER2 0x40
  111. #define GF1M_TIMER_CLRIRQ 0x80
  112. /* IRQ/DMA control register (2XB) */
  113. #define GF1M_IRQ_EQUAL 0x40
  114. #define GF1M_DMA_EQUAL 0x40
  115. /* (0x41) DMA control register bits */
  116. #define GF1M_DMAR_ENABLE 0x01 /* 1: go */
  117. #define GF1M_DMAR_READ 0x02 /* 1: read (->RAM), 0: write (->DRAM) */
  118. #define GF1M_DMAR_CHAN16 0x04 /* 1: 16 bit, 0: 8 bit DMA channel */
  119. #define GF1M_DMAR_RATE 0x18 /* 00: fast, 11: slow */
  120. #define GF1M_DMAR_IRQ_ENABLE 0x20 /* 1: enable */
  121. #define GF1M_DMAR_IRQ_PENDING 0x40 /* R: DMA irq pending */
  122. #define GF1M_DMAR_DATA16 0x40 /* W: 0: 8 bits; 1: 16 bits per sample */
  123. #define GF1M_DMAR_TOGGLE_SIGN 0x80 /* W: 1: invert high bit */
  124. /* DMA transfer rate divisors */
  125. #define GF1M_DMAR_RATE0 0x00 /* Fastest DMA xfer (~650khz) */
  126. #define GF1M_DMAR_RATE1 0x08 /* fastest / 2 */
  127. #define GF1M_DMAR_RATE2 0x10 /* fastest / 4 */
  128. #define GF1M_DMAR_RATE3 0x18 /* Slowest DMA xfer (fastest / 8) */
  129. /* (0x45) Timer Control */
  130. #define GF1M_TIMER1 0x04 /* Enable timer 1 IRQ */
  131. #define GF1M_TIMER2 0x08 /* Enable timer 2 IRQ */
  132. /* (0x49) Sampling (ADC) control register */
  133. #define GF1M_DMAW_ENABLE 0x01 /* 1: Start sampling */
  134. #define GF1M_DMAW_MODE 0x02 /* 0: mono, 1: stereo */
  135. #define GF1M_DMAW_CHAN16 0x04 /* 0: 8 bit, 1: 16 bit */
  136. #define GF1M_DMAW_IRQ_ENABLE 0x20 /* 1: enable IRQ */
  137. #define GF1M_DMAW_IRQ_PENDING 0x40 /* 1: irq pending */
  138. #define GF1M_DMAW_TOGGLE_SIGN 0x80 /* 1: invert sign bit */
  139. /* (0x4C) GF1 reset register */
  140. #define GF1M_MASTER_RESET 0x01 /* 0: hold in reset */
  141. #define GF1M_OUTPUT_ENABLE 0x02 /* 1: enable output */
  142. #define GF1M_MASTER_IRQ 0x04 /* 1: master IRQ enable */
  143. /* (0x0,0x80) Voice control register - GF1R_VOICE_CONTROL */
  144. #define GF1VC_STOPPED 0x01 /* 1: voice has stopped */
  145. #define GF1VC_STOP 0x02 /* 1: stop voice */
  146. #define GF1VC_DATA16 0x04 /* 0: 8 bit, 1: 16 bit */
  147. #define GF1VC_LOOP_ENABLE 0x08 /* 1: enable */
  148. #define GF1VC_BI_LOOP 0x10 /* 1: bi directional looping */
  149. #define GF1VC_IRQ 0x20 /* 1: enable voice's wave irq */
  150. #define GF1VC_BACKWARD 0x40 /* 0: increasing, 1: decreasing */
  151. #define GF1VC_IRQ_PENDING 0x80 /* 1: wavetable irq pending */
  152. /* (0x01,0x81) Frequency control */
  153. /* Bit 0 - Unused */
  154. /* Bits 1-9 - Fractional portion */
  155. /* Bits 10-15 - Integer portion */
  156. /* (0x02,0x82) Accumulator start address - GF1R_START_HIGH */
  157. /* Bits 0-11 - HIGH 12 bits of address */
  158. /* Bits 12-15 - Unused */
  159. /* (0x03,0x83) Accumulator start address - GF1R_START_LOW */
  160. /* Bits 0-4 - Unused */
  161. /* Bits 5-8 - Fractional portion */
  162. /* Bits 9-15 - Low 7 bits of integer portion */
  163. /* (0x04,0x84) Accumulator end address - GF1R_END_HIGH */
  164. /* Bits 0-11 - HIGH 12 bits of address */
  165. /* Bits 12-15 - Unused */
  166. /* (0x05,0x85) Accumulator end address - GF1R_END_LOW */
  167. /* Bits 0-4 - Unused */
  168. /* Bits 5-8 - Fractional portion */
  169. /* Bits 9-15 - Low 7 bits of integer portion */
  170. /* (0x06,0x86) Volume Envelope control register - GF1R_VOLUME_RATE */
  171. #define GF1VL_RATE_MANTISSA 0x3f
  172. #define GF1VL_RATE_RANGE 0xC0
  173. /* (0x07,0x87) Volume envelope start - GF1R_VOLUME_START */
  174. #define GF1VL_START_MANT 0x0F
  175. #define GF1VL_START_EXP 0xF0
  176. /* (0x08,0x88) Volume envelope end - GF1R_VOLUME_END */
  177. #define GF1VL_END_MANT 0x0F
  178. #define GF1VL_END_EXP 0xF0
  179. /* (0x09,0x89) Current volume register - GF1R_VOLUME */
  180. /* Bits 0-3 - Unused */
  181. /* Bits 4-11 - Mantissa of current volume */
  182. /* Bits 10-15 - Exponent of current volume */
  183. /* (0x0A,0x8A) Accumulator value (high) */
  184. /* Bits 0-12 - HIGH 12 bits of current position (a19-a7) */
  185. /* (0x0B,0x8B) Accumulator value (low) */
  186. /* Bits 0-8 - Fractional portion */
  187. /* Bits 9-15 - Integer portion of low adress (a6-a0) */
  188. /* (0x0C,0x8C) Pan (balance) position */
  189. /* Bits 0-3 - Balance position 0=full left, 0x0f=full right */
  190. /* (0x0D,0x8D) Volume control register - GF1R_VOLUME_CONTROL */
  191. #define GF1VL_STOPPED 0x01 /* volume has stopped */
  192. #define GF1VL_STOP 0x02 /* stop volume */
  193. #define GF1VL_ROLLOVER 0x04 /* Roll PAST end & gen IRQ */
  194. #define GF1VL_LOOP_ENABLE 0x08 /* 1: enable */
  195. #define GF1VL_BI_LOOP 0x10 /* 1: bi directional looping */
  196. #define GF1VL_IRQ 0x20 /* 1: enable voice's volume irq */
  197. #define GF1VL_BACKWARD 0x40 /* 0: increasing, 1: decreasing */
  198. #define GF1VL_IRQ_PENDING 0x80 /* 1: wavetable irq pending */
  199. /* (0x0E,0x8E) Number of active voices */
  200. /* Bits 0-5 - Number of active voices - 1 */
  201. /* (0x0F,0x8F) Sources of IRQs */
  202. /* Bits 0-4 - interrupting voice number */
  203. /* Bit 5 - Always a 1 */
  204. #define GF1IRQ_VOLUME 0x40 /* individual voice irq bit */
  205. #define GF1IRQ_WAVE 0x80 /* individual waveform irq bit */
  206. /* Commands are pooled and executed ON TIMER (1st timer) interrupt.
  207.  * Currently there is a limit on the number of commands that you can
  208.  * issue between gus_do_flush (...); this should not be an issue however
  209.  * because each voice has a limited (little) set of parameters that
  210.  * you can change (freq, vol, pan... what else?)
  211.  *
  212.  * The pool is a pseudo-CPU code that gets executed once per timer interrupt.
  213.  */
  214. /* Below are definitions for commands placed in GUS command pool */
  215. #define PCMD_NOP 0x00 /* Traditionally ... */
  216. #define PCMD_VOICE 0x01 /* +B: select voice */
  217. #define PCMD_START 0x02 /* +L: start voice */
  218. #define PCMD_STOP 0x03 /*     stop voice */
  219. #define PCMD_FREQ 0x04 /* +W: set frequence */
  220. #define PCMD_VOLUME 0x05 /* +W: set volume */
  221. #define PCMD_VOLUME_PREPARE 0x06 /* +W: prepare to set volume on (soon to follow) kick */
  222. #define PCMD_PAN 0x07 /* +B: set panning */
  223. #define PCMD_OFFSET 0x08 /* +L: set DRAM offset */
  224. #define PCMD_STOP_LOOP 0x09 /*     stop looping */
  225. #define GUS_VOLCHANGE_RAMP 0x20 /* Volume change ramp speed */
  226. /* Definition for the boolean type */
  227. typedef unsigned char boolean;
  228. /* Prototype for functions that do block transfers to GUS DRAM:
  229.    flags can contain any of the following bits:
  230.       GUS_WAVE_16BIT    - sample is 16-bit
  231.       GUS_WAVE_UNSIGNED - do not invert sign bit while downloading
  232.  */
  233. typedef void (*__gus_transfer_func) (unsigned long address,
  234.                                      unsigned char *source,
  235.                                      unsigned long size, int flags);
  236. typedef void (*__gus_callback) ();
  237. typedef void (*__gus_callback_3) (unsigned int, unsigned int, unsigned int);
  238. /* Structure used to keep track of all on-board GUS memory */
  239. typedef struct __struct_gus_mcb {
  240. struct __struct_gus_mcb *next; /* Next MCB in chain */
  241. struct __struct_gus_mcb *prev; /* Previous MCB in chain */
  242. unsigned int addr; /* GUS DRAM address */
  243. unsigned int size; /* Memory block size */
  244. int free; /* 1: block is free */
  245. } __gus_mcb;
  246. /* Structure defining overall GUS state/information */
  247. typedef struct {
  248. unsigned int port; /* Base I/O port (0x220, 0x240, ...) */
  249. unsigned int irq[2]; /* GF1 IRQ and MIDI IRQ */
  250. unsigned int dma[2]; /* Play / record DMA */
  251. unsigned int ram; /* Memory size (K), i.e. 256, 1024 etc */
  252. unsigned int version; /* GUS version (see GUS_CARD_VERSION_XXX in libgus.h */
  253. unsigned int freq; /* Current mixing frequency */
  254. unsigned int voices; /* Active voices (14-32) */
  255. unsigned int dynmask; /* Dynamically allocated voices mask */
  256. unsigned int timer_base; /* The relative timer speed in percents (def: 100) */
  257. volatile unsigned int t1_ticks; /* Incremented per each timer1 tick */
  258. volatile unsigned int t2_ticks; /* Incremented per each timer2 tick */
  259. volatile unsigned int t1_countdown; /* t1_callback is called when this reaches zero */
  260. volatile unsigned int t2_countdown; /* t2_callback is called when this reaches zero */
  261. unsigned int t1_multiple; /* Timer1 handler is called once per such many ticks */
  262. unsigned int t2_multiple; /* Timer2 handler is called once per such many ticks */
  263. irq_handle *gf1_irq; /* The interrupt handler for GF1 events */
  264. dma_buffer *dma_buff; /* Pre-allocated DMA buffer */
  265. __gus_callback dma_callback; /* Routine called at end of DMA transfers */
  266. __gus_callback t1_callback; /* Routine called on Timer1 events */
  267. __gus_callback t2_callback; /* Routine called on Timer1 events */
  268. __gus_callback timer_callback; /* Called once per TEMPO ticks */
  269. __gus_callback_3 wt_callback; /* Routine called on WaveTable events */
  270. __gus_callback_3 vl_callback; /* Routine called on Volume ramp events */
  271. __gus_mcb *mcb; /* Chained list of memory control blocks */
  272. __gus_transfer_func transfer; /* Best working function for DRAM transfer */
  273. gus_instrument_t *instr; /* The list of registered instruments */
  274. unsigned short mixer; /* Current mixer register state */
  275. unsigned char dma_rate; /* One of GF1M_DMAR_RATEX constants defined above */
  276. unsigned char timer_ctl; /* Timer control register value (2x8/2x9) */
  277. unsigned char timer_ctl_reg; /* Timer control register value (GF1/0x45) */
  278. boolean ok; /* Is the information below okay? */
  279. boolean open; /* 1 if between gus_open() and gus_close() */
  280. boolean ics; /* Is it equipped with an ICS mixer? */
  281. boolean ics_flipped; /* rev 5 (3.7) has flipped R/L mixer */
  282. boolean codec; /* Is it equipped with a GUS MAX codec? */
  283. boolean interwave; /* GUS InterWave card */
  284. volatile boolean dma_active; /* DMA is transferring data */
  285. volatile boolean cmd_pool_ready; /* Flush cmd_pool during timer interrupt */
  286. unsigned char cmd_voice; /* Pool selection index cache */
  287. unsigned int cmd_pool_top; /* Command pool top */
  288. unsigned char *cmd_pool; /* Async commands pool */
  289. /* The following data is for private use only by interrupt routines! */
  290. gus_wave_t *cur_wave[32]; /* Currently played waves */
  291. boolean voice_kick[32]; /* Kick wave on next volume ramp IRQ */
  292. unsigned int kick_offs[32]; /* Sample start position on kick */
  293. unsigned short cur_vol[32]; /* Current voice volumes */
  294. unsigned int cur_voice; /* Current voice */
  295. unsigned int eow_ignore; /* Temp ignore end-of-wave IRQ for these voices */
  296. } __gus_state;
  297. extern __gus_state gus;
  298. extern void __gus_delay();
  299. static unsigned long __gus_convert_addr16(unsigned long address)
  300. {
  301. return ((address & 0x0003ffff) >> 1) | (address & ~0x0003ffff);
  302. }
  303. /* The XXX_slow routines cannot be used outside IRQ handler! */
  304. static inline void __gus_outregb_slow(unsigned char reg, unsigned char value)
  305. {
  306. outportb(GF1_REGSEL, reg);
  307. outportb(GF1_DATA_HIGH, value);
  308. __gus_delay();
  309. outportb(GF1_DATA_HIGH, value);
  310. }
  311. static inline void __gus_outregw_slow(unsigned char reg, unsigned short value)
  312. {
  313. outportb(GF1_REGSEL, reg);
  314. outportw(GF1_DATA, value);
  315. __gus_delay();
  316. outportw(GF1_DATA, value);
  317. }
  318. static inline void __gus_outregb(unsigned char reg, unsigned char value)
  319. {
  320. outportb(GF1_REGSEL, reg);
  321. outportb(GF1_DATA_HIGH, value);
  322. }
  323. static inline void __gus_outregw(unsigned char reg, unsigned short value)
  324. {
  325. outportb(GF1_REGSEL, reg);
  326. outportw(GF1_DATA, value);
  327. }
  328. static inline unsigned char __gus_inregb(unsigned char reg)
  329. {
  330. if (reg < 0x10)
  331. reg |= GF1R_READ_MASK;
  332. outportb(GF1_REGSEL, reg);
  333. return inportb(GF1_DATA_HIGH);
  334. }
  335. static inline unsigned short __gus_inregw(unsigned char reg)
  336. {
  337. if (reg < 0x10)
  338. reg |= GF1R_READ_MASK;
  339. outportb(GF1_REGSEL, reg);
  340. return inportw(GF1_DATA);
  341. }
  342. static inline void __gus_set_dram_address(unsigned int address)
  343. {
  344. __gus_outregb(GF1R_DRAM_HIGH, address >> 16);
  345. __gus_outregw(GF1R_DRAM_LOW, address);
  346. }
  347. static inline unsigned char __gus_peek(unsigned int address)
  348. {
  349. __gus_set_dram_address(address);
  350. return inportb(GF1_DRAM);
  351. }
  352. static inline void __gus_poke(unsigned int address, unsigned char value)
  353. {
  354. __gus_set_dram_address(address);
  355. outportb(GF1_DRAM, value);
  356. }
  357. static inline void __gus_select_voice(unsigned char voice)
  358. {
  359. outportb(GF1_VOICESEL, voice);
  360. }
  361. static inline void __gus_set_current(unsigned char mode,
  362.                                      unsigned long address)
  363. {
  364. if (mode & GF1VC_DATA16)
  365. address = __gus_convert_addr16(address);
  366. __gus_outregw_slow(GF1R_ACC_HIGH, address >> 11);
  367. __gus_outregw_slow(GF1R_ACC_LOW, address << 5);
  368. }
  369. static inline void __gus_set_loop_start(unsigned char mode,
  370. unsigned long address)
  371. {
  372. if (mode & GF1VC_DATA16)
  373. address = __gus_convert_addr16(address);
  374. __gus_outregw_slow(GF1R_START_HIGH, address >> 11);
  375. __gus_outregw_slow(GF1R_START_LOW, address << 5);
  376. }
  377. static inline void __gus_set_loop_end(unsigned char mode,
  378.                                       unsigned long address)
  379. {
  380. address--;
  381. if (mode & GF1VC_DATA16)
  382. address = __gus_convert_addr16(address);
  383. __gus_outregw_slow(GF1R_END_HIGH, address >> 11);
  384. __gus_outregw_slow(GF1R_END_LOW, address << 5);
  385. }
  386. static inline void __gus_mixer_output(boolean state)
  387. {
  388. if (state)
  389. gus.mixer &= ~GF1M_MIXER_NO_OUTPUT;
  390. else
  391. gus.mixer |= GF1M_MIXER_NO_OUTPUT;
  392. outportb(GF1_MIX_CTRL, gus.mixer);
  393. /* Dummy read to avoid touching DMA latches */
  394. __gus_inregb(GF1R_BALANCE);
  395. }
  396. /* Inline routines for working with command pools */
  397. /* WARNING: no bounds checking due to performance reasons */
  398. #define __POOL_VALUE(type,value)
  399.   *((unsigned type *)&gus.cmd_pool [gus.cmd_pool_top]) = value;
  400.   gus.cmd_pool_top += sizeof (type);
  401. static inline void __pool_command(unsigned char command)
  402. {
  403. __POOL_VALUE(char, command);
  404. }
  405. static inline void __pool_command_b(unsigned char command, unsigned char arg)
  406. {
  407. __POOL_VALUE(char, command);
  408. __POOL_VALUE(char, arg);
  409. }
  410. static inline void __pool_command_w(unsigned char command, unsigned short arg)
  411. {
  412. __POOL_VALUE(char, command);
  413. __POOL_VALUE(short, arg);
  414. }
  415. static inline void __pool_command_l(unsigned char command, unsigned long arg)
  416. {
  417. __POOL_VALUE(char, command);
  418. __POOL_VALUE(long, arg);
  419. }
  420. static inline void __pool_select_voice(unsigned char voice)
  421. {
  422. if (gus.cmd_voice != voice)
  423. __pool_command_b(PCMD_VOICE, gus.cmd_voice = voice);
  424. }
  425. #undef __POOL_VALUE
  426. #ifdef DEBUG
  427. /* Debug dump of GUS DRAM heap */
  428. extern void __gus_mem_dump();
  429. #endif
  430. #endif /* __DOSGUS_H__ */
  431. /* ex:set ts=4: */