diff --git a/Components/6522/6522.hpp b/Components/6522/6522.hpp index e35f6c039..dd5cb5526 100644 --- a/Components/6522/6522.hpp +++ b/Components/6522/6522.hpp @@ -10,6 +10,7 @@ #define _522_hpp #include +#include #include namespace MOS { @@ -52,7 +53,7 @@ template class MOS6522 { inline void set_register(int address, uint8_t value) { address &= 0xf; -// printf("6522 %p: %d <- %02x\n", this, address, value); +// printf("6522 [%s]: %0x <- %02x\n", typeid(*this).name(), address, value); switch(address) { case 0x0: diff --git a/Machines/Commodore/1540/Commodore1540.cpp b/Machines/Commodore/1540/Commodore1540.cpp index eaaadf37b..5fb1840f2 100644 --- a/Machines/Commodore/1540/Commodore1540.cpp +++ b/Machines/Commodore/1540/Commodore1540.cpp @@ -72,5 +72,6 @@ void Machine::set_rom(const uint8_t *rom) void Machine::mos6522_did_change_interrupt_status(void *mos6522) { + printf("?"); set_irq_line(_serialPortVIA->get_interrupt_line() || _driveVIA.get_interrupt_line()); } diff --git a/Machines/Commodore/1540/Commodore1540.hpp b/Machines/Commodore/1540/Commodore1540.hpp index dae51c38f..73659d738 100644 --- a/Machines/Commodore/1540/Commodore1540.hpp +++ b/Machines/Commodore/1540/Commodore1540.hpp @@ -20,7 +20,7 @@ class SerialPortVIA: public MOS::MOS6522, public MOS::MOS6522IRQD public: using MOS6522IRQDelegate::set_interrupt_status; - SerialPortVIA() : _portB(0x1f) {} + SerialPortVIA() : _portB(0x9f) {} uint8_t get_port_input(Port port) { if(port) { @@ -48,8 +48,8 @@ class SerialPortVIA: public MOS::MOS6522, public MOS::MOS6522IRQD // printf("1540 Serial port line %d: %s\n", line, value ? "on" : "off"); switch(line) { default: break; - case ::Commodore::Serial::Line::Data: _portB = (_portB & ~0x01) | (value ? 0 : 0x01); break; - case ::Commodore::Serial::Line::Clock: _portB = (_portB & ~0x04) | (value ? 0 : 0x04); break; + case ::Commodore::Serial::Line::Data: _portB = (_portB & ~0x01) | (value ? 0x00 : 0x01); break; + case ::Commodore::Serial::Line::Clock: _portB = (_portB & ~0x04) | (value ? 0x00 : 0x04); break; case ::Commodore::Serial::Line::Attention: _portB = (_portB & ~0x80) | (value ? 0 : 0x80); set_control_line_input(Port::A, Line::One, !value); // truth here is active low; the 6522 takes true to be high @@ -69,6 +69,10 @@ class SerialPortVIA: public MOS::MOS6522, public MOS::MOS6522IRQD class DriveVIA: public MOS::MOS6522, public MOS::MOS6522IRQDelegate { public: using MOS6522IRQDelegate::set_interrupt_status; + + uint8_t get_port_input(Port port) { + return 0xff; + } }; class SerialPort : public ::Commodore::Serial::Port { diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 60b8838ca..ae251f6d1 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -96,7 +96,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin *value = result; // test for PC at F92F - if(_use_fast_tape_hack && address == 0xf92f && operation == CPU6502::BusOperation::ReadOpcode) + if(_use_fast_tape_hack && _tape.has_tape() && address == 0xf92f && operation == CPU6502::BusOperation::ReadOpcode) { // advance time on the tape and the VIAs until an interrupt is signalled while(!_userPortVIA->get_interrupt_line() && !_keyboardVIA->get_interrupt_line()) @@ -157,7 +157,11 @@ void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data) case Characters: target = _characterROM; max_length = 0x1000; break; case BASIC: target = _basicROM; break; case Drive: - if(_c1540) _c1540->set_rom(data); + if(_c1540) + { + _c1540->set_rom(data); + _c1540->run_for_cycles(2000000); // pretend it booted a couple of seconds ago + } return; } diff --git a/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift b/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift index bbf5ddaee..e74f67274 100644 --- a/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift +++ b/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift @@ -32,7 +32,7 @@ class Vic20Document: MachineDocument { vic20.setCharactersROM(characters) } - if let drive = dataForResource("1540", ofType: "bin", inDirectory: "ROMImages/Commodore1540") { + if let drive = dataForResource("1541", ofType: "bin", inDirectory: "ROMImages/Commodore1540") { vic20.setDriveROM(drive) } } diff --git a/Processors/6502/CPU6502.hpp b/Processors/6502/CPU6502.hpp index 3c4a608ef..4b0434eb8 100644 --- a/Processors/6502/CPU6502.hpp +++ b/Processors/6502/CPU6502.hpp @@ -666,6 +666,7 @@ template class Processor { break; case OperationDecodeOperation: +// printf("d %02x\n", _operation); decode_operation(_operation); break;