diff --git a/src/dev/audio/speaker.c b/src/dev/audio/speaker.c index 3461cd8..1477025 100644 --- a/src/dev/audio/speaker.c +++ b/src/dev/audio/speaker.c @@ -16,6 +16,7 @@ #include "speaker.h" #include "6502.h" +#include "disk.h" // to be able to disable disk acceleration #define min(x,y) (x) < (y) ? (x) : (y) @@ -143,6 +144,12 @@ void spkr_toggle() { spkr_play_time = 0; + if ( diskAccelerator_count ) { + // turn off disk acceleration immediately + diskAccelerator_count = 0; + clk_6502_per_frm = clk_6502_per_frm_max = clk_6502_per_frm_set; + } + if ( clk_6502_per_frm_set < clk_6502_per_frm_max_sound ) { spkr_play_time = spkr_play_timeout; diff --git a/src/dev/disk/disk.h b/src/dev/disk/disk.h index 24e9f23..2aa3155 100644 --- a/src/dev/disk/disk.h +++ b/src/dev/disk/disk.h @@ -57,6 +57,9 @@ extern const int diskAccelerator_frames; // number of frames disk acceleratio 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 const unsigned long long clk_6502_per_frm_diskAccelerator; //extern const unsigned long long clk_diskAcceleratorTimeout;