1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
/**
* @ingroup io68_lib
* @file io68/paulaemul.h
* @author Benjamin Gerard
* @date 1998/07/18
* @brief Paula emulator header.
*
*/
/* $Id: paulaemul.h 126 2009-07-15 08:58:51Z benjihan $ */
/* Copyright (C) 1998-2009 Benjamin Gerard */
/**
* @defgroup io68_lib_paula Amiga Paula emulator.
* @ingroup io68_lib
* @brief Paula emulator (Amiga soundchip).
*
* @todo Write something about paula and about this emulator right here !
*
*
* @par About Amiga hardware registers
*
* Amiga hardware registers could have a different address for read
* and write access. It is the case for DMA control register
* (DMACON).
*
* Registers could be (B)yte or (W)ord wide.
*
*
* @par SET/CLR bit
*
* Some hardware registers work with a SET/CLR bit. When writing
* these registers the value is not copied as is. The operation
* depends on the value of S the most signifiant bit (#15).
*
* - If S is 1 set-bit have to be set (bitwise OR).
* - If S is 0 set-bit have to be clear (bitwise NAND).
*
*
* @par Register map
*
* @code
* // NAME SZ ADDR
*
* VHPOSR (B) DFF006 [xxxxxxxx] Vertical/Horizontal electron bean position.
*
* INTREQR (W) DFF01E [-x---DCBA--------] Interrupt request read.
* INTREQW (W) DFF09C [-x---DCBA--------] Interrupt request write.
*
* INTENAR (W) DFF01C [-M---DCBA--------] Interrupt enable read (M=Master).
* INTENAW (W) DFF09A [-M---DCBA--------] Interrupt enable write (M=Master).
*
* DMACONW (W) DFF096 [S00000E00000DBCA] DMA control register write (E=Enable).
* DMACONR (W) DFF002 [000000E00000DBCA] DMA control register read (E=Enable).
*
* VOICEA DFF0A0
* VOICEB DFF0B0
* VOICEC DFF0C0
* VOICED DFF0D0
*
* VOICEX
* +0 (L) START [00000000 00000xxx xxxxxxxx xxxxxxx0] start address (even).
* +4 (W) LENGHT [xxxxxxxx xxxxxxxx] Length in word (0=010000).
* +6 (W) PERIOD [0000xxxx xxxxxxxx] Period (in paula cycle).
* +8 (B) VOLUME [0xxxxxxx] Volume [0-64] (presume value > 64 => 64).
* @endcode
*
*
* @{
*/
;
/** Amiga Paula Clock frequencies. */
;
/** Type used by internal counters.
*
* This type must be an unsigned of at least 32-bit. Values are
* always fixed point. The amount of shifting is calculated so that
* the most useful bit is the most signifiant bit. Therefore these
* counters have a automatic natural modulo.
*/
typedef uint68_t plct_t;
/** Must be same size than plct_t but signed. */
typedef int68_t signed_plct_t;
/** Paula voice data structure. */
typedef struct paulav_t;
/** Paula emulator data structure. */
typedef struct paula_t;
/** @name Initialization functions.
* @{
*/
/** available emulation modes. */
;
/** clock type. */
;
/** sampling rate value in hertz. */
;
/** Paula instance creaation parameters. */
typedef struct paula_parms_t;
/** setup data. */
typedef struct paula_setup_t;
/** Init paula library.
*
* The paula_init() must be call prior to all other paula functions.
*
* @return error-code (always success)
* @return 0 Success
* @return -1 Failure
*
* @see paula_shutdown()
*/
int ;
/** Shutdown paula library.
*
* @see paula_init()
*/
void ;
/** Paula hardware reset.
*
* The paula_reset() reset function perform a Paula reset.
* It performs following operations :
* - all registers zeroed
* - all internal voices set to dummy 2 samples len address.
* - general DMA enabled
* - all audio DMA disabled
* - interrupt master enabled
* - all audio interrupt disbled
*
* @return error-code (always success)
* @return 0 Success
*/
int ;
/** Paula emulator instance setup.
*
* @return error-code (always success)
* @return 0 Success
*
* @see paula_reset()
*/
int ;
/** Paula emulator instance cleanup.
*/
void ;
/** Set/Get paula emulator type.
*
* The paula_emulation() function set and get the paula emulator
* type.
*
* If engine is paula_engine_e::PAULA_ENGINE_QUERY the function
* returns the current value without modifying anything. Else the
* function set the current paula engine according to the value of
* engine. If paula parameter is NULL pointer the function works
* with the default parameters rather than a actual paula instance
* meaning it will read or write the default setting (addressed by
* paula_engine_e::PAULA_ENGINE_DEFAULT).
*
* @param paula Paula emulator instance.
* @param engine @ref paula_engine_e "emulator type".
* @return an @ref paula_engine_e "emulator type".
*/
int ;
/** Set/Get paula clock type.
*
* The paula_clock() function is similar to the paula_engine()
* function except it concerns clock rate.
*
* @param paula Paula emulator instance.
* @param clock @ref paula_clock_e "clock type".
* @return a @ref paula_clock_e "clock type".
*/
int ;
/** Set/Get paula emulator sampling rate.
*
* The paula_sampling_rate() function is similar to the
* paula_engine() function except it concerns sampling rate.
*
* @param paula Paula emulator instance.
* @param hz @ref paula_hz_e "sampling rate" in Hz.
* @return actual @ref paula_hz_e "sampling rate" in Hz.
*/
int ;
/** @} */
/** @name Emulation functions
* @{
*/
/** Execute Paula emulation.
*
* The paula_mix() function processes sample mixing with current internal
* parameters for n samples. Mixed samples are stored in a large enough
* (at least n) 32 bit pcm buffer pointed by b. mem68 is a pointer to
* the 68K memory buffer. The Paula emulator assume that this buffer is
* at least the size of the Amiga "chip" RAM. This implies at leat 512Kb
* and PCM data must be in the first 512Kb.
*
* @param paula Paula emulator instance
* @param splbuf Destination 32-bit sample buffer
* @param n Number of sample to mix in splbuf buffer
*
*/
void ;
/** @} */
/**
* @}
*/
/* #ifndef _IO68_PAULAEMUL_H_ */