From 8f62211f5e57aca5f9b31fa3544f7280b1a0655a Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 29 Jul 2016 12:08:18 -0400 Subject: [PATCH] =?UTF-8?q?Wired=20up=20the=201540=20as=20a=20PLL=20delega?= =?UTF-8?q?te.=20Which=20prima=20facie=20means=20it=20should=20start=20rec?= =?UTF-8?q?eiving=20a=20bit=20stream.=20Except=20that=20I=20clearly=20have?= =?UTF-8?q?=20something=20in=20the=20timing=20way=20off=20=E2=80=94=20eith?= =?UTF-8?q?er=20my=20flux=20transitions=20are=20far=20too=20short=20or=20I?= =?UTF-8?q?=20need=20to=20significantly=20increase=20the=20clock=20rate=20?= =?UTF-8?q?on=20the=20PLL.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Machines/Commodore/1540/C1540.cpp | 8 ++++++++ Storage/Disk/DiskDrive.cpp | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Machines/Commodore/1540/C1540.cpp b/Machines/Commodore/1540/C1540.cpp index fe1f80bd6..9f2cb4aa5 100644 --- a/Machines/Commodore/1540/C1540.cpp +++ b/Machines/Commodore/1540/C1540.cpp @@ -116,6 +116,14 @@ void Machine::mos6522_did_change_interrupt_status(void *mos6522) void Machine::process_input_bit(int value, unsigned int cycles_since_index_hole) { _shift_register = (_shift_register >> 1) | (value << 10); + + static int bitCount = 0; + bitCount++; + if(bitCount == 8) + { + printf("%02x.", _shift_register&0xff); + bitCount = 0; + } } // the 1540 does not recognise index holes diff --git a/Storage/Disk/DiskDrive.cpp b/Storage/Disk/DiskDrive.cpp index 1a98abe57..ee5f5b298 100644 --- a/Storage/Disk/DiskDrive.cpp +++ b/Storage/Disk/DiskDrive.cpp @@ -26,6 +26,7 @@ void DiskDrive::set_expected_bit_length(Time bit_length) // account of in rotation speed, air turbulence, etc, so a direct conversion will do int clocks_per_bit = (int)((bit_length.length * _clock_rate) / bit_length.clock_rate); _pll.reset(new DigitalPhaseLockedLoop(clocks_per_bit, clocks_per_bit / 5, 3)); + _pll->set_delegate(this); } void DiskDrive::set_disk(std::shared_ptr disk) @@ -61,7 +62,8 @@ void DiskDrive::run_for_cycles(int number_of_cycles) { if(has_disk()) { - _cycles_since_index_hole += number_of_cycles; + _cycles_since_index_hole += (unsigned int)number_of_cycles; + _pll->run_for_cycles(number_of_cycles); TimedEventLoop::run_for_cycles(number_of_cycles); } }