- Fixed disk acceleration algorithm

- Some tiny speed optimizations
This commit is contained in:
tudnai 2020-05-02 22:04:22 -07:00
parent e18bc9653e
commit 368dd13309
3 changed files with 9 additions and 9 deletions

View File

@ -35,7 +35,7 @@ unsigned long long int inst_cnt = 0;
//const unsigned int fps = 30;
const unsigned long long default_MHz_6502 = 1.023 * M; // 2 * M; // 4 * M; // 8 * M; // 16 * M; // 128 * M; // 256 * M; // 512 * M;
const unsigned long long startup_MHz_6502 = 25 * M;
const unsigned long long startup_MHz_6502 = 32 * M;
unsigned long long MHz_6502 = default_MHz_6502;
unsigned long long clk_6502_per_frm = startup_MHz_6502 / fps;
unsigned long long clk_6502_per_frm_set = default_MHz_6502 / fps;

View File

@ -17,9 +17,9 @@ disk_t disk = {
0, // clk_since_last_read
};
const int diskAccelerator_frames = 1;
int diskAccelerator_count = 10000;
int diskAccelerator_speed = 25; // less than actual CPU speed means no acceleration
const int diskAccelerator_frames = 2;
int diskAccelerator_count = 15;
int diskAccelerator_speed = 25 * M / fps; // less than actual CPU speed means no acceleration
//const unsigned long long clk_6502_per_frm_diskAccelerator = 25 * M / fps; // disk acceleration bumps up CPU clock to 25 MHz
//const unsigned long long clk_diskAcceleratorTimeout = 1000ULL;
@ -46,8 +46,8 @@ const int position_to_direction[8][8] = {
void disk_accelerator_speedup() {
if ( diskAccelerator_speed > clk_6502_per_frm ) {
clk_6502_per_frm = diskAccelerator_speed * M / fps; // clk_6502_per_frm_diskAccelerator;
if ( diskAccelerator_speed >= clk_6502_per_frm ) {
clk_6502_per_frm = diskAccelerator_speed; // clk_6502_per_frm_diskAccelerator;
diskAccelerator_count = diskAccelerator_frames;
}
}

View File

@ -996,7 +996,7 @@ INLINE uint8_t addr_zp() {
return fetch();
}
INLINE uint8_t src_zp() {
return memread8(addr_zp());
return memread8_low(addr_zp());
}
INLINE uint8_t * dest_zp() {
return WRLOMEM + addr_zp();
@ -1059,7 +1059,7 @@ INLINE uint8_t addr_zp_X() {
return fetch() + m6502.X;
}
INLINE uint8_t src_zp_X() {
return memread8(addr_zp_X());
return memread8_low(addr_zp_X());
}
INLINE uint8_t * dest_zp_X() {
return WRLOMEM + addr_zp_X();
@ -1075,7 +1075,7 @@ INLINE uint8_t addr_zp_Y() {
return fetch() + m6502.Y;
}
INLINE uint8_t src_zp_Y() {
return memread8(addr_zp_Y());
return memread8_low(addr_zp_Y());
}
INLINE uint8_t * dest_zp_Y() {
return WRLOMEM + addr_zp_Y();