demOS

- Main Page
- Modules
- Data Structures
- Files

- File List

All Data Structures Files Modules Pages
HARDWARE.H
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------ -----------------
2 Copyright J.Hubert 2015
3
4 This file is part of demOS
5
6 demOS is free software: you can redistribute it and/or modify it under the terms of
7 the GNU Lesser General Public License as published by the Free Software Foundation,
8 either version 3 of the License, or (at your option) any later version.
9
10 demOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ;
11 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 See the GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License along with demOS.
15 If not, see <http://www.gnu.org/licenses/>.
16 ------------------------------------------------------------------------------------------------- */
17
26 #ifndef HARDWARE_H
27 #define HARDWARE_H
28
29 #include "DEMOSDK\BASTYPES.H"
30
31 #define HW_BLACK 0x000
32 #define HW_LIGHT_RED 0xF00
33 #define HW_LIGHT_GREEN 0x0F0
34 #define HW_LIGHT_BLUE 0x00F
35 #define HW_RED 0x400
36 #define HW_GREEN 0x040
37 #define HW_BLUE 0x004
38 #define HW_DARK_RED 0x200
39 #define HW_DARK_GREEN 0x020
40 #define HW_DARK_BLUE 0x002
41 #define HW_YELLOW 0x0FF
42 #define HW_MAGENTA 0xF0F
43 #define HW_CYAN 0x0FF
44 #define HW_ORANGE 0x4F0
45 #define HW_WHITE 0xFFF
46
47 #define HW_YM_SEL_FREQCHA_L 0
48 #define HW_YM_SEL_FREQCHA_H 1
49 #define HW_YM_SEL_FREQCHB_L 2
50 #define HW_YM_SEL_FREQCHB_H 3
51 #define HW_YM_SEL_FREQCHC_L 4
52 #define HW_YM_SEL_FREQCHC_H 5
53 #define HW_YM_SEL_FREQNOISE 6
54 #define HW_YM_SEL_IO_AND_MIXER 7
55 #define HW_YM_SEL_LEVELCHA 8
56 #define HW_YM_SEL_LEVELCHB 9
57 #define HW_YM_SEL_LEVELCHC 10
58 #define HW_YM_SEL_FREQENVELOPE_L 11
59 #define HW_YM_SEL_FREQENVELOPE_H 12
60 #define HW_YM_SEL_ENVELOPESHAPE 13
61 #define HW_YM_SEL_IO_PORTA 14
62 #define HW_YM_SEL_IO_PORTB 15
63
64 #ifdef __TOS__
65
66 #define HW_VECTOR_INIT_PC ((u32*)0x4)
67 #define HW_VECTOR_VBL ((u32*)0x70)
68 #define HW_VECTOR_HBL ((u32*)0x68)
69 #define HW_VECTOR_DMA ((u32*)0x11C)
70 #define HW_VECTOR_TIMERB ((volatile u32*)0x120)
71
72 /* Shifter */
73
74 #define HW_COLOR_LUT ((u16*)0xFFFF8240UL)
75
76 #define HW_VIDEO_MODE ((u8*)0xFFFF8260UL)
77
78 #define HW_VIDEO_BASE_H ((u8*)0xFFFF8201UL)
79 #define HW_VIDEO_BASE_M ((u8*)0xFFFF8203UL)
80 #define HW_VIDEO_BASE_L ((u8*)0xFFFF820DUL) /* STe */
81
82 #define HW_VIDEO_COUNT_H ((u8*)0xFFFF8205UL) /* STe */
83 #define HW_VIDEO_COUNT_M ((u8*)0xFFFF8207UL) /* STe */
84 #define HW_VIDEO_COUNT_L ((u8*)0xFFFF8209UL) /* STe */
85
86 #define HW_VIDEO_SYNC ((u8*)0xFFFF820AUL)
87
88 #define HW_VIDEO_OFFSET ((u8*)0xFFFF820FUL) /* STe */
89 #define HW_VIDEO_PIXOFFSET ((u8*)0xFFFF8265UL) /* STe */
90 #define HW_VIDEO_PIXOFFSET_HIDDEN ((u8*)0xFFFF8264UL) /* STe */
91
92 #define HW_YM_REGSELECT ((u8*)0xFFFF8800UL)
93 #define HW_YM_REGDATA ((u8*)0xFFFF8802UL)
94
95 /* DMA sound - STe only */
96
97 #define HW_DMASOUND_CONTROL ((u8*)0xFFFF8901UL)
98
99 #define HW_DMASOUND_STARTADR_H ((u8*)0xFFFF8903UL)
100 #define HW_DMASOUND_STARTADR_M ((u8*)0xFFFF8905UL)
101 #define HW_DMASOUND_STARTADR_L ((u8*)0xFFFF8907UL)
102
103 #define HW_DMASOUND_ENDADR_H ((u8*)0xFFFF890FUL)
104 #define HW_DMASOUND_ENDADR_M ((u8*)0xFFFF8911UL)
105 #define HW_DMASOUND_ENDADR_L ((u8*)0xFFFF8913UL)
106
107 #define HW_DMASOUND_COUNTER_H ((u8*)0xFFFF8909UL)
108 #define HW_DMASOUND_COUNTER_M ((u8*)0xFFFF890BUL)
109 #define HW_DMASOUND_COUNTER_L ((u8*)0xFFFF890DUL)
110
111 #define HW_DMASOUND_MODE ((u16*)0xFFFF8920UL)
112
113 #define HW_MICROWIRE_DATA ((u16*)0xFFFF8922UL)
114 #define HW_MICROWIRE_MASK ((u16*)0xFFFF8924UL)
115
116 /* Keyboard ACIA */
117
118 #define HW_KEYBOARD_STATE ((u8*)0xFFFFFC00UL)
119 #define HW_KEYBOARD_DATA ((u8*)0xFFFFFC02UL)
120
121 /* MFP */
122
123 #define HW_MFP_INTERRUPT_ENABLE_A ((u8*)0xFFFFFA07UL)
124 #define HW_MFP_INTERRUPT_ENABLE_B ((u8*)0xFFFFFA09UL)
125 #define HW_MFP_INTERRUPT_PENDING_A ((u8*)0xFFFFFA0BUL)
126 #define HW_MFP_INTERRUPT_PENDING_B ((u8*)0xFFFFFA0DUL)
127 #define HW_MFP_INTERRUPT_INSERVICE_A ((u8*)0xFFFFFA0FUL)
128 #define HW_MFP_INTERRUPT_INSERVICE_B ((u8*)0xFFFFFA11UL)
129 #define HW_MFP_INTERRUPT_MASK_A ((u8*)0xFFFFFA13UL)
130 #define HW_MFP_INTERRUPT_MASK_B ((u8*)0xFFFFFA15UL)
131 #define HW_MFP_VECTOR_BASE ((u8*)0xFFFFFA17UL)
132 #define HW_MFP_TIMER_A_CONTROL ((u8*)0xFFFFFA19UL)
133 #define HW_MFP_TIMER_B_CONTROL ((u8*)0xFFFFFA1BUL)
134 #define HW_MFP_TIMER_CD_CONTROL ((u8*)0xFFFFFA1DUL)
135 #define HW_MFP_TIMER_A_DATA ((u8*)0xFFFFFA1FUL)
136 #define HW_MFP_TIMER_B_DATA ((u8*)0xFFFFFA21UL)
137 #define HW_MFP_TIMER_C_DATA ((u8*)0xFFFFFA23UL)
138 #define HW_MFP_TIMER_D_DATA ((u8*)0xFFFFFA25UL)
139
140 #define OS_FLOPVBL ((u16*)0x43e)
141 #define OS_NFLOPS ((u16*)0x4a6)
142
143 #else
144
145 STRUCT(SThardware)
146 {
147 u32 vectorInitPC;
148 u32 vectorVBL;
149 u32 vectorHBL;
150 u32 vectorDMA;
151 u32 vectorTimerB;
152
153 u8 keyboardState;
154 u8 keyboardData;
155
156 /* color */
157 u16 colorLUT[16];
158
159 /* video */
160 u8 videoMode;
161 u8 videoBaseH;
162 u8 videoBaseM;
163 u8 videoBaseL;
164
165 u8 videoCountH;
166 u8 videoCountM;
167 u8 videoCountL;
168
169 u8 videoOffset;
170 u8 videoPixOffset;
171 u8 videoPixOffsetHidden;
172
173 u8 videoSync;
174
175 u8 dmaSoundControl;
176 u8 dmaSoundStartAdrH;
177 u8 dmaSoundStartAdrM;
178 u8 dmaSoundStartAdrL;
179 u8 dmaSoundEndAdrH;
180 u8 dmaSoundEndAdrM;
181 u8 dmaSoundEndAdrL;
182 u8 dmaSoundCounterH;
183 u8 dmaSoundCounterM;
184 u8 dmaSoundCounterL;
185 u8 dmaSoundMode;
186 u16 microwireData;
187 u16 microwireMask;
188
189 u8 mfpInterruptEnableA;
190 u8 mfpInterruptEnableB;
191 u8 mfpInterruptPendingA;
192 u8 mfpInterruptPendingB;
193 u8 mfpInterruptInServiceA;
194 u8 mfpInterruptInServiceB;
195 u8 mfpInterruptMaskA;
196 u8 mfpInterruptMaskB;
197 u8 mfpVectorBase;
198 u8 mfpTimerAControl;
199 u8 mfpTimerBControl;
200 u8 mfpTimerCDControl;
201 u8 mfpTimerAData;
202 u8 mfpTimerBData;
203 u8 mfpTimerCData;
204 u8 mfpTimerDData;
205
206 u8 ymRegSelect;
207 u8 ymRegData;
208
209 u16 _flopvbl;
210 u16 _nflops;
211 };
212
213 # ifndef HARDWARE_C
214 extern SThardware g_STHardware;
215 # endif
216
217 # define HW_VECTOR_INIT_PC (&g_STHardware.vectorInitPC)
218
219 # define HW_VECTOR_VBL (&g_STHardware.vectorVBL)
220 # define HW_VECTOR_HBL (&g_STHardware.vectorHBL)
221 # define HW_VECTOR_DMA (&g_STHardware.vectorDMA)
222 # define HW_VECTOR_TIMERB (&g_STHardware.vectorTimerB)
223
224 # define HW_COLOR_LUT (g_STHardware.colorLUT)
225 # define HW_VIDEO_MODE (&g_STHardware.videoMode)
226
227 # define HW_KEYBOARD_DATA (&g_STHardware.keyboardData)
228 # define HW_KEYBOARD_STATE (&g_STHardware.keyboardState)
229
230 # define HW_VIDEO_BASE_H (&g_STHardware.videoBaseH)
231 # define HW_VIDEO_BASE_M (&g_STHardware.videoBaseM)
232 # define HW_VIDEO_BASE_L (&g_STHardware.videoBaseL)
233
234 # define HW_VIDEO_COUNT_H (&g_STHardware.videoBaseH)
235 # define HW_VIDEO_COUNT_M (&g_STHardware.videoBaseM)
236 # define HW_VIDEO_COUNT_L (&g_STHardware.videoBaseL)
237
238 # define HW_VIDEO_SYNC (&g_STHardware.videoSync)
239
240 # define HW_VIDEO_OFFSET (&g_STHardware.videoOffset)
241 # define HW_VIDEO_PIXOFFSET (&g_STHardware.videoPixOffset)
242 # define HW_VIDEO_PIXOFFSET_HIDDEN (&g_STHardware.videoPixOffsetHidden)
243
244 # define HW_DMASOUND_CONTROL (&g_STHardware.dmaSoundControl)
245
246 # define HW_DMASOUND_STARTADR_H (&g_STHardware.dmaSoundStartAdrH)
247 # define HW_DMASOUND_STARTADR_M (&g_STHardware.dmaSoundStartAdrM)
248 # define HW_DMASOUND_STARTADR_L (&g_STHardware.dmaSoundStartAdrL)
249
250 # define HW_DMASOUND_ENDADR_H (&g_STHardware.dmaSoundEndAdrH)
251 # define HW_DMASOUND_ENDADR_M (&g_STHardware.dmaSoundEndAdrM)
252 # define HW_DMASOUND_ENDADR_L (&g_STHardware.dmaSoundEndAdrL)
253
254 # define HW_DMASOUND_COUNTER_H (&g_STHardware.dmaSoundCounterH)
255 # define HW_DMASOUND_COUNTER_M (&g_STHardware.dmaSoundCounterM)
256 # define HW_DMASOUND_COUNTER_L (&g_STHardware.dmaSoundCounterL)
257
258 # define HW_DMASOUND_MODE (&g_STHardware.dmaSoundMode)
259
260 # define HW_MICROWIRE_DATA (&g_STHardware.microwireData)
261 # define HW_MICROWIRE_MASK (&g_STHardware.microwireMask)
262
263 # define HW_YM_REGSELECT (&g_STHardware.ymRegSelect)
264 # define HW_YM_REGDATA (&g_STHardware.ymRegData)
265
266 # define HW_MFP_INTERRUPT_ENABLE_A (&g_STHardware.mfpInterruptEnableA)
267 # define HW_MFP_INTERRUPT_ENABLE_B (&g_STHardware.mfpInterruptEnableB)
268 # define HW_MFP_INTERRUPT_PENDING_A (&g_STHardware.mfpInterruptPendingA)
269 # define HW_MFP_INTERRUPT_PENDING_B (&g_STHardware.mfpInterruptPendingB)
270 # define HW_MFP_INTERRUPT_INSERVICE_A (&g_STHardware.mfpInterruptInServiceA)
271 # define HW_MFP_INTERRUPT_INSERVICE_B (&g_STHardware.mfpInterruptInServiceB)
272 # define HW_MFP_INTERRUPT_MASK_A (&g_STHardware.mfpInterruptMaskA)
273 # define HW_MFP_INTERRUPT_MASK_B (&g_STHardware.mfpInterruptMaskB)
274 # define HW_MFP_VECTOR_BASE (&g_STHardware.mfpVectorBase)
275 # define HW_MFP_TIMER_A_CONTROL (&g_STHardware.mfpTimerAControl)
276 # define HW_MFP_TIMER_B_CONTROL (&g_STHardware.mfpTimerBControl)
277 # define HW_MFP_TIMER_CD_CONTROL (&g_STHardware.mfpTimerCDControl)
278 # define HW_MFP_TIMER_A_DATA (&g_STHardware.mfpTimerAData)
279 # define HW_MFP_TIMER_B_DATA (&g_STHardware.mfpTimerBData)
280 # define HW_MFP_TIMER_C_DATA (&g_STHardware.mfpTimerCData)
281 # define HW_MFP_TIMER_D_DATA (&g_STHardware.mfpTimerDData)
282
283 # define OS_FLOPVBL (&g_STHardware._flopvbl)
284 # define OS_NFLOPS (&g_STHardware._nflops)
285
286 #endif
287
288 #define HW_VIDEO_SYNC_50HZ 2
289 #define HW_VIDEO_SYNC_60HZ 0
290 #define HW_VIDEO_SYNC_EXTERN 1
291
292 #define HW_VIDEO_MODE_4P 0
293 #define HW_VIDEO_MODE_2P 1
294 #define HW_VIDEO_MODE_1P 2
295
296 #define HW_DMASOUND_CONTROL_OFF 0
297 #define HW_DMASOUND_CONTROL_PLAYONCE 1
298 #define HW_DMASOUND_CONTROL_PLAYLOOP 3
299
300 #define HW_DMASOUND_MODE_6258HZ 0
301 #define HW_DMASOUND_MODE_12517HZ 1
302 #define HW_DMASOUND_MODE_25033HZ 2
303 #define HW_DMASOUND_MODE_50066HZ 3
304
305 #define HW_DMASOUND_MODE_MONO 0x80
306 #define HW_DMASOUND_MODE_STEREO 0
307
308 #define HW_MICROWIRE_MASK_SOUND 0x7FF
309
310 #define HW_MICROWIRE_VOLUME 0x4C0 /* 0 1100 0000 values 0 to 40 */
311 #define HW_MICROWIRE_VOLUME_LEFT 0x540 /* 1 0100 0000 values 0 to 20 */
312 #define HW_MICROWIRE_VOLUME_RIGHT 0x500 /* 1 0000 0000 values 0 to 20 */
313 #define HW_MICROWIRE_VOLUME_TREBLE 0x480 /* 0 1000 0000 values 0 to 12 */
314 #define HW_MICROWIRE_VOLUME_BASS 0x440 /* 0 0100 0000 values 0 to 12 */
315
316 #define HW_MICROWIRE_MIXER_YM_12DB 0x400
317 #define HW_MICROWIRE_MIXER_YM 0x401
318 #define HW_MICROWIRE_MIXER_NO_YM 0x402
319
320 #define HW_KEYBOARD_KEYRELEASE 0x80
321 #define HW_KEY_F1 0x3B
322 #define HW_KEY_F2 0x3C
323 #define HW_KEY_F3 0x3D
324 #define HW_KEY_F4 0x3E
325 #define HW_KEY_F5 0x3F
326 #define HW_KEY_F6 0x40
327 #define HW_KEY_F7 0x41
328 #define HW_KEY_F8 0x42
329 #define HW_KEY_F9 0x43
330 #define HW_KEY_F10 0x44
331 #define HW_KEY_SPACEBAR 0x39
332 #define HW_KEY_BACKSPACE 0xE
333 #define HW_KEY_TAB 0xF
334 #define HW_KEY_S 0x1F
335 #define HW_KEY_V 0x2F
336
337 #define HW_68KOP_RTS 0x4E75
338
339 #endif
SThardware
Definition: HARDWARE.H:145
BASTYPES.H
BASTYPES