⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dosgus.h

📁 这是著名的TCPMP播放器在WINDWOWS,和WINCE下编译通过的源程序.笔者对其中的LIBMAD库做了针对ARM MPU的优化. 并增加了词幕功能.
💻 H
📖 第 1 页 / 共 2 页
字号:
/*	MikMod sound library
	(c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for
	complete list.

	This library is free software; you can redistribute it and/or modify
	it under the terms of the GNU Library General Public License as
	published by the Free Software Foundation; either version 2 of
	the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Library General Public License for more details.

	You should have received a copy of the GNU Library General Public
	License along with this library; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
	02111-1307, USA.
*/

/*==============================================================================

  $Id: dosgus.h,v 1.1 2004/02/01 02:01:17 raph Exp $

  libGUS-alike definitions for DOS

==============================================================================*/

#ifndef __DOSGUS_H__
#define __DOSGUS_H__

#include <pc.h>
#include "dosdma.h"
#include "dosirq.h"
#include "libgus.h"

/* Private header file for a libGUS-alike library for DOS */

#define JOYSTICK_TIMER			(gus.port+0x201)	/* 201 */
#define JOYSTICK_DATA			(gus.port+0x201)	/* 201 */

#define GF1_MIDI_CTRL			(gus.port+0x100)	/* 3X0 */
#define GF1_MIDI_DATA			(gus.port+0x101)	/* 3X1 */

#define GF1_VOICESEL			(gus.port+0x102)	/* 3X2 */
#define GF1_REGSEL			(gus.port+0x103)	/* 3X3 */
#define GF1_DATA			(gus.port+0x104)	/* 3X4 */
#define GF1_DATA_LOW			(gus.port+0x104)	/* 3X4 */
#define GF1_DATA_HIGH			(gus.port+0x105)	/* 3X5 */
#define GF1_IRQ_STATUS			(gus.port+0x006)	/* 2X6 */
#define GF1_DRAM			(gus.port+0x107)	/* 3X7 */

#define GF1_MIX_CTRL			(gus.port+0x000)	/* 2X0 */
#define GF1_TIMER_CTRL			(gus.port+0x008)	/* 2X8 */
#define GF1_TIMER_DATA			(gus.port+0x009)	/* 2X9 */
#define GF1_IRQ_CTRL			(gus.port+0x00B)	/* 2XB */
#define GF1_REG_CTRL			(gus.port+0x00F)	/* 2XF */

#define GF1_REVISION			(gus.port+0x506)	/* 7X6 */

/* The GF1 hardware clock rate */
#define CLOCK_RATE			9878400L

/* GF1 voice-independent registers */
#define	GF1R_DMA_CONTROL		0x41
#define	GF1R_DMA_ADDRESS		0x42
#define	GF1R_DRAM_LOW			0x43
#define	GF1R_DRAM_HIGH			0x44

#define	GF1R_TIMER_CONTROL		0x45
#define	GF1R_TIMER1			0x46
#define	GF1R_TIMER2			0x47

#define	GF1R_SAMPLE_RATE		0x48
#define	GF1R_SAMPLE_CONTROL		0x49

#define	GF1R_JOYSTICK			0x4B
#define	GF1R_RESET			0x4C

/* GF1 voice-specific registers */
#define	GF1R_VOICE_CONTROL		0x00
#define	GF1R_FREQUENCY			0x01
#define	GF1R_START_HIGH			0x02
#define	GF1R_START_LOW			0x03
#define	GF1R_END_HIGH			0x04
#define	GF1R_END_LOW			0x05
#define	GF1R_VOLUME_RATE		0x06
#define	GF1R_VOLUME_START		0x07
#define	GF1R_VOLUME_END			0x08
#define	GF1R_VOLUME			0x09
#define	GF1R_ACC_HIGH			0x0a
#define	GF1R_ACC_LOW			0x0b
#define	GF1R_BALANCE			0x0c
#define	GF1R_VOLUME_CONTROL		0x0d
#define	GF1R_VOICES			0x0e
#define	GF1R_IRQ_SOURCE			0x0f

/* Add this to above registers for reading */
#define GF1R_READ_MASK			0x80

/* MIDI */
#define	GF1M_MIDI_RESET			0x03
#define	GF1M_MIDI_ENABLE_XMIT		0x20
#define	GF1M_MIDI_ENABLE_RCV		0x80

#define	GF1M_MIDI_RCV_FULL		0x01
#define	GF1M_MIDI_XMIT_EMPTY		0x02
#define	GF1M_MIDI_FRAME_ERR		0x10
#define	GF1M_MIDI_OVERRUN		0x20
#define	GF1M_MIDI_IRQ_PEND		0x80

