From 264b8dfb288f760e3278995845d97b74584793fe Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 6 Jul 2021 23:11:30 -0400 Subject: [PATCH 1/3] Dave: apply ring modulation even in sync mode. --- Machines/Enterprise/Dave.cpp | 37 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/Machines/Enterprise/Dave.cpp b/Machines/Enterprise/Dave.cpp index 39a152630..f4aa8e3bb 100644 --- a/Machines/Enterprise/Dave.cpp +++ b/Machines/Enterprise/Dave.cpp @@ -21,12 +21,14 @@ void Audio::write(uint16_t address, uint8_t value) { switch(address) { case 0: case 2: case 4: channels_[address >> 1].reload = (channels_[address >> 1].reload & 0xff00) | value; + printf("Low Channel %d -> %04x\n", address >> 1, channels_[address >> 1].reload); break; case 1: case 3: case 5: channels_[address >> 1].reload = uint16_t((channels_[address >> 1].reload & 0x00ff) | ((value & 0xf) << 8)); channels_[address >> 1].distortion = Channel::Distortion((value >> 4)&3); channels_[address >> 1].high_pass = value & 0x40; channels_[address >> 1].ring_modulate = value & 0x80; + printf("High Channel %d -> %04x\n", address >> 1, channels_[address >> 1].reload); break; case 6: noise_.frequency = Noise::Frequency(value&3); @@ -44,6 +46,8 @@ void Audio::write(uint16_t address, uint8_t value) { use_direct_output_[0] = value & 0x08; use_direct_output_[1] = value & 0x10; // Interrupt bits are handled separately. + + printf("A7: %02x\n", value); break; case 8: case 9: case 10: @@ -69,30 +73,31 @@ void Audio::set_sample_volume_range(int16_t range) { } void Audio::update_channel(int c) { - if(channels_[c].sync) { - channels_[c].count = channels_[c].reload; - channels_[c].output <<= 1; - return; - } - auto output = channels_[c].output & 1; channels_[c].output <<= 1; - if(!channels_[c].count) { + if(channels_[c].sync) { channels_[c].count = channels_[c].reload; + output = 0; + } else { + if(!channels_[c].count) { + channels_[c].count = channels_[c].reload; - if(channels_[c].distortion == Channel::Distortion::None) - output ^= 1; - else - output = poly_state_[int(channels_[c].distortion)]; + if(channels_[c].distortion == Channel::Distortion::None) + output ^= 1; + else + output = poly_state_[int(channels_[c].distortion)]; + } else { + --channels_[c].count; + } if(channels_[c].high_pass && (channels_[(c+1)%3].output&3) == 2) { output = 0; } - if(channels_[c].ring_modulate) { - output = ~(output ^ channels_[(c+2)%3].output) & 1; - } - } else { - --channels_[c].count; + } + + // Ring modulation applies even when sync is enabled, per SIDBasic. + if(channels_[c].ring_modulate) { + output = ~(output ^ channels_[(c+2)%3].output) & 1; } channels_[c].output |= output; From 0e49258546b80f3d7b0724426573f6a8dd17011b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 6 Jul 2021 23:15:53 -0400 Subject: [PATCH 2/3] Remove caveman debugging. --- Machines/Enterprise/Dave.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Machines/Enterprise/Dave.cpp b/Machines/Enterprise/Dave.cpp index f4aa8e3bb..09476ac21 100644 --- a/Machines/Enterprise/Dave.cpp +++ b/Machines/Enterprise/Dave.cpp @@ -21,14 +21,12 @@ void Audio::write(uint16_t address, uint8_t value) { switch(address) { case 0: case 2: case 4: channels_[address >> 1].reload = (channels_[address >> 1].reload & 0xff00) | value; - printf("Low Channel %d -> %04x\n", address >> 1, channels_[address >> 1].reload); break; case 1: case 3: case 5: channels_[address >> 1].reload = uint16_t((channels_[address >> 1].reload & 0x00ff) | ((value & 0xf) << 8)); channels_[address >> 1].distortion = Channel::Distortion((value >> 4)&3); channels_[address >> 1].high_pass = value & 0x40; channels_[address >> 1].ring_modulate = value & 0x80; - printf("High Channel %d -> %04x\n", address >> 1, channels_[address >> 1].reload); break; case 6: noise_.frequency = Noise::Frequency(value&3); @@ -46,8 +44,6 @@ void Audio::write(uint16_t address, uint8_t value) { use_direct_output_[0] = value & 0x08; use_direct_output_[1] = value & 0x10; // Interrupt bits are handled separately. - - printf("A7: %02x\n", value); break; case 8: case 9: case 10: From 30fbb6ea53d58ebb5627658711af81f0c870b955 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 6 Jul 2021 23:16:16 -0400 Subject: [PATCH 3/3] Ensure run command is issued. --- Analyser/Static/Enterprise/StaticAnalyser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Analyser/Static/Enterprise/StaticAnalyser.cpp b/Analyser/Static/Enterprise/StaticAnalyser.cpp index e4ff7ef8e..5e1dd9acb 100644 --- a/Analyser/Static/Enterprise/StaticAnalyser.cpp +++ b/Analyser/Static/Enterprise/StaticAnalyser.cpp @@ -67,7 +67,7 @@ Analyser::Static::TargetList Analyser::Static::Enterprise::GetTargets(const Medi if(!has_exdos_ini) { if(did_pick_file) { - target->loading_command = std::string("run \"") + selected_file->name + "." + selected_file->extension + "\""; + target->loading_command = std::string("run \"") + selected_file->name + "." + selected_file->extension + "\"\n"; } else { target->loading_command = ":dir\n"; }