Debian Codegraph @

android/app/jni/extern/YM2608-LLE/fmopna_impl.h

raw
1 /*
2 * Copyright (C) 2023-2024 nukeykt
3 *
4 * This file is part of YM2608-LLE.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * YM2608/YM2610/YM2612 emulator.
17 * Thanks:
18 * Raki (ika-musume):
19 * YM2608B decap
20 * John McMaster (siliconpr0n.org):
21 * YM2610 decap
22 * HardWareMan:
23 * YM2612 decap
24 *
25 */
26 // #define FMOPNA_YM2608
27 // #define FMOPNA_YM2610
28 // #define FMOPNA_YM2612
29
30 #if !defined(FMOPNA_YM2608) && !defined(FMOPNA_YM2610) && !defined(FMOPNA_YM2612)
31 #error no chip type defined
32 #endif
33
34 typedef struct {
35 int clk;
36 int ic; // neg
37 int cs; // neg
38 int wr; // neg
39 int rd; // neg
40 int a0;
41 int a1;
42 int data;
43 int test; // set to 1
44 #ifdef FMOPNA_YM2608
45 int gpio_a;
46 int gpio_b;
47 int dt0;
48 int dm;
49 int ad;
50 int da;
51 #endif
52 #ifdef FMOPNA_YM2610
53 int rad;
54 int pad;
55 #endif
56 }
57 #ifdef FMOPNA_YM2608
58 fmopna_input_t;
59 #elif defined (FMOPNA_YM2610)
60 fmopna_2610_input_t;
61 #else
62 fmopna_2612_input_t;
63 #endif
64
65 typedef struct {
66
67 #ifdef FMOPNA_YM2608
68 fmopna_input_t input;
69 #elif defined (FMOPNA_YM2610)
70 fmopna_2610_input_t input;
71 #else
72 fmopna_2612_input_t input;
73 #endif
74
75 int ic;
76
77 int ic_latch1[2];
78 int ic_latch2[2];
79 int ic_latch3[2];
80 int ic_check1;
81 int ic_check3;
82 int prescaler_latch[2];
83 #ifndef FMOPNA_YM2612
84 int ic_check2;
85 #endif
86 #ifdef FMOPNA_YM2608
87 int prescaler_sel[2];
88 #endif
89 int pssel_l[15][2];
90 int ic_latch_fm[2];
91
92 int mclk1;
93 int mclk2;
94
95 int clk1;
96 int clk2;
97
98 #ifndef FMOPNA_YM2612
99 int aclk1;
100 int aclk2;
101 int bclk1;
102 int bclk2;
103 int cclk1;
104 int cclk2;
105
106 int dclk;
107
108 int ssg_write0;
109 int ssg_write1;
110 int ssg_read1;
111
112 int write2;
113 int write3;
114
115 int read2;
116 #endif
117 #ifdef FMOPNA_YM2608
118 int read3;
119 #endif
120
121 int read0;
122
123 int write0_trig0;
124 int write0_trig1;
125 int write0_l[3];
126 int write0_en;
127
128 int write1_trig0;
129 int write1_trig1;
130 int write1_l[3];
131 int write1_en;
132
133 #ifdef FMOPNA_YM2608
134 int write2_trig0;
135 int write2_trig1;
136 int write2_l[3];
137 int write2_en;
138 #endif
139
140 #ifndef FMOPNA_YM2612
141 int write3_trig0;
142 int write3_trig1;
143 int write3_l[3];
144 int write3_en;
145 #endif
146
147 int data_l;
148
149 int data_bus1;
150 int data_bus2; // inverted
151
152 int read_bus;
153
154 #ifdef FMOPNA_YM2608
155 int addr_10[2];
156 int addr_10h[2];
157 int addr_12[2];
158 #endif
159 int addr_21[2];
160 int addr_22[2];
161 int addr_24[2];
162 int addr_25[2];
163 int addr_26[2];
164 int addr_27[2];
165 int addr_28[2];
166 #ifdef FMOPNA_YM2608
167 int addr_29[2];
168 int addr_ff[2];
169 #endif
170 #ifdef FMOPNA_YM2610
171 int addr_00[2];
172 int addr_02[2];
173 int addr_1c[2];
174 #endif
175 #ifdef FMOPNA_YM2612
176 int addr_2a[2];
177 int addr_2b[2];
178 int addr_2c[2];
179 #endif
180
181 #ifdef FMOPNA_YM2608
182 int reg_mask[2];
183 #endif
184 #ifndef FMOPNA_YM2612
185 int reg_test_12[2];
186 #endif
187 int reg_test_21[2];
188 int reg_lfo[2];
189 int reg_timer_a[2];
190 int reg_timer_b[2];
191 int reg_ch3[2];
192 int reg_timer_a_load[2];
193 int reg_timer_b_load[2];
194 int reg_timer_a_enable[2];
195 int reg_timer_b_enable[2];
196 int reg_timer_a_reset[2];
197 int reg_timer_b_reset[2];
198 #ifdef FMOPNA_YM2608
199 int reg_sch[2];
200 int reg_irq[2];
201 #endif
202 #ifdef FMOPNA_YM2610
203 int reg_flags[2];
204 #endif
205 int reg_kon_operator[2];
206 int reg_kon_channel[2];
207 #ifdef FMOPNA_YM2612
208 int reg_dac_en[2];
209 int reg_dac_data[2];
210 int reg_test_2c[2];
211 #endif
212 int fm_address[2];
213 int fm_data[2];
214 int write_fm_address[2];
215 int write_fm_data[2];
216 int reg_cnt1[2];
217 int reg_cnt2[2];
218 int reg_cnt_sync;
219 int reg_key_cnt1[2];
220 int reg_key_cnt2[2];
221 #ifdef FMOPNA_YM2608
222 int reg_cnt_rss[2];
223 int reg_cnt_rss_of;
224 int rss_18;
225 #endif
226 int reg_kon_match;
227 int reg_kon[4][2];
228 int kon_comb;
229 int reg_ch3_sel;
230 int ch3_en;
231 int ch3_csm;
232 int ch3_csm_load;
233 int reg_csm_l;
234 int reg_sync_timer;
235 int reg_sync_timer_l[2];
236 int reg_sync_timer_load;
237
238 int timer_a_cnt[2];
239 int timer_a_of[2];
240 int timer_a_load;
241 int timer_a_reg_load;
242 int timer_a_reg_load_l[2];
243 int timer_a_status[2];
244 int timer_b_subcnt[2];
245 int timer_b_subcnt_of[2];
246 int timer_b_cnt[2];
247 int timer_b_of[2];
248 int timer_b_load;
249 int timer_b_reg_load;
250 int timer_b_reg_load_l[2];
251 int timer_b_status[2];
252
253 #ifndef FMOPNA_YM2612
254 int irq_eos_l;
255 #endif
256 #ifdef FMOPNA_YM2608
257 int irq_mask_eos;
258 int irq_mask_brdy;
259 int irq_mask_zero;
260 #endif
261
262 int fm_is30;
263 int fm_is40;
264 int fm_is50;
265 int fm_is60;
266 int fm_is70;
267 int fm_is80;
268 int fm_is90;
269 int fm_isa0;
270 int fm_isa4;
271 int fm_isa8;
272 int fm_isac;
273 int fm_isb0;
274 int fm_isb4;
275
276 int reg_a4[2];
277 unsigned short reg_freq[2][6];
278 int reg_ac[2];
279 unsigned short reg_freq_3ch[2][6];
280 unsigned char reg_connect_fb[2][6];
281 unsigned char reg_b4[2][6];
282 int fnum[4];
283 int kcode[4];
284 int ch_cnt_sync;
285 int ch_cnt1[2];
286 int ch_cnt2[2];
287 #ifdef FMOPNA_YM2608
288 unsigned char reg_rss[2][6];
289 #endif
290 unsigned char op_multi_dt[2][12][2];
291 unsigned char op_tl[2][12][2];
292 unsigned char op_ar_ks[2][12][2];
293 unsigned char op_dr_a[2][12][2];
294 unsigned char op_sr[2][12][2];
295 unsigned char op_rr_sl[2][12][2];
296 unsigned char op_ssg[2][12][2];
297
298 int fsm_cnt1[2];
299 int fsm_cnt2[2];
300 int fsm_out[27];
301 int fsm_op1_sel_l;
302 int fsm_op2_sel_l;
303 int fsm_op3_sel_l;
304 int fsm_op4_sel_l;
305 int fsm_connect;
306 int alg_mod_op1_0_l;
307 int alg_mod_op1_1_l;
308 int alg_mod_op2_l;
309 int alg_mod_prev_0_l;
310 int alg_mod_prev_1_l;
311 int alg_output_l;
312 int alg_do_fb[2];
313 int alg_load_fb;
314 #ifndef FMOPNA_YM2612
315 int fsm_rss;
316 int fsm_rss2;
317 #endif
318 int fsm_sel0[2];
319 int fsm_sel1[2];
320 int fsm_sel2[2];
321 int fsm_sel23[2];
322 int fsm_sel_ch3[2];
323 #ifndef FMOPNA_YM2612
324 int fsm_sel11[2];
325 int fsm_sh1[2];
326 int fsm_sh2[2];
327 #endif
328 #ifdef FMOPNA_YM2612
329 int fsm_dac_ch6[2];
330 int fsm_dac_load[2];
331 int fsm_dac_out_sel[2];
332 #endif
333
334 int lfo_sync[4];
335 int lfo_subcnt[2];
336 int lfo_subcnt_of;
337 int lfo_cnt_rst;
338 int lfo_cnt[2];
339 #ifdef FMOPNA_YM2608
340 int lfo_cnt_of;
341 int lfo_mode;
342 #endif
343 int lfo_cnt_load;
344 int lfo_fnum1;
345 int lfo_fnum2;
346 int lfo_shift;
347 int lfo_sign;
348 int lfo_pm;
349 int lfo_fnum;
350 int lfo_am;
351
352 int pg_block;
353 int pg_freq;
354 int pg_dt_multi;
355 int pg_dt_add;
356 int pg_freqdt[2];
357 int pg_multi[5];
358 int pg_add[6];
359 int pg_reset[4];
360 int pg_phase[2][23];
361 int pg_phase2[2];
362 int pg_out;
363 int pg_dbgsync;
364 #ifdef FMOPNA_YM2610
365 int pg_dbgsync_l[2];
366 #endif
367 int pg_dbg[2];
368 int dt_add1;
369 int dt_add2;
370 int dt_enable[2];
371 int dt_sum;
372 int dt_blockmax[2];
373 int dt_note[2];
374 int dt_sign[2];
375
376 int eg_sync;
377 int eg_prescaler[2];
378 int eg_prescaler_clock_l[2];
379 int eg_clock_delay[2];
380 int eg_ic[2];
381
382 int eg_step[3];
383 int eg_timer_step[2];
384
385 int eg_timer[2];
386 int eg_timer_sum[2];
387 int eg_timer_carry[2];
388 int eg_timer_mask[2];
389 int eg_timer_masked[2];
390 int eg_timer_test;
391 int eg_timer_test_bit[2];
392 int eg_timer_low_lock;
393 int eg_shift_lock;
394
395 int eg_rate_sel;
396 int eg_rate_ar;
397 int eg_rate_dr;
398 int eg_rate_sr;
399 int eg_rate_rr;
400 int eg_rate;
401 int eg_rate_nonzero[3];
402 unsigned char eg_state[2][23];
403 int eg_ks;
404 int eg_ksv;
405 int eg_rate2;
406 int eg_ratenz;
407 int eg_rate12;
408 int eg_rate13;
409 int eg_rate14;
410 int eg_rate15;
411 int eg_rate_low;
412 int eg_rate_slow;
413 int eg_rate_sum;
414 int eg_maxrate[2];
415 int eg_inc2;
416 int eg_incsh0[2];
417 int eg_incsh1[2];
418 int eg_incsh2[2];
419 int eg_incsh3[2];
420 int eg_output;
421 unsigned short eg_level[2][22];
422 int eg_ssg_inv;
423 int eg_ssg_enable[2];
424 int eg_ssg_sign[2];
425 int eg_ssg_holdup[2];
426 int eg_ssg_pgreset[2];
427 int eg_ssg_dir[2];
428 int eg_ssg_egrepeat[2];
429 int eg_key[2];
430 int eg_kon_latch[2];
431 int eg_kon_event;
432 int eg_pg_reset[2];
433 int eg_sl[2][2];
434 int eg_tl[3][2];
435 int eg_level_ssg[2];
436 int eg_slreach;
437 int eg_level_l[2];
438 int eg_zeroreach;
439 int eg_off;
440 int eg_nextstate;
441 int eg_state_l;
442 int eg_mute;
443 int eg_exp;
444 int eg_linear;
445 int eg_inc_total;
446 int eg_nextlevel[2];
447 int eg_istantattack;
448 int eg_kon_csm[2];
449 int eg_am_l[2];
450 int eg_am_shift[2];
451 int eg_of1;
452 int eg_output_lfo;
453 int eg_csm_tl;
454 int eg_ch3_l[2];
455 int eg_out;
456 int eg_dbg_sync;
457 int eg_debug[2];
458 int eg_debug_inc;
459
460 int op_phase1;
461 int op_phase2;
462 unsigned short op_mod[2][6];
463 int op_phase_index;
464 int op_sign[2];
465 int op_logsin_base;
466 int op_logsin_delta;
467 int op_eglevel;
468 int op_att;
469 int op_shift[2];
470 int op_pow_base;
471 int op_pow_delta;
472 int op_pow;
473 int op_output[4];
474 unsigned short op_op1_0[2][6];
475 unsigned short op_op1_1[2][6];
476 unsigned short op_op2[2][6];
477 int op_loadfb;
478 int op_loadop2;
479 int op_mod_op1_0;
480 int op_mod_op1_1;
481 int op_mod_op2;
482 int op_mod_prev_0;
483 int op_mod_prev_1;
484 int op_mod1;
485 int op_mod2;
486 int op_mod_sum;
487 int op_do_fb;
488 int op_fb;
489
490 #ifndef FMOPNA_YM2612
491 #ifdef FMOPNA_YM2608
492 int ssg_prescaler1[2];
493 int ssg_prescaler2[2];
494 #endif
495 int ssg_div1[2];
496 int ssg_div2[2];
497 int ssg_div3[2];
498 int ssg_clk;
499 int ssg_clk1;
500 int ssg_clk2;
501 int ssg_ssg_addr;
502 int ssg_address;
503 int ssg_freq_a[2];
504 int ssg_freq_b[2];
505 int ssg_freq_c[2];
506 int ssg_noise;
507 int ssg_mode;
508 int ssg_level_a;
509 int ssg_level_b;
510 int ssg_level_c;
511 int ssg_env[2];
512 int ssg_envmode;
513 int ssg_envadd;
514 int ssg_envcnt[2];
515 int ssg_dir[2];
516 int ssg_hold[2];
517 int ssg_t2[2];
518 int ssg_egtrig;
519 int ssg_egtrig_s;
520 int ssg_egtrig_rst;
521 int ssg_eg_sel_l;
522 int ssg_sel[2];
523 int ssg_sel_freq;
524 int ssg_freq_cnt[8];
525 int ssg_cnt_of[2];
526 int ssg_sign[2];
527 int ssg_sign_toggle;
528 int ssg_cnt_of_l;
529 int ssg_freq_cnt2[8];
530 int ssg_sel_freq_l;
531 int ssg_cnt2_add;
532 int ssg_sel_eg_l[2];
533 int ssg_ch_of;
534 int ssg_cnt_reload;
535 int ssg_eg_of[2];
536 int ssg_fr_rst_l;
537 int ssg_noise_add;
538 int ssg_noise_cnt[2];
539 int ssg_noise_of_low;
540 int ssg_noise_of;
541 int ssg_test;
542 int ssg_noise_step;
543 int ssg_noise_lfsr[2];
544 int ssg_noise_bit;
545
546
547 int rss_cnt1[2];
548 int rss_cnt1_sync;
549
550 int rss_eclk1_l;
551 int rss_eclk2_l;
552 int rss_eclk1;
553 int rss_eclk2;
554 int rss_dclk_l;
555 int rss_fclk_sel[2];
556 int rss_fclk1;
557 int rss_fclk2;
558 int rss_cnt2[2];
559 int rss_fmcnt[2];
560 int rss_fmcnt_of;
561 int rss_fmcnt_sync;
562 int rss_params[2];
563 int rss_tl_sel[2];
564 int rss_tl[2];
565 int rss_keydm[2];
566 int rss_keymask[2];
567 int rss_ic[2];
568 int rss_key[2];
569 int rss_stop[2];
570 int rss_eos_l;
571 #ifdef FMOPNA_YM2608
572 int rss_step;
573 int rss_isend;
574 #endif
575
576 #ifdef FMOPNA_YM2610
577 int rss_address[2];
578 int rss_address_wr[2];
579 int rss_data[2];
580 int rss_data_wr[2];
581 int rss_write08;
582 int rss_write10;
583 int rss_write18;
584 int rss_write20;
585 int rss_write28;
586 unsigned char rss_reg_pan_tl[2][6];
587 unsigned char rss_reg_start_l[2][6];
588 unsigned char rss_reg_start_h[2][6];
589 unsigned char rss_reg_stop_l[2][6];
590 unsigned char rss_reg_stop_h[2][6];
591 int rss_fm_match_l;
592 int rss_params_start[3];
593 int rss_params_start_h;
594 int rss_params_stop[3];
595 int rss_eos_load;
596 int rss_rmpx[2];
597 int rss_roe[4];
598 int rss_rad_bus;
599 int rss_stop_flag[2];
600 #endif
601
602 int rss_accum[2];
603 int rss_regs[2][17];
604
605 int rss_delta_ix_load;
606 int rss_delta_ix;
607 int rss_ix_load;
608 int rss_ix;
609 int rss_cnt1_is1;
610 int rss_nibble;
611 int rss_tl_l;
612 int rss_tl_shift[3];
613
614 int rss_sample_load;
615 int rss_sample;
616 int rss_multi_ctrl[2];
617 int rss_multi_accum[2];
618 int rss_multi_accum_load;
619 int rss_sample_multi;
620 int rss_sample_shift_load;
621 int rss_sample_shift;
622 int rss_dbg_load;
623 int rss_dbg_data;
624
625 int rss_pan[3];
626
627 #ifdef FMOPNA_YM2608
628 int ad_is6;
629 int ad_is7;
630 int ad_is8;
631 int ad_isc;
632 int ad_isd;
633 int ad_ise;
634 int ad_isf;
635 int ad_reg_limit_l;
636 int ad_reg_limit_h;
637 int ad_reg_prescale_l;
638 int ad_reg_prescale_h;
639 int ad_reg_spoff;
640 int ad_reg_memdata;
641 int ad_reg_rec;
642 int ad_reg_rom;
643 int ad_reg_ramtype;
644 int ad_reg_da_ad;
645 int ad_reg_sample;
646 int ad_sample_l[3];
647 int ad_read_port_l[2];
648 int ad_write_port_l[2];
649 int ad_rw_l[2];
650 int ad_rw_en;
651 int ad_rec_start_l[2];
652 int ad_limit_match[2];
653 int ad_limit_match2[2];
654 int ad_mem_sync[2];
655 int ad_mem_sync_run;
656 int ad_mem_ptr_store;
657 int ad_mem_data_l1;
658 int ad_mem_data_l2;
659 int ad_mem_addr_bank;
660 int ad_mem_data_bus;
661 int ad_mem_bit_cnt[2];
662 int ad_mem_shift_cnt0_l[2];
663 int ad_brdy_set_l[2];
664 int ad_mem_rw_en[2];
665 int ad_mem_ucnt[2];
666 int ad_mem_w22;
667 int ad_dsp_ctrl10_l;
668 int ad_dsp_alu_neg[2];
669 int ad_ad_cnt1[2];
670 int ad_ad_cmp_i;
671 int ad_ad_shift;
672 int ad_ad_w53[2];
673 int ad_ad_w55;
674 int ad_ad_w55_l[2];
675 int ad_ad_w56;
676 int ad_ad_buf;
677 int ad_ad_input;
678 int ad_ad_cnt2[2];
679 int ad_ad_w57[3];
680 int ad_ad_w58[3]; // sh2
681 int ad_ad_w60;
682 int ad_ad_w61[2]; // opo
683 int ad_ad_w62[2];
684 int ad_ad_w65_l;
685 int ad_ad_w66[2];
686 int ad_ad_w68;
687 int ad_ad_cnt3[2];
688 int ad_ad_cnt3_load;
689 int ad_ad_cnt3_load_val;
690 int ad_ad_cnt3_of[2];
691 int ad_ad_cnt3_en[2];
692 int ad_ad_quiet;
693 int ad_comp_da;
694 int ad_dsp_enc_bit;
695 int ad_dsp_enc_bit_l[2];
696 int ad_mem_we[2];
697 int ad_mem_cas[2];
698 int ad_mem_ras[2];
699 #else
700 int ad_mem_pmpx[2];
701 int ad_mem_poe[2];
702 #endif
703 int ad_is0;
704 int ad_is1;
705 int ad_is2;
706 int ad_is3;
707 int ad_is4;
708 int ad_is5;
709 int ad_is9;
710 int ad_isa;
711 int ad_isb;
712 int ad_reg_reset;
713 int ad_reg_repeat;
714 int ad_reg_start;
715 int ad_reg_r;
716 int ad_reg_l;
717 int ad_reg_delta_l;
718 int ad_reg_delta_h;
719 int ad_reg_start_l;
720 int ad_reg_start_h;
721 int ad_reg_stop_l;
722 int ad_reg_stop_h;
723 int ad_reg_level;
724 int ad_code_ptr[2];
725 int ad_code_ctrl;
726 int ad_code_ctrl_l;
727 int ad_w2[2];
728 int ad_w4[2];
729 int ad_start_l[3];
730 int ad_w2_l[2];
731 int ad_code_end[2];
732 int ad_addr_isend_l;
733 int ad_addr_isend_l2[2];
734 int ad_mem_ctrl;
735 int ad_mem_ctrl_l;
736 int ad_mem_code_ptr[2];
737 int ad_end_sel[2];
738 int ad_stop_match[2];
739 int ad_stop_match2[2];
740 int ad_start_sel[2];
741 int ad_address_cnt[4][2];
742 int ad_address_carry[2];
743 int ad_mem_cond[2];
744 int ad_mem_bus;
745 int ad_mem_data_l3;
746 int ad_mem_data_l4[2];
747 int ad_mem_w7[2];
748 int ad_mem_shift_cnt[2];
749 int ad_mem_nibble;
750 int ad_mem_w8[2];
751 int ad_mem_nibble_msb;
752 int ad_mem_nibble_load;
753 int ad_mem_mem_en_l[2];
754 int ad_code_ed_end[2];
755 int ad_mem_mem_stop[2];
756 int ad_mem_w10[2];
757 int ad_w12[2];
758 int ad_w13[2];
759 int ad_mem_w15[2];
760 int ad_mem_w17[2];
761 int ad_mem_w20[2];
762 int ad_mem_w21;
763 int ad_mode6_l[2];
764 int ad_dsp_bus;
765 int ad_dsp_ctrl;
766 int ad_dsp_delta_sel[2];
767 int ad_dsp_w30_l[2];
768 int ad_dsp_w31_l[2];
769 int ad_dsp_w32;
770 int ad_dsp_w32_l;
771 int ad_dsp_w33;
772 int ad_dsp_w34;
773 int ad_dsp_w36[2];
774 int ad_dsp_w35_l;
775 int ad_dsp_cnt1[2];
776 int ad_dsp_cnt1_run[2];
777 int ad_dsp_mul_accm1[2];
778 int ad_dsp_mul_accm1_add1;
779 int ad_dsp_mul_accm1_add2;
780 int ad_dsp_mul_accm1_c;
781 int ad_dsp_mul_accm2;
782 int ad_dsp_mul_accm2_add1;
783 int ad_dsp_mul_accm2_add2;
784 int ad_dsp_mul_accm2_load;
785 int ad_dsp_w38[2];
786 int ad_dsp_w40;
787 int ad_dsp_w41[2];
788 int ad_dsp_w43[2];
789 int ad_dsp_w45;
790 int ad_dsp_w46[2];
791 int ad_output;
792 int ad_dsp_cnt2[2];
793 int ad_dsp_load_alu1[2];
794 int ad_dsp_load_alu1_h;
795 int ad_dsp_load_alu2[2];
796 int ad_dsp_alu_in1;
797 int ad_dsp_alu_in2;
798 int ad_dsp_load_res[2];
799 int ad_dsp_alu_res;
800 int ad_dsp_alu_shift;
801 int ad_dsp_alu_mask[2];
802 int ad_dsp_carry_mode[2];
803 int ad_dsp_alu_of;
804 int ad_dsp_read_res[2];
805 int ad_code_sync[3];
806 int ad_dsp_w52[2];
807 int ad_code_reg_id;
808 int ad_dsp_regs[8];
809 int ad_dsp_regs_o;
810 int ad_set_eos;
811 int ad_dsp_vol_o[2];
812 int ad_dsp_sregs2[2][2];
813 int ad_dsp_w69[2];
814 int ad_mem_dir;
815
816 #ifdef FMOPNA_YM2608
817 int ad_da_data;
818 int ac_da_shift[2];
819 int ac_da_w70[2];
820 int ac_da_set[2];
821 int opo_da[2];
822 int opo_ad;
823 #endif
824
825 int ac_fm_output;
826 int ac_fm_output_en;
827 int ac_fm_pan;
828 int ac_fm_accm1[2];
829 int ac_da_sync2;
830 int ac_ad_output;
831 int ac_da_sync;
832 int ac_da_sync3[2];
833 int ac_fm_accm2[2];
834 int ac_rss_sum_l;
835 int ac_rss_sum_r;
836 int ac_rss_accm1[2];
837 int ac_rss_accm2[2];
838 int ac_rss_load;
839 int ac_shifter[2];
840 int ac_shifter_load_l;
841 int ac_shifter_load_r;
842 int ac_shifter_bit;
843 int ac_shifter_top;
844 int ac_opo;
845 int sh1_l;
846 int sh2_l;
847 int opo_fm;
848
849 int last_rss_sample;
850 #endif
851
852 int busy_cnt[2];
853 int busy_cnt_en[2];
854 int status_timer_a;
855 int status_timer_b;
856 int eg_dbg;
857 #ifdef FMOPNA_YM2608
858 int status_brdy;
859 int status_zero;
860 int brdy_flag;
861 int zero_flag;
862 int zero_set;
863 #endif
864 #ifdef FMOPNA_YM2610
865 int flag_rss_0;
866 int flag_rss_1;
867 int flag_rss_2;
868 int flag_rss_3;
869 int flag_rss_4;
870 int flag_rss_5;
871 int status_rss_0;
872 int status_rss_1;
873 int status_rss_2;
874 int status_rss_3;
875 int status_rss_4;
876 int status_rss_5;
877 #endif
878
879 #ifndef FMOPNA_YM2612
880 int status_eos;
881 int eos_flag;
882 int eos_l[2];
883 int eos_repeat;
884 #endif
885
886 #ifdef FMOPNA_YM2612
887 int ch_op_output;
888 int ch_op_add;
889 int ch_accm_load;
890 short ch_accm[2][6];
891 short ch_buf[2][6];
892 int ch_output;
893 int ch_load[2];
894 int ch_sel;
895 int ch_dbg[2];
896 int ch_ch6;
897 int ch_pan;
898 int o_mol;
899 int o_mor;
900 int o_test;
901 int o_test_d;
902 #endif
903
904 #ifdef FMOPNA_YM2608
905 int o_gpio_a;
906 int o_gpio_a_d;
907 int o_gpio_b;
908 int o_gpio_b_d;
909 int o_spoff;
910 int o_a8;
911 int o_romcs; // neg
912 int o_mden;
913 int o_we; // neg
914 int o_cas; // neg
915 int o_ras; // neg
916 int o_dm;
917 int o_dm_d;
918 #endif
919
920 #ifdef FMOPNA_YM2610
921 int o_rmpx;
922 int o_roe; // neg
923 int o_rad;
924 int o_rad_d;
925 int o_ra8;
926 int o_ra20;
927
928 int o_pmpx;
929 int o_poe; // neg
930 int o_pad;
931 int o_pad_d;
932 int o_pa8;
933
934 int ym2610b;
935 #endif
936
937 #ifndef FMOPNA_YM2612
938 float o_analog;
939 float o_analog_ch[3];
940 int o_sh1;
941 int o_sh2;
942 int o_opo;
943 int o_s;
944 #endif
945 int o_irq_pull;
946 int o_data;
947 int o_data_d;
948
949 int tm_w1;
950 }
951 #ifdef FMOPNA_YM2608
952 fmopna_t;
953 #elif defined (FMOPNA_YM2610)
954 fmopna_2610_t;
955 #else
956 fmopna_2612_t;
957 #endif
958
959 #ifdef FMOPNA_YM2608
960 void FMOPNA_Clock(fmopna_t* chip, int clk);
961 #elif defined (FMOPNA_YM2610)
962 void FMOPNA_2610_Clock(fmopna_2610_t* chip, int clk);
963 #else
964 void FMOPNA_2612_Clock(fmopna_2612_t* chip, int clk);
965 #endif
966