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