From 18744cd98b4e44181ff320ce830a8b524299d7f9 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 1 Aug 2016 04:37:30 -0400 Subject: [PATCH] Slightly updated comments, switched to 1540 ROM so as very slightly to improve loading time. --- Machines/Commodore/1540/C1540.hpp | 20 ++++++++----------- .../Documents/Vic20Document.swift | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Machines/Commodore/1540/C1540.hpp b/Machines/Commodore/1540/C1540.hpp index 7082e7a3f..f052ea7bc 100644 --- a/Machines/Commodore/1540/C1540.hpp +++ b/Machines/Commodore/1540/C1540.hpp @@ -101,11 +101,11 @@ class SerialPortVIA: public MOS::MOS6522, public MOS::MOS6522IRQD An implementation of the drive VIA in a Commodore 1540 — the VIA that is used to interface with the disk. It is wired up such that Port B contains: - Bits 0/1: head step direction (TODO) - Bit 2: motor control (TODO) + Bits 0/1: head step direction + Bit 2: motor control Bit 3: LED control (TODO) Bit 4: write protect photocell status (TODO) - Bits 5/6: write density (TODO) + Bits 5/6: read/write density Bit 7: 0 if sync marks are currently being detected, 1 otherwise. ... and Port A contains the byte most recently read from the disk or the byte next to write to the disk, depending on data direction. @@ -159,24 +159,25 @@ class DriveVIA: public MOS::MOS6522, public MOS::MOS6522IRQDelegate { void set_port_output(Port port, uint8_t value, uint8_t direction_mask) { if(port) { + // record drive motor state _drive_motor = !!(value&4); -// if(value&4) -// { + // check for a head step int step_difference = ((value&3) - (_previous_port_b_output&3))&3; if(step_difference) { if(_delegate) _delegate->drive_via_did_step_head(this, (step_difference == 1) ? 1 : -1); } + // check for a change in density int density_difference = (_previous_port_b_output^value) & (3 << 5); if(density_difference && _delegate) { _delegate->drive_via_did_set_data_density(this, (value >> 5)&3); } + + // TODO: something with the drive LED // printf("LED: %s\n", value&8 ? "On" : "Off"); -// printf("Density: %d\n", (value >> 5)&3); -// } _previous_port_b_output = value; } @@ -230,11 +231,6 @@ class Machine: */ void set_serial_bus(std::shared_ptr<::Commodore::Serial::Bus> serial_bus); - /*! - Sets the disk from which this 1540 is reading data. - */ -// void set_disk(std::shared_ptr disk); - void run_for_cycles(int number_of_cycles); // to satisfy CPU6502::Processor diff --git a/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift b/OSBindings/Mac/Clock Signal/Documents/Vic20Document.swift index 42e9b97ed..0c446427c 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("1541", ofType: "bin", inDirectory: "ROMImages/Commodore1540") { + if let drive = dataForResource("1540", ofType: "bin", inDirectory: "ROMImages/Commodore1540") { vic20.setDriveROM(drive) } }