/
ym2149_sys_regs.h
77 lines (66 loc) · 2.7 KB
/
ym2149_sys_regs.h
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
#ifndef YM2149_SYS_REGS_H
#define YM2149_SYS_REGS_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Dual YM2149 hardware access layer.
*/
#define YM2149_SYS_BASE 0x10001000
//PSG0 registers
#define PSG0_CHA_TONE_PERIOD_FINE_OFFSET 0 // 8 BITS
#define PSG0_CHA_TONE_PERIOD_COARSE_OFFSET 1 // 4 BITS
#define PSG0_CHB_TONE_PERIOD_FINE_OFFSET 2 // 8 BITS
#define PSG0_CHB_TONE_PERIOD_COARSE_OFFSET 3 // 4 BITS
#define PSG0_CHC_TONE_PERIOD_FINE_OFFSET 4 // 8 BITS
#define PSG0_CHC_TONE_PERIOD_COARSE_OFFSET 5 // 4 BITS
#define PSG0_NOISE_PERIOD_OFFSET 6 // 5 BITS
#define PSG0_ENABLE_OFFSET 7 // 8 BITS
#define PSG0_CHA_AMPLITUDE 8 // 5 BITS
#define PSG0_CHB_AMPLITUDE 9 // 5 BITS
#define PSG0_CHC_AMPLITUDE 10 // 5 BITS
#define PSG0_ENV_PERIOD_FINE_OFFSET 11 // 8 BITS
#define PSG0_ENV_PERIOD_COARSE_OFFSET 12 // 8 BITS
#define PSG0_ENV_SHAPE_CYCLE 13 // 4 BITS
#define PSG0_IO_PORT_A_OFFSET 14 // 8 BITS
#define PSG0_IO_PORT_B_OFFSET 15 // 8 BITS
//PSG1 registers
#define PSG1_CHA_TONE_PERIOD_FINE_OFFSET (16+0) // 8 BITS
#define PSG1_CHA_TONE_PERIOD_COARSE_OFFSET (16+1) // 4 BITS
#define PSG1_CHB_TONE_PERIOD_FINE_OFFSET (16+2) // 8 BITS
#define PSG1_CHB_TONE_PERIOD_COARSE_OFFSET (16+3) // 4 BITS
#define PSG1_CHC_TONE_PERIOD_FINE_OFFSET (16+4) // 8 BITS
#define PSG1_CHC_TONE_PERIOD_COARSE_OFFSET (16+5) // 4 BITS
#define PSG1_NOISE_PERIOD_OFFSET (16+6) // 5 BITS
#define PSG1_ENABLE_OFFSET (16+7) // 8 BITS
#define PSG1_CHA_AMPLITUDE (16+8) // 5 BITS
#define PSG1_CHB_AMPLITUDE (16+9) // 5 BITS
#define PSG1_CHC_AMPLITUDE (16+10) // 5 BITS
#define PSG1_ENV_PERIOD_FINE_OFFSET (16+11) // 8 BITS
#define PSG1_ENV_PERIOD_COARSE_OFFSET (16+12)// 8 BITS
#define PSG1_ENV_SHAPE_CYCLE (16+13) // 4 BITS
#define PSG1_IO_PORT_A_OFFSET (16+14) // 8 BITS
#define PSG1_IO_PORT_B_OFFSET (16+15) // 8 BITS
//Audio Mixer registers
//Individual channel volumes
#define FILTER_MIXER_VOLA_OFFSET (128+0)
#define FILTER_MIXER_VOLB_OFFSET (128+1)
#define FILTER_MIXER_VOLC_OFFSET (128+2)
#define FILTER_MIXER_VOLD_OFFSET (128+3)
#define FILTER_MIXER_VOLE_OFFSET (128+4)
#define FILTER_MIXER_VOLF_OFFSET (128+5)
//Master volume
#define FILTER_MIXER_MVOL_OFFSET (128+6)
#define FILTER_MIXER_INV_OFFSET (128+7)
//Bass
#define FILTER_MIXER_BASS_OFFSET (128+8)
//Treble
#define FILTER_MIXER_TREB_OFFSET (128+9)
inline void ym2149_sys_reg_wr(unsigned reg_offset, unsigned val)
{
((unsigned volatile *)(YM2149_SYS_BASE))[reg_offset] = val;
}
#ifdef __cplusplus
}
#endif
#endif //YM2149_SYS_REGS_H