1 /* Copyright (c) 2003-2021 James Daniels */
2 /* Distributed under the MIT License */
3 /* license terms: see LICENSE file in root or http://opensource.org/licenses/MIT */
11 #define AAS_MAX_CHANNELS 16
13 #define REG_SOUNDCNT_L (*(volatile AAS_u16 *)0x4000080)
14 #define REG_SOUNDCNT_H (*(volatile AAS_u16 *)0x4000082)
15 #define REG_SOUNDCNT_X (*(volatile AAS_u16 *)0x4000084)
17 #define REG_DMA1SAD (*(volatile AAS_u32 *)0x40000BC)
18 #define REG_DMA1DAD (*(volatile AAS_u32 *)0x40000C0)
19 #define REG_DMA1CNT_H (*(volatile AAS_u16 *)0x40000C6)
20 #define REG_DMA1CNT (*(volatile AAS_u32 *)0x40000C4)
22 #define REG_DMA2SAD (*(volatile AAS_u32 *)0x40000C8)
23 #define REG_DMA2DAD (*(volatile AAS_u32 *)0x40000CC)
24 #define REG_DMA2CNT_H (*(volatile AAS_u16 *)0x40000D2)
25 #define REG_DMA2CNT (*(volatile AAS_u32 *)0x40000d0)
27 #define REG_TM0CNT (*(volatile AAS_u16 *)0x4000102)
28 #define REG_TM0D (*(volatile AAS_u16 *)0x4000100)
30 #define REG_TM1CNT (*(volatile AAS_u16 *)0x4000106)
31 #define REG_TM1D (*(volatile AAS_u16 *)0x4000104)
33 #define REG_IE (*(volatile AAS_u16 *)0x4000200)
34 #define REG_IME (*(volatile AAS_u16 *)0x4000208)
35 #define REG_IF (*(volatile AAS_u16 *)0x4000202)
37 #define DISPCNT (*(volatile AAS_u16 *)0x4000000)
38 #define REG_VCOUNT (*(volatile AAS_u16 *)0x4000006)
42 AAS_u32 data; /* offset in bytes */
43 AAS_u16 repeat; /* in halfwords */
44 AAS_u16 length; /* in halfwords */
50 extern const AAS_u16 AAS_DATA_NUM_MODS;
51 extern const struct AAS_ModSample AAS_ModSamples[][31];
52 extern const AAS_s16 AAS_Sequence[][128][16];
53 extern const AAS_u8 AAS_NumChans[];
54 extern const AAS_u8 AAS_RestartPos[];
55 extern const AAS_u8 AAS_PatternData[];
56 extern const AAS_s8 AAS_SampleData[];
58 extern const AAS_u16 AAS_DivTable[8192];
59 extern const AAS_u16 AAS_MOD_period_conv_table[2048];
60 extern const AAS_u16 AAS_period_table[16][60];
62 extern const AAS_u16 AAS_tick_rate[41];
64 extern const AAS_s8 AAS_sin[64];
66 extern AAS_s16 AAS_mod_num AAS_IN_EWRAM;
67 extern AAS_BOOL AAS_initialised AAS_IN_EWRAM;
68 extern AAS_u8 AAS_volscale AAS_IN_EWRAM;
69 extern AAS_u8 AAS_mod_num_chans AAS_IN_EWRAM;
70 extern AAS_u16 AAS_mix_scale AAS_IN_EWRAM;
71 extern AAS_BOOL AAS_changed[2] AAS_IN_IWRAM;
73 extern AAS_u8 AAS_chan_rearrange[AAS_MAX_CHANNELS] AAS_IN_EWRAM;
75 __inline static int AAS_Min( int a, int b )