From 6d464557a0c1925364242c9d001dd0be036fe359 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 26 Mar 2018 21:06:07 -0400 Subject: [PATCH] Reintroduces a warm-up run for the C1540. That simulates the normal real-life scenario of switching the drive on slightly before the computer, and causes it to function correctly from immediate fast typing on an American Vic. Also switches a couple of casts within the C1540 to functional style. --- Machines/Commodore/1540/Implementation/C1540.cpp | 8 +++++--- Machines/Commodore/Vic-20/Vic20.cpp | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Machines/Commodore/1540/Implementation/C1540.cpp b/Machines/Commodore/1540/Implementation/C1540.cpp index 1321a2920..f1677ef3b 100644 --- a/Machines/Commodore/1540/Implementation/C1540.cpp +++ b/Machines/Commodore/1540/Implementation/C1540.cpp @@ -165,14 +165,15 @@ void SerialPortVIA::set_port_output(MOS::MOS6522::Port port, uint8_t value, uint attention_acknowledge_level_ = !(value&0x10); data_level_output_ = (value&0x02); - serialPort->set_output(::Commodore::Serial::Line::Clock, (::Commodore::Serial::LineLevel)!(value&0x08)); +// printf("[C1540] %s output is %s\n", StringForLine(::Commodore::Serial::Line::Clock), value ? "high" : "low"); + serialPort->set_output(::Commodore::Serial::Line::Clock, static_cast<::Commodore::Serial::LineLevel>(!(value&0x08))); update_data_line(); } } } void SerialPortVIA::set_serial_line_state(::Commodore::Serial::Line line, bool value) { -// printf("[C1540] %s is %s\n", StringForLine(line), value ? "high" : "low"); +// printf("[C1540] %s input is %s\n", StringForLine(line), value ? "high" : "low"); switch(line) { default: break; @@ -194,9 +195,10 @@ void SerialPortVIA::set_serial_port(const std::shared_ptr<::Commodore::Serial::P void SerialPortVIA::update_data_line() { std::shared_ptr<::Commodore::Serial::Port> serialPort = serial_port_.lock(); if(serialPort) { +// printf("[C1540] %s output is %s\n", StringForLine(::Commodore::Serial::Line::Data), (!data_level_output_ && (attention_level_input_ != attention_acknowledge_level_)) ? "high" : "low"); // "ATN (Attention) is an input on pin 3 of P2 and P3 that is sensed at PB7 and CA1 of UC3 after being inverted by UA1" serialPort->set_output(::Commodore::Serial::Line::Data, - (::Commodore::Serial::LineLevel)(!data_level_output_ && (attention_level_input_ != attention_acknowledge_level_))); + static_cast<::Commodore::Serial::LineLevel>(!data_level_output_ && (attention_level_input_ != attention_acknowledge_level_))); } } diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index b29dce0a3..094a259f4 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -383,6 +383,9 @@ class ConcreteMachine: // give it a means to obtain its ROM c1540_->set_rom_fetcher(rom_fetcher_); + + // give it a little warm up + c1540_->run_for(Cycles(2000000)); } insert_media(target->media); @@ -460,7 +463,6 @@ class ConcreteMachine: switch(memory_model) { default: break; case Analyser::Static::Commodore::Target::MemoryModel::EightKB: - // TODO: is this 3kb or 8kb? write_to_map(processor_read_memory_map_, expansion_ram_, 0x0000, 0x1000); write_to_map(processor_write_memory_map_, expansion_ram_, 0x0000, 0x1000); break;