1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Since the ROM is well disassembled, let's actually try to be a 1541 first.

This commit is contained in:
Thomas Harte 2016-07-06 22:17:32 -04:00
parent 4f174786b5
commit 1baf21827c
6 changed files with 18 additions and 7 deletions

View File

@ -10,6 +10,7 @@
#define _522_hpp
#include <cstdint>
#include <typeinfo>
#include <cstdio>
namespace MOS {
@ -52,7 +53,7 @@ template <class T> 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:

View File

@ -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());
}

View File

@ -20,7 +20,7 @@ class SerialPortVIA: public MOS::MOS6522<SerialPortVIA>, 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<SerialPortVIA>, 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<SerialPortVIA>, public MOS::MOS6522IRQD
class DriveVIA: public MOS::MOS6522<DriveVIA>, public MOS::MOS6522IRQDelegate {
public:
using MOS6522IRQDelegate::set_interrupt_status;
uint8_t get_port_input(Port port) {
return 0xff;
}
};
class SerialPort : public ::Commodore::Serial::Port {

View File

@ -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;
}

View File

@ -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)
}
}

View File

@ -666,6 +666,7 @@ template <class T> class Processor {
break;
case OperationDecodeOperation:
// printf("d %02x\n", _operation);
decode_operation(_operation);
break;