Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
abi.h
Go to the documentation of this file.
1 #ifndef _ABI_H_
2 #define _ABI_H_
3 
4 /**************************************************************************
5  * *
6  * Copyright (C) 1994, Silicon Graphics, Inc. *
7  * *
8  * These coded instructions, statements, and computer programs contain *
9  * unpublished proprietary information of Silicon Graphics, Inc., and *
10  * are protected by Federal copyright law. They may not be disclosed *
11  * to third parties or copied or duplicated in any form, in whole or *
12  * in part, without the prior written consent of Silicon Graphics, Inc. *
13  * *
14  **************************************************************************/
15 
16 /**************************************************************************
17  *
18  * $Revision: 1.32 $
19  * $Date: 1997/02/11 08:16:37 $
20  * $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/abi.h,v $
21  *
22  **************************************************************************/
23 
24 /*
25  * Header file for the Audio Binary Interface.
26  * This is included in the Media Binary Interface file
27  * mbi.h.
28  *
29  * This file follows the framework used for graphics.
30  *
31  */
32 
33 /* Audio commands: */
34 #define A_SPNOOP 0
35 #define A_ADPCM 1
36 #define A_CLEARBUFF 2
37 #define A_ENVMIXER 3
38 #define A_LOADBUFF 4
39 #define A_RESAMPLE 5
40 #define A_SAVEBUFF 6
41 #define A_SEGMENT 7
42 #define A_SETBUFF 8
43 #define A_SETVOL 9
44 #define A_DMEMMOVE 10
45 #define A_LOADADPCM 11
46 #define A_MIXER 12
47 #define A_INTERLEAVE 13
48 #define A_POLEF 14
49 #define A_SETLOOP 15
50 
51 #define ACMD_SIZE 32
52 /*
53  * Audio flags
54  */
55 
56 #define A_INIT 0x01
57 #define A_CONTINUE 0x00
58 #define A_LOOP 0x02
59 #define A_OUT 0x02
60 #define A_LEFT 0x02
61 #define A_RIGHT 0x00
62 #define A_VOL 0x04
63 #define A_RATE 0x00
64 #define A_AUX 0x08
65 #define A_NOAUX 0x00
66 #define A_MAIN 0x00
67 #define A_MIX 0x10
68 
69 /*
70  * BEGIN C-specific section: (typedef's)
71  */
72 #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
73 
74 /*
75  * Data Structures.
76  */
77 
78 typedef struct {
79  unsigned int cmd:8;
80  unsigned int flags:8;
81  unsigned int gain:16;
82  unsigned int addr;
83 } Aadpcm;
84 
85 typedef struct {
86  unsigned int cmd:8;
87  unsigned int flags:8;
88  unsigned int gain:16;
89  unsigned int addr;
90 } Apolef;
91 
92 typedef struct {
93  unsigned int cmd:8;
94  unsigned int flags:8;
95  unsigned int pad1:16;
96  unsigned int addr;
97 } Aenvelope;
98 
99 typedef struct {
100  unsigned int cmd:8;
101  unsigned int pad1:8;
102  unsigned int dmem:16;
103  unsigned int pad2:16;
104  unsigned int count:16;
105 } Aclearbuff;
106 
107 typedef struct {
108  unsigned int cmd:8;
109  unsigned int pad1:8;
110  unsigned int pad2:16;
111  unsigned int inL:16;
112  unsigned int inR:16;
113 } Ainterleave;
114 
115 typedef struct {
116  unsigned int cmd:8;
117  unsigned int pad1:24;
118  unsigned int addr;
119 } Aloadbuff;
120 
121 typedef struct {
122  unsigned int cmd:8;
123  unsigned int flags:8;
124  unsigned int pad1:16;
125  unsigned int addr;
126 } Aenvmixer;
127 
128 typedef struct {
129  unsigned int cmd:8;
130  unsigned int flags:8;
131  unsigned int gain:16;
132  unsigned int dmemi:16;
133  unsigned int dmemo:16;
134 } Amixer;
135 
136 typedef struct {
137  unsigned int cmd:8;
138  unsigned int flags:8;
139  unsigned int dmem2:16;
140  unsigned int addr;
141 } Apan;
142 
143 typedef struct {
144  unsigned int cmd:8;
145  unsigned int flags:8;
146  unsigned int pitch:16;
147  unsigned int addr;
148 } Aresample;
149 
150 typedef struct {
151  unsigned int cmd:8;
152  unsigned int flags:8;
153  unsigned int pad1:16;
154  unsigned int addr;
155 } Areverb;
156 
157 typedef struct {
158  unsigned int cmd:8;
159  unsigned int pad1:24;
160  unsigned int addr;
161 } Asavebuff;
162 
163 typedef struct {
164  unsigned int cmd:8;
165  unsigned int pad1:24;
166  unsigned int pad2:2;
167  unsigned int number:4;
168  unsigned int base:24;
169 } Asegment;
170 
171 typedef struct {
172  unsigned int cmd:8;
173  unsigned int flags:8;
174  unsigned int dmemin:16;
175  unsigned int dmemout:16;
176  unsigned int count:16;
177 } Asetbuff;
178 
179 typedef struct {
180  unsigned int cmd:8;
181  unsigned int flags:8;
182  unsigned int vol:16;
183  unsigned int voltgt:16;
184  unsigned int volrate:16;
185 } Asetvol;
186 
187 typedef struct {
188  unsigned int cmd:8;
189  unsigned int pad1:8;
190  unsigned int dmemin:16;
191  unsigned int dmemout:16;
192  unsigned int count:16;
193 } Admemmove;
194 
195 typedef struct {
196  unsigned int cmd:8;
197  unsigned int pad1:8;
198  unsigned int count:16;
199  unsigned int addr;
200 } Aloadadpcm;
201 
202 typedef struct {
203  unsigned int cmd:8;
204  unsigned int pad1:8;
205  unsigned int pad2:16;
206  unsigned int addr;
207 } Asetloop;
208 
209 /*
210  * Generic Acmd Packet
211  */
212 
213 typedef struct {
214  unsigned int w0;
215  unsigned int w1;
216 } Awords;
217 
218 typedef union {
219  Awords words;
220  Aadpcm adpcm;
221  Apolef polef;
222  Aclearbuff clearbuff;
223  Aenvelope envelope;
224  Ainterleave interleave;
225  Aloadbuff loadbuff;
226  Aenvmixer envmixer;
227  Aresample resample;
228  Areverb reverb;
229  Asavebuff savebuff;
230  Asegment segment;
231  Asetbuff setbuff;
232  Asetvol setvol;
233  Admemmove dmemmove;
234  Aloadadpcm loadadpcm;
235  Amixer mixer;
236  Asetloop setloop;
237  long long int force_union_align; /* dummy, force alignment */
238 } Acmd;
239 
240 /*
241  * ADPCM State
242  */
243 typedef short ADPCM_STATE[16];
244 
245 /*
246  * Pole filter state
247  */
248 typedef short POLEF_STATE[4];
249 
250 /*
251  * Resampler state
252  */
253 typedef short RESAMPLE_STATE[16];
254 
255 /*
256  * Resampler constants
257  */
258 #define UNITY_PITCH 0x8000
259 #define MAX_RATIO 1.99996 /* within .03 cents of +1 octave */
260 
261 /*
262  * Enveloper/Mixer state
263  */
264 typedef short ENVMIX_STATE[40];
265 
266 /*
267  * Macros to assemble the audio command list
268  */
269 
270 #define aADPCMdec(pkt, f, s) \
271 { \
272  Acmd *_a = (Acmd *)pkt; \
273  \
274  _a->words.w0 = _SHIFTL(A_ADPCM, 24, 8) | _SHIFTL(f, 16, 8); \
275  _a->words.w1 = (unsigned int)(s); \
276 }
277 
278 #define aPoleFilter(pkt, f, g, s) \
279 { \
280  Acmd *_a = (Acmd *)pkt; \
281  \
282  _a->words.w0 = (_SHIFTL(A_POLEF, 24, 8) | _SHIFTL(f, 16, 8) | \
283  _SHIFTL(g, 0, 16)); \
284  _a->words.w1 = (unsigned int)(s); \
285 }
286 
287 #define aClearBuffer(pkt, d, c) \
288 { \
289  Acmd *_a = (Acmd *)pkt; \
290  \
291  _a->words.w0 = _SHIFTL(A_CLEARBUFF, 24, 8) | _SHIFTL(d, 0, 24); \
292  _a->words.w1 = (unsigned int)(c); \
293 }
294 
295 #define aEnvMixer(pkt, f, s) \
296 { \
297  Acmd *_a = (Acmd *)pkt; \
298  \
299  _a->words.w0 = _SHIFTL(A_ENVMIXER, 24, 8) | _SHIFTL(f, 16, 8); \
300  _a->words.w1 = (unsigned int)(s); \
301 }
302 
303 #define aInterleave(pkt, l, r) \
304 { \
305  Acmd *_a = (Acmd *)pkt; \
306  \
307  _a->words.w0 = _SHIFTL(A_INTERLEAVE, 24, 8); \
308  _a->words.w1 = _SHIFTL(l, 16, 16) | _SHIFTL(r, 0, 16); \
309 }
310 
311 #define aLoadBuffer(pkt, s) \
312 { \
313  Acmd *_a = (Acmd *)pkt; \
314  \
315  _a->words.w0 = _SHIFTL(A_LOADBUFF, 24, 8); \
316  _a->words.w1 = (unsigned int)(s); \
317 }
318 
319 #define aMix(pkt, f, g, i, o) \
320 { \
321  Acmd *_a = (Acmd *)pkt; \
322  \
323  _a->words.w0 = (_SHIFTL(A_MIXER, 24, 8) | _SHIFTL(f, 16, 8) | \
324  _SHIFTL(g, 0, 16)); \
325  _a->words.w1 = _SHIFTL(i,16, 16) | _SHIFTL(o, 0, 16); \
326 }
327 
328 #define aPan(pkt, f, d, s) \
329 { \
330  Acmd *_a = (Acmd *)pkt; \
331  \
332  _a->words.w0 = (_SHIFTL(A_PAN, 24, 8) | _SHIFTL(f, 16, 8) | \
333  _SHIFTL(d, 0, 16)); \
334  _a->words.w1 = (unsigned int)(s); \
335 }
336 
337 #define aResample(pkt, f, p, s) \
338 { \
339  Acmd *_a = (Acmd *)pkt; \
340  \
341  _a->words.w0 = (_SHIFTL(A_RESAMPLE, 24, 8) | _SHIFTL(f, 16, 8) |\
342  _SHIFTL(p, 0, 16)); \
343  _a->words.w1 = (unsigned int)(s); \
344 }
345 
346 #define aSaveBuffer(pkt, s) \
347 { \
348  Acmd *_a = (Acmd *)pkt; \
349  \
350  _a->words.w0 = _SHIFTL(A_SAVEBUFF, 24, 8); \
351  _a->words.w1 = (unsigned int)(s); \
352 }
353 
354 #define aSegment(pkt, s, b) \
355 { \
356  Acmd *_a = (Acmd *)pkt; \
357  \
358  _a->words.w0 = _SHIFTL(A_SEGMENT, 24, 8); \
359  _a->words.w1 = _SHIFTL(s, 24, 8) | _SHIFTL(b, 0, 24); \
360 }
361 
362 #define aSetBuffer(pkt, f, i, o, c) \
363 { \
364  Acmd *_a = (Acmd *)pkt; \
365  \
366  _a->words.w0 = (_SHIFTL(A_SETBUFF, 24, 8) | _SHIFTL(f, 16, 8) | \
367  _SHIFTL(i, 0, 16)); \
368  _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
369 }
370 
371 #define aSetVolume(pkt, f, v, t, r) \
372 { \
373  Acmd *_a = (Acmd *)pkt; \
374  \
375  _a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
376  _SHIFTL(v, 0, 16)); \
377  _a->words.w1 = _SHIFTL(t, 16, 16) | _SHIFTL(r, 0, 16); \
378 }
379 
380 #define aSetLoop(pkt, a) \
381 { \
382  Acmd *_a = (Acmd *)pkt; \
383  _a->words.w0 = _SHIFTL(A_SETLOOP, 24, 8); \
384  _a->words.w1 = (unsigned int)(a); \
385 }
386 
387 #define aDMEMMove(pkt, i, o, c) \
388 { \
389  Acmd *_a = (Acmd *)pkt; \
390  \
391  _a->words.w0 = _SHIFTL(A_DMEMMOVE, 24, 8) | _SHIFTL(i, 0, 24); \
392  _a->words.w1 = _SHIFTL(o, 16, 16) | _SHIFTL(c, 0, 16); \
393 }
394 
395 #define aLoadADPCM(pkt, c, d) \
396 { \
397  Acmd *_a = (Acmd *)pkt; \
398  \
399  _a->words.w0 = _SHIFTL(A_LOADADPCM, 24, 8) | _SHIFTL(c, 0, 24); \
400  _a->words.w1 = (unsigned int) d; \
401 }
402 
403 /*
404  * --------------------------------------------------------------------
405  * The below command is seemingly declared manually and used for the
406  * sound driver.
407  * --------------------------------------------------------------------
408  */
409 
410 // This is a version of aSetAudio which takes a single 32-bit parameter
411 // instead of two 16-bit ones. According to AziAudio, it is used to set
412 // ramping values when neither bit 4 nor bit 8 is set in the flags parameter.
413 
414 #define aSetVolume32(pkt, f, v, tr) \
415 { \
416  Acmd *_a = (Acmd *)pkt; \
417  \
418  _a->words.w0 = (_SHIFTL(A_SETVOL, 24, 8) | _SHIFTL(f, 16, 16) | \
419  _SHIFTL(v, 0, 16)); \
420  _a->words.w1 = (unsigned int)(tr); \
421 }
422 
423 #endif /* _LANGUAGE_C */
424 
425 #endif /* !_ABI_H_ */
426 
427 
428 
input is a non tagged type Internal error in function gen_type_str not a type tree s Cannot open file s Prototype should be moved after tag or a typedef declaration Please look for comments in the extracted header file The extracted header file includes prototypes static for which should be if you wish to include the header in a source file other than the originator ANSI C requires formal parameter before This extension is meant to be used for compatibility with varargs h(35) syntax error cannot initialize Was the struct ever after argument a legal assembly string The float option will be ignored in ANSI mode The float option is since otherwise program semantics would violate the ANSI standard In fp constants are always double with ANSI while with float the type of fp constants will depend on the context and may be float ANSI C support unavailable with C compiler bundled with RISC os The C compiler bundled with RISC os does not support ANSI C ANSI C support requires a separate license Ignored invalid warning number(s) in -woff option
addr
Definition: first-diff.py:150