2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
7 [ AY-3-8910 / YM2203 / YM2608 ]
16 #include "fmgen/opna.h"
18 //#if !(defined(HAS_AY_3_8910) || defined(HAS_AY_3_8912) || defined(HAS_AY_3_8913))
19 //#define HAS_YM_SERIES
20 #ifdef SUPPORT_WIN32_DLL
21 #define SUPPORT_MAME_FM_DLL
22 //#include "fmdll/fmdll.h"
26 //#if defined(HAS_AY_3_8913)
27 // both port a and port b are not supported
28 //#elif defined(HAS_AY_3_8912)
29 // port b is not supported
30 //#define SUPPORT_YM2203_PORT_A
32 //#define SUPPORT_YM2203_PORT_A
33 //#define SUPPORT_YM2203_PORT_B
35 //#if defined(SUPPORT_YM2203_PORT_A) || defined(SUPPORT_YM2203_PORT_B)
36 //#define SUPPORT_YM2203_PORT
39 //#ifdef SUPPORT_YM2203_PORT_A
40 #define SIG_YM2203_PORT_A 0
42 //#ifdef SUPPORT_YM2203_PORT_B
43 #define SIG_YM2203_PORT_B 1
45 #define SIG_YM2203_MUTE 2
47 class YM2203 : public DEVICE
54 #ifdef SUPPORT_MAME_FM_DLL
62 int base_decibel_fm, base_decibel_psg;
74 int32_t v_right_volume;
75 int32_t v_left_volume;
76 //#ifdef SUPPORT_YM2203_PORT
99 bool _SUPPORT_YM2203_PORT;
104 bool _IS_YM2203_PORT_MODE;
105 uint8_t _YM2203_PORT_MODE;
106 bool _SUPPORT_YM2203_PORT_A;
107 bool _SUPPORT_YM2203_PORT_B;
111 //#ifdef HAS_YM_SERIES
113 outputs_t outputs_irq;
114 void update_interrupt();
117 YM2203(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
119 base_decibel_fm = base_decibel_psg = 0;
123 _HAS_AY_3_8910 = _HAS_AY_3_8912 = _HAS_AY_3_8913 = false;
124 _SUPPORT_YM2203_PORT = _HAS_YM_SERIES = false;
125 _IS_YM2203_PORT_MODE = false;
126 _YM2203_PORT_MODE = 0xff;
127 _SUPPORT_YM2203_PORT_A = _SUPPORT_YM2203_PORT_B = false;
129 //if(_SUPPORT_YM2203_PORT) {
130 for(int i = 0; i < 2; i++) {
131 initialize_output_signals(&port[i].outputs);
132 port[i].wreg = port[i].rreg = 0;//0xff;
134 initialize_output_signals(&outputs_irq);
143 void write_io8(uint32_t addr, uint32_t data);
144 uint32_t read_io8(uint32_t addr);
145 void write_signal(int id, uint32_t data, uint32_t mask);
146 uint32_t read_signal(int id);
147 void event_vline(int v, int clock);
148 void event_callback(int event_id, int error);
149 void mix(int32* buffer, int cnt);
150 void set_volume(int _ch, int decibel_l, int decibel_r);
151 void update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame);
152 bool process_state(FILEIO* state_fio, bool loading);
154 //#ifdef HAS_YM_SERIES
155 void set_context_irq(DEVICE* device, int id, uint32_t mask)
157 register_output_signal(&outputs_irq, device, id, mask);
160 //#ifdef SUPPORT_YM2203_PORT_A
161 void set_context_port_a(DEVICE* device, int id, uint32_t mask, int shift)
163 register_output_signal(&port[0].outputs, device, id, mask, shift);
166 //#ifdef SUPPORT_YM2203_PORT_B
167 void set_context_port_b(DEVICE* device, int id, uint32_t mask, int shift)
169 register_output_signal(&port[1].outputs, device, id, mask, shift);
172 void initialize_sound(int rate, int clock, int samples, int decibel_fm, int decibel_psg);
173 void set_reg(uint32_t addr, uint32_t data); // for patch