comparison ym2612.h @ 1904:8312e574100a

Implement selectable YM2612/YM3834 invalid status port behavior
author Michael Pavone <pavone@retrodev.com>
date Wed, 26 Feb 2020 22:40:37 -0800
parents 32a3aa7b4a45
children 508522f08e4d
comparison
equal deleted inserted replaced
1903:62166274e6c0 1904:8312e574100a
14 #define NUM_PART_REGS (0xB7-0x30) 14 #define NUM_PART_REGS (0xB7-0x30)
15 #define NUM_CHANNELS 6 15 #define NUM_CHANNELS 6
16 #define NUM_OPERATORS (4*NUM_CHANNELS) 16 #define NUM_OPERATORS (4*NUM_CHANNELS)
17 17
18 #define YM_OPT_WAVE_LOG 1 18 #define YM_OPT_WAVE_LOG 1
19 #define YM_OPT_3834 2
19 20
20 typedef struct { 21 typedef struct {
21 int16_t *mod_src[2]; 22 int16_t *mod_src[2];
22 uint32_t phase_counter; 23 uint32_t phase_counter;
23 uint32_t phase_inc; 24 uint32_t phase_inc;
70 uint32_t clock_inc; 71 uint32_t clock_inc;
71 uint32_t current_cycle; 72 uint32_t current_cycle;
72 uint32_t write_cycle; 73 uint32_t write_cycle;
73 uint32_t busy_start; 74 uint32_t busy_start;
74 uint32_t busy_cycles; 75 uint32_t busy_cycles;
76 uint32_t last_status_cycle;
77 uint32_t invalid_status_decay;
78 uint32_t status_address_mask;
75 int32_t volume_mult; 79 int32_t volume_mult;
76 int32_t volume_div; 80 int32_t volume_div;
77 ym_operator operators[NUM_OPERATORS]; 81 ym_operator operators[NUM_OPERATORS];
78 ym_channel channels[NUM_CHANNELS]; 82 ym_channel channels[NUM_CHANNELS];
79 int16_t zero_offset; 83 int16_t zero_offset;
95 uint8_t lfo_counter; 99 uint8_t lfo_counter;
96 uint8_t lfo_am_step; 100 uint8_t lfo_am_step;
97 uint8_t lfo_pm_step; 101 uint8_t lfo_pm_step;
98 uint8_t csm_keyon; 102 uint8_t csm_keyon;
99 uint8_t status; 103 uint8_t status;
104 uint8_t last_status;
100 uint8_t selected_reg; 105 uint8_t selected_reg;
101 uint8_t selected_part; 106 uint8_t selected_part;
102 uint8_t part1_regs[YM_PART1_REGS]; 107 uint8_t part1_regs[YM_PART1_REGS];
103 uint8_t part2_regs[YM_PART2_REGS]; 108 uint8_t part2_regs[YM_PART2_REGS];
104 } ym2612_context; 109 } ym2612_context;
137 void ym_adjust_cycles(ym2612_context *context, uint32_t deduction); 142 void ym_adjust_cycles(ym2612_context *context, uint32_t deduction);
138 void ym_run(ym2612_context * context, uint32_t to_cycle); 143 void ym_run(ym2612_context * context, uint32_t to_cycle);
139 void ym_address_write_part1(ym2612_context * context, uint8_t address); 144 void ym_address_write_part1(ym2612_context * context, uint8_t address);
140 void ym_address_write_part2(ym2612_context * context, uint8_t address); 145 void ym_address_write_part2(ym2612_context * context, uint8_t address);
141 void ym_data_write(ym2612_context * context, uint8_t value); 146 void ym_data_write(ym2612_context * context, uint8_t value);
142 uint8_t ym_read_status(ym2612_context * context, uint32_t cycle); 147 uint8_t ym_read_status(ym2612_context * context, uint32_t cycle, uint32_t port);
143 uint8_t ym_load_gst(ym2612_context * context, FILE * gstfile); 148 uint8_t ym_load_gst(ym2612_context * context, FILE * gstfile);
144 uint8_t ym_save_gst(ym2612_context * context, FILE * gstfile); 149 uint8_t ym_save_gst(ym2612_context * context, FILE * gstfile);
145 void ym_print_channel_info(ym2612_context *context, int channel); 150 void ym_print_channel_info(ym2612_context *context, int channel);
146 void ym_print_timer_info(ym2612_context *context); 151 void ym_print_timer_info(ym2612_context *context);
147 void ym_serialize(ym2612_context *context, serialize_buffer *buf); 152 void ym_serialize(ym2612_context *context, serialize_buffer *buf);