annotate ymf262.h @ 2688:b42f00a3a937 default tip

Fix default target. Ensure m68k.h and z80.h are built before anything else when no dep info is available
author Michael Pavone <pavone@retrodev.com>
date Mon, 31 Mar 2025 21:06:18 -0700
parents 3f58fec775df
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2558
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef YMF262_H_
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define YMF262_H_
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #include "ym_common.h"
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 #include "render_audio.h"
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 #include "vgm.h"
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 #include "oscilloscope.h"
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 #define OPL3_NUM_CHANNELS 18
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 #define OPL3_NUM_OPERATORS (2*OPL3_NUM_CHANNELS)
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 #define OPL3_PARAM_START 0x20
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 #define OPL3_PARAM_END 0xF6
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 #define OPL3_PARAM_REGS (OPL3_PARAM_END - OPL3_PARAM_START)
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 typedef struct {
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 audio_source *audio;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 vgm_writer *vgm;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 oscilloscope *scope;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 uint32_t clock_inc;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 uint32_t cycle;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 int32_t volume_mult;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 int32_t volume_div;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23 ym_operator operators[OPL3_NUM_OPERATORS];
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24 ym_channel channels[OPL3_NUM_CHANNELS];
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 uint8_t part1_regs[OPL3_PARAM_REGS];
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 uint8_t part2_regs[OPL3_PARAM_REGS];
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 uint8_t timer_test[4];
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 uint8_t nts;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29 uint8_t connection_sel;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 uint8_t opl3_mode;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 uint8_t part2_test;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 uint8_t status;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 uint8_t current_op;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 uint8_t selected_reg;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 uint8_t selected_part;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 } ymf262_context;
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 void ymf262_init(ymf262_context *context, uint32_t master_clock, uint32_t clock_div, uint32_t options);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39 void ymf262_reset(ymf262_context *context);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40 void ymf262_free(ymf262_context *context);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41 void ymf262_adjust_master_clock(ymf262_context *context, uint32_t master_clock);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
42 void ymf262_adjust_cycles(ymf262_context *context, uint32_t deduction);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
43 void ymf262_run(ymf262_context *context, uint32_t to_cycle);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
44 void ymf262_address_write_part1(ymf262_context *context, uint8_t address);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
45 void ymf262_address_write_part2(ymf262_context *context, uint8_t address);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
46 void ymf262_data_write(ymf262_context *context, uint8_t value);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
47 void ymf262_vgm_log(ymf262_context *context, uint32_t master_clock, vgm_writer *vgm);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
48 uint8_t ymf262_read_status(ymf262_context *context, uint32_t cycle, uint32_t port);
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
49
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
50
3f58fec775df Initial work on YMF262 (aka OPL3) emulation
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
51 #endif // YMF262_H_