From 3ef337771b399d883957ed485563eb86607f3541 Mon Sep 17 00:00:00 2001 From: tudnai Date: Thu, 11 Jun 2020 22:44:53 -0700 Subject: [PATCH] Disk Accelerator enable soft switch --- A2Mac/ViewController.swift | 6 ++++-- src/dev/disk/disk.c | 4 ++-- src/dev/disk/disk.h | 7 +------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/A2Mac/ViewController.swift b/A2Mac/ViewController.swift index c585e59..6ceaca1 100644 --- a/A2Mac/ViewController.swift +++ b/A2Mac/ViewController.swift @@ -891,10 +891,12 @@ class ViewController: NSViewController { @IBAction func QuickDisk(_ sender: NSButton) { if sender.state == .on { - diskAccelerator_speed = Int32( 25 * M / Double(fps) ) +// diskAccelerator_speed = Int32( 25 * M / Double(fps) ) + diskAccelerator_enabled = 1; } else { - diskAccelerator_speed = 0 +// diskAccelerator_speed = 0 + diskAccelerator_enabled = 0; } } diff --git a/src/dev/disk/disk.c b/src/dev/disk/disk.c index 7cbdb1d..a2791e6 100644 --- a/src/dev/disk/disk.c +++ b/src/dev/disk/disk.c @@ -21,7 +21,7 @@ disk_t disk = { const int diskAccelerator_frames = 2; int diskAccelerator_count = 0; int diskAccelerator_speed = 25 * M / fps; // if less than actual CPU speed means no acceleration - +int diskAccelerator_enabled = 1; // motor position from the magnet state // -1 means invalid, not supported @@ -68,7 +68,7 @@ const uint8_t log2phy_cpm[16] = { void disk_accelerator_speedup() { - if ( diskAccelerator_speed >= clk_6502_per_frm ) { + if ( ( diskAccelerator_enabled ) && ( diskAccelerator_speed >= clk_6502_per_frm ) ) { clk_6502_per_frm = clk_6502_per_frm_max = diskAccelerator_speed; // clk_6502_per_frm_diskAccelerator; diskAccelerator_count = diskAccelerator_frames; diff --git a/src/dev/disk/disk.h b/src/dev/disk/disk.h index 5d6e178..37a27f5 100644 --- a/src/dev/disk/disk.h +++ b/src/dev/disk/disk.h @@ -56,12 +56,7 @@ extern const int position_to_direction[8][8]; extern const int diskAccelerator_frames; // number of frames disk acceleration will be on extern int diskAccelerator_count; // counter for the disk acceleration frames extern int diskAccelerator_speed; // if less than the actual CPU speed, no acceleration - -extern int diskAccelerator_count; -extern int diskAccelerator_speed; - -//extern const unsigned long long clk_6502_per_frm_diskAccelerator; -//extern const unsigned long long clk_diskAcceleratorTimeout; +extern int diskAccelerator_enabled; extern void disk_phase(void); extern void disk_phase_on( uint8_t currentMagnet );