/* Joystick */
#define	GF1M_JOY_POSITION		0x0f
#define	GF1M_JOY_BUTTONS		0xf0

/* GF1_IRQ_STATUS (port 2X6) */
#define	GF1M_IRQ_MIDI_TX		0x01	/* pending MIDI xmit IRQ */
#define	GF1M_IRQ_MIDI_RX		0x02	/* pending MIDI recv IRQ */
#define	GF1M_IRQ_TIMER1			0x04	/* general purpose timer */
#define	GF1M_IRQ_TIMER2			0x08	/* general purpose timer */
#define	GF1M_IRQ_WAVETABLE		0x20	/* pending wavetable IRQ */
#define	GF1M_IRQ_ENVELOPE		0x40	/* pending volume envelope IRQ */
#define	GF1M_IRQ_DMA_COMPLETE		0x80	/* pending dma transfer complete IRQ */

/* GF1_MIX_CTRL (port 2X0) */
#define	GF1M_MIXER_NO_LINE_IN		0x01	/* 0: enable */
#define	GF1M_MIXER_NO_OUTPUT		0x02	/* 0: enable */
#define	GF1M_MIXER_MIC_IN		0x04	/* 1: enable */
#define	GF1M_MIXER_GF1_IRQ		0x08	/* 1: enable */
#define GF1M_GF1_COMBINED_IRQ		0x10	/* 1: IRQ1 == IRQ2 */
#define	GF1M_MIDI_LOOPBACK		0x20	/* 1: enable loop back */
#define	GF1M_CONTROL_SELECT		0x40	/* 0: DMA latches; 1: IRQ latches */

/* Timer data register (2X9) */
#define GF1M_START_TIMER1		0x01
#define GF1M_START_TIMER2		0x02
#define GF1M_MASK_TIMER1		0x20
#define GF1M_MASK_TIMER2		0x40
#define GF1M_TIMER_CLRIRQ		0x80

/* IRQ/DMA control register (2XB) */
#define GF1M_IRQ_EQUAL			0x40
#define GF1M_DMA_EQUAL			0x40

/* (0x41) DMA control register bits */
#define	GF1M_DMAR_ENABLE		0x01	/* 1: go */
#define	GF1M_DMAR_READ			0x02	/* 1: read (->RAM), 0: write (->DRAM) */
#define	GF1M_DMAR_CHAN16		0x04	/* 1: 16 bit, 0: 8 bit DMA channel */
#define	GF1M_DMAR_RATE			0x18	/* 00: fast, 11: slow */
#define	GF1M_DMAR_IRQ_ENABLE		0x20	/* 1: enable */
#define	GF1M_DMAR_IRQ_PENDING		0x40	/* R: DMA irq pending */
#define	GF1M_DMAR_DATA16		0x40	/* W: 0: 8 bits; 1: 16 bits per sample */
#define	GF1M_DMAR_TOGGLE_SIGN		0x80	/* W: 1: invert high bit */

/* DMA transfer rate divisors */
#define	GF1M_DMAR_RATE0			0x00	/* Fastest DMA xfer (~650khz) */
#define	GF1M_DMAR_RATE1			0x08	/* fastest / 2 */
#define	GF1M_DMAR_RATE2			0x10	/* fastest / 4 */
#define	GF1M_DMAR_RATE3			0x18	/* Slowest DMA xfer (fastest / 8) */

/* (0x45) Timer Control */
#define GF1M_TIMER1			0x04	/* Enable timer 1 IRQ */
#define GF1M_TIMER2			0x08	/* Enable timer 2 IRQ */

/* (0x49) Sampling (ADC) control register */
#define	GF1M_DMAW_ENABLE		0x01	/* 1: Start sampling */
#define	GF1M_DMAW_MODE			0x02	/* 0: mono, 1: stereo */
#define	GF1M_DMAW_CHAN16		0x04	/* 0: 8 bit, 1: 16 bit */
#define	GF1M_DMAW_IRQ_ENABLE		0x20	/* 1: enable IRQ */
#define	GF1M_DMAW_IRQ_PENDING		0x40	/* 1: irq pending */
#define	GF1M_DMAW_TOGGLE_SIGN		0x80	/* 1: invert sign bit */

/* (0x4C) GF1 reset register */
#define	GF1M_MASTER_RESET		0x01	/* 0: hold in reset */
#define	GF1M_OUTPUT_ENABLE		0x02	/* 1: enable output */
#define	GF1M_MASTER_IRQ			0x04	/* 1: master IRQ enable */

