1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-28 22:30:30 +00:00

Merge pull request #294 from TomHarte/Vic20Startup

Corrects application Vic-20 startup issues.
This commit is contained in:
Thomas Harte 2017-11-21 18:26:16 -08:00 committed by GitHub
commit 89c3e2ba5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 11 deletions

View File

@ -410,17 +410,15 @@ class ConcreteMachine:
needs_configuration_ = true; needs_configuration_ = true;
} }
void configure_memory() { void set_ntsc_6560() {
// Determine PAL/NTSC
if(region_ == American || region_ == Japanese) {
// NTSC
set_clock_rate(1022727); set_clock_rate(1022727);
if(mos6560_) { if(mos6560_) {
mos6560_->set_output_mode(MOS::MOS6560<Commodore::Vic20::Vic6560>::OutputMode::NTSC); mos6560_->set_output_mode(MOS::MOS6560<Commodore::Vic20::Vic6560>::OutputMode::NTSC);
mos6560_->set_clock_rate(1022727); mos6560_->set_clock_rate(1022727);
} }
} else { }
// PAL
void set_pal_6560() {
set_clock_rate(1108404); set_clock_rate(1108404);
if(mos6560_) { if(mos6560_) {
mos6560_->set_output_mode(MOS::MOS6560<Commodore::Vic20::Vic6560>::OutputMode::PAL); mos6560_->set_output_mode(MOS::MOS6560<Commodore::Vic20::Vic6560>::OutputMode::PAL);
@ -428,6 +426,16 @@ class ConcreteMachine:
} }
} }
void configure_memory() {
// Determine PAL/NTSC
if(region_ == American || region_ == Japanese) {
// NTSC
set_ntsc_6560();
} else {
// PAL
set_pal_6560();
}
memset(processor_read_memory_map_, 0, sizeof(processor_read_memory_map_)); memset(processor_read_memory_map_, 0, sizeof(processor_read_memory_map_));
memset(processor_write_memory_map_, 0, sizeof(processor_write_memory_map_)); memset(processor_write_memory_map_, 0, sizeof(processor_write_memory_map_));
memset(mos6560_->video_memory_map, 0, sizeof(mos6560_->video_memory_map)); memset(mos6560_->video_memory_map, 0, sizeof(mos6560_->video_memory_map));
@ -610,6 +618,8 @@ class ConcreteMachine:
void setup_output(float aspect_ratio) override final { void setup_output(float aspect_ratio) override final {
mos6560_.reset(new Vic6560()); mos6560_.reset(new Vic6560());
mos6560_->get_speaker()->set_high_frequency_cut_off(1600); // There is a 1.6Khz low-pass filter in the Vic-20. mos6560_->get_speaker()->set_high_frequency_cut_off(1600); // There is a 1.6Khz low-pass filter in the Vic-20.
// Make a guess: PAL. Without setting a clock rate the 6560 isn't fully set up so contractually something must be set.
set_pal_6560();
} }
void close_output() override final { void close_output() override final {

View File

@ -114,7 +114,8 @@ class Speaker {
bool coefficients_are_dirty_; bool coefficients_are_dirty_;
Delegate *delegate_ = nullptr; Delegate *delegate_ = nullptr;
float input_cycles_per_second_, output_cycles_per_second_; float input_cycles_per_second_ = 0.0f;
float output_cycles_per_second_ = 0.0f;
void set_needs_updated_filter_coefficients() { void set_needs_updated_filter_coefficients() {
coefficients_are_dirty_ = true; coefficients_are_dirty_ = true;