1 | /* |
2 | * GUSEMU32 - persistent GUS register state |
3 | * |
4 | * Copyright (C) 2000-2007 Tibor "TS" Schütz |
5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | * of this software and associated documentation files (the "Software"), to deal |
8 | * in the Software without restriction, including without limitation the rights |
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 | * copies of the Software, and to permit persons to whom the Software is |
11 | * furnished to do so, subject to the following conditions: |
12 | * |
13 | * The above copyright notice and this permission notice shall be included in |
14 | * all copies or substantial portions of the Software. |
15 | * |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
22 | * THE SOFTWARE. |
23 | */ |
24 | |
25 | #ifndef GUSTATE_H |
26 | #define GUSTATE_H |
27 | |
28 | /*state block offset*/ |
29 | #define gusdata (0) |
30 | |
31 | /* data stored using this structure is in host byte order! */ |
32 | |
33 | /*access type*/ |
34 | #define PortRead (0) |
35 | #define PortWrite (1) |
36 | |
37 | #define Port8Bitacc (0) |
38 | #define Port16Bitacc (1) |
39 | |
40 | /*voice register offsets (in bytes)*/ |
41 | #define VSRegs (0) |
42 | #define VSRControl (0) |
43 | #define VSRegsEnd (VSRControl+VSRegs + 32*(16*2)) |
44 | #define VSRFreq (2) |
45 | #define VSRLoopStartHi (4) |
46 | #define VSRLoopStartLo (6) |
47 | #define VSRLoopEndHi (8) |
48 | #define VSRLoopEndLo (10) |
49 | #define VSRVolRampRate (12) |
50 | #define VSRVolRampStartVol (14) |
51 | #define VSRVolRampEndVol (16) |
52 | #define VSRCurrVol (18) |
53 | #define VSRCurrPosHi (20) |
54 | #define VSRCurrPosLo (22) |
55 | #define VSRPanning (24) |
56 | #define VSRVolRampControl (26) |
57 | |
58 | /*voice register offsets (in words)*/ |
59 | #define wVSRegs (0) |
60 | #define wVSRControl (0) |
61 | #define wVSRegsEnd (wVSRControl+wVSRegs + 32*(16)) |
62 | #define wVSRFreq (1) |
63 | #define wVSRLoopStartHi (2) |
64 | #define wVSRLoopStartLo (3) |
65 | #define wVSRLoopEndHi (4) |
66 | #define wVSRLoopEndLo (5) |
67 | #define wVSRVolRampRate (6) |
68 | #define wVSRVolRampStartVol (7) |
69 | #define wVSRVolRampEndVol (8) |
70 | #define wVSRCurrVol (9) |
71 | #define wVSRCurrPosHi (10) |
72 | #define wVSRCurrPosLo (11) |
73 | #define wVSRPanning (12) |
74 | #define wVSRVolRampControl (13) |
75 | |
76 | /*GUS register state block: 32 voices, padding filled with remaining registers*/ |
77 | #define DataRegLoByte3x4 (VSRVolRampControl+2) |
78 | #define DataRegWord3x4 (DataRegLoByte3x4) |
79 | #define DataRegHiByte3x5 (VSRVolRampControl+2 +1) |
80 | #define DMA_2xB (VSRVolRampControl+2+2) |
81 | #define IRQ_2xB (VSRVolRampControl+2+3) |
82 | |
83 | #define RegCtrl_2xF (VSRVolRampControl+2+(16*2)) |
84 | #define Jumper_2xB (VSRVolRampControl+2+(16*2)+1) |
85 | #define GUS42DMAStart (VSRVolRampControl+2+(16*2)+2) |
86 | |
87 | #define GUS43DRAMIOlo (VSRVolRampControl+2+(16*2)*2) |
88 | #define GUSDRAMPOS24bit (GUS43DRAMIOlo) |
89 | #define GUS44DRAMIOhi (VSRVolRampControl+2+(16*2)*2+2) |
90 | |
91 | #define voicewavetableirq (VSRVolRampControl+2+(16*2)*3) /* voice IRQ pseudoqueue: 1 bit per voice */ |
92 | |
93 | #define voicevolrampirq (VSRVolRampControl+2+(16*2)*4) /* voice IRQ pseudoqueue: 1 bit per voice */ |
94 | |
95 | #define startvoices (VSRVolRampControl+2+(16*2)*5) /* statistics / optimizations */ |
96 | |
97 | #define IRQStatReg2x6 (VSRVolRampControl+2+(16*2)*6) |
98 | #define TimerStatus2x8 (VSRVolRampControl+2+(16*2)*6+1) |
99 | #define TimerDataReg2x9 (VSRVolRampControl+2+(16*2)*6+2) |
100 | #define MixerCtrlReg2x0 (VSRVolRampControl+2+(16*2)*6+3) |
101 | |
102 | #define VoiceSelReg3x2 (VSRVolRampControl+2+(16*2)*7) |
103 | #define FunkSelReg3x3 (VSRVolRampControl+2+(16*2)*7+1) |
104 | #define AdLibStatus2x8 (VSRVolRampControl+2+(16*2)*7+2) |
105 | #define StatRead_2xF (VSRVolRampControl+2+(16*2)*7+3) |
106 | |
107 | #define GUS48SampSpeed (VSRVolRampControl+2+(16*2)*8) |
108 | #define GUS41DMACtrl (VSRVolRampControl+2+(16*2)*8+1) |
109 | #define GUS45TimerCtrl (VSRVolRampControl+2+(16*2)*8+2) |
110 | #define GUS46Counter1 (VSRVolRampControl+2+(16*2)*8+3) |
111 | |
112 | #define GUS47Counter2 (VSRVolRampControl+2+(16*2)*9) |
113 | #define GUS49SampCtrl (VSRVolRampControl+2+(16*2)*9+1) |
114 | #define GUS4cReset (VSRVolRampControl+2+(16*2)*9+2) |
115 | #define NumVoices (VSRVolRampControl+2+(16*2)*9+3) |
116 | |
117 | #define TimerIRQs (VSRVolRampControl+2+(16*2)*10) /* delayed IRQ, statistics */ |
118 | #define BusyTimerIRQs (VSRVolRampControl+2+(16*2)*10+2) /* delayed IRQ, statistics */ |
119 | |
120 | #define AdLibCommand2xA (VSRVolRampControl+2+(16*2)*11) |
121 | #define AdLibData2x9 (VSRVolRampControl+2+(16*2)*11+1) |
122 | #define SB2xCd (VSRVolRampControl+2+(16*2)*11+2) |
123 | #define SB2xE (VSRVolRampControl+2+(16*2)*11+3) |
124 | |
125 | #define SynVoiceIRQ8f (VSRVolRampControl+2+(16*2)*12) |
126 | #define GUS50DMAHigh (VSRVolRampControl+2+(16*2)*12+1) |
127 | |
128 | #define portaccesses (VSRegsEnd) /* statistics / suspend mode */ |
129 | |
130 | #define gusdataend (VSRegsEnd+4) |
131 | |
132 | #endif /* GUSTATE_H */ |
133 | |