/* (0x0,0x80) Voice control register - GF1R_VOICE_CONTROL */
#define	GF1VC_STOPPED			0x01	/* 1: voice has stopped */
#define	GF1VC_STOP			0x02	/* 1: stop voice */
#define	GF1VC_DATA16			0x04	/* 0: 8 bit, 1: 16 bit */
#define	GF1VC_LOOP_ENABLE		0x08	/* 1: enable */
#define	GF1VC_BI_LOOP			0x10	/* 1: bi directional looping */
#define	GF1VC_IRQ			0x20	/* 1: enable voice's wave irq */
#define	GF1VC_BACKWARD			0x40	/* 0: increasing, 1: decreasing */
#define	GF1VC_IRQ_PENDING		0x80	/* 1: wavetable irq pending */

/* (0x01,0x81) Frequency control */
/* Bit 0	- Unused */
/* Bits	1-9	- Fractional portion */
/* Bits	10-15	- Integer portion */

/* (0x02,0x82) Accumulator start address - GF1R_START_HIGH */
/* Bits	0-11	- HIGH 12 bits of address */
/* Bits	12-15	- Unused */

/* (0x03,0x83) Accumulator start address - GF1R_START_LOW */
/* Bits	0-4	- Unused */
/* Bits	5-8	- Fractional portion */
/* Bits	9-15	- Low 7 bits of integer portion */

/* (0x04,0x84) Accumulator end address - GF1R_END_HIGH */
/* Bits	0-11	- HIGH 12 bits of address */
/* Bits	12-15	- Unused */

/* (0x05,0x85) Accumulator end address - GF1R_END_LOW */
/* Bits	0-4	- Unused */
/* Bits	5-8	- Fractional portion */
/* Bits	9-15	- Low 7 bits of integer portion */

/* (0x06,0x86) Volume Envelope control register - GF1R_VOLUME_RATE */
#define	GF1VL_RATE_MANTISSA		0x3f
#define	GF1VL_RATE_RANGE		0xC0

/* (0x07,0x87) Volume envelope start - GF1R_VOLUME_START */
#define	GF1VL_START_MANT		0x0F
#define	GF1VL_START_EXP			0xF0

/* (0x08,0x88) Volume envelope end - GF1R_VOLUME_END */
#define	GF1VL_END_MANT			0x0F
#define	GF1VL_END_EXP			0xF0

/* (0x09,0x89) Current volume register - GF1R_VOLUME */
/* Bits	0-3	- Unused */
/* Bits	4-11	- Mantissa of current volume */
/* Bits	10-15	- Exponent of current volume */

/* (0x0A,0x8A) Accumulator value (high) */
/* Bits	0-12	- HIGH 12 bits of current position (a19-a7) */

/* (0x0B,0x8B) Accumulator value (low) */
/* Bits	0-8	- Fractional portion */
/* Bits	9-15	- Integer portion of low adress (a6-a0) */

/* (0x0C,0x8C) Pan (balance) position */
/* Bits	0-3	- Balance position 0=full left, 0x0f=full right */

/* (0x0D,0x8D) Volume control register - GF1R_VOLUME_CONTROL */
#define	GF1VL_STOPPED			0x01	/* volume has stopped */
#define	GF1VL_STOP			0x02	/* stop volume */
#define	GF1VL_ROLLOVER			0x04	/* Roll PAST end & gen IRQ */
#define	GF1VL_LOOP_ENABLE		0x08	/* 1: enable */
#define	GF1VL_BI_LOOP			0x10	/* 1: bi directional looping */
#define	GF1VL_IRQ			0x20	/* 1: enable voice's volume irq */
#define	GF1VL_BACKWARD			0x40	/* 0: increasing, 1: decreasing */
#define	GF1VL_IRQ_PENDING		0x80	/* 1: wavetable irq pending */

/* (0x0E,0x8E) Number of active voices */
/* Bits	0-5	- Number of active voices - 1 */

/* (0x0F,0x8F) Sources of IRQs */
/* Bits	0-4	- interrupting voice number */
/* Bit 5	- Always a 1 */
#define	GF1IRQ_VOLUME			0x40	/* individual voice irq bit */
#define	GF1IRQ_WAVE			0x80	/* individual waveform irq bit */

/* Commands are pooled and executed ON TIMER (1st timer) interrupt.
 * Currently there is a limit on the number of commands that you can

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -