1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-09 17:29:36 +00:00

Support reset.

This commit is contained in:
Thomas Harte 2024-02-14 22:22:42 -05:00
parent 0103761b7b
commit be11f31d5d
3 changed files with 24 additions and 7 deletions

View File

@ -376,6 +376,19 @@ void AY38910SampleSource<is_stereo>::set_control_lines(ControlLines control_line
update_bus();
}
template <bool is_stereo>
void AY38910SampleSource<is_stereo>::reset() {
// TODO: the below is a guess. Look up real answers.
selected_register_ = 0;
std::fill(registers_, registers_ + 16, 0);
task_queue_.enqueue([&] {
std::fill(output_registers_, output_registers_ + 16, 0);
evaluate_output_volume();
});
}
template <bool is_stereo>
void AY38910SampleSource<is_stereo>::update_bus() {
// Assume no output, unless this turns out to be a read.

View File

@ -81,6 +81,9 @@ template <bool stereo> class AY38910SampleSource {
/// Sets the current control line state, as a bit field.
void set_control_lines(ControlLines control_lines);
/// Strobes the reset line.
void reset();
/*!
Gets the value that would appear on the requested interface port if it were in output mode.
@parameter port_b @c true to get the value for Port B, @c false to get the value for Port A.
@ -116,12 +119,12 @@ template <bool stereo> class AY38910SampleSource {
Concurrency::AsyncTaskQueue<false> &task_queue_;
int selected_register_ = 0;
uint8_t registers_[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t output_registers_[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t registers_[16]{};
uint8_t output_registers_[16]{};
int tone_periods_[3] = {0, 0, 0};
int tone_counters_[3] = {0, 0, 0};
int tone_outputs_[3] = {0, 0, 0};
int tone_periods_[3]{};
int tone_counters_[3]{};
int tone_outputs_[3]{};
int noise_period_ = 0;
int noise_counter_ = 0;

View File

@ -107,8 +107,9 @@ class Mockingboard: public Card {
)
);
// TODO: all lines disabled sees to map to reset? Possibly?
// Cf. https://gswv.apple2.org.za/a2zine/Docs/Mockingboard_MiniManual.html
if(!value) {
ay.reset();
}
} else {
ay.set_data_input(value);
}