- Fixed disk acceleration algorithm

- Some tiny speed optimizations
This commit is contained in:
tudnai 2020-05-02 22:04:22 -07:00
parent 12dc2f1d2b
commit bae447ad32
4 changed files with 45 additions and 29 deletions

View File

@ -1003,9 +1003,9 @@
filePath = "src/cpu/6502.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "878"
endingLineNumber = "878"
landmarkName = "rom_loadFile(bundlePath, filename)"
startingLineNumber = "773"
endingLineNumber = "773"
landmarkName = "read_rom(bundlePath, filename, rom, addr)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
@ -1019,9 +1019,9 @@
filePath = "src/cpu/6502.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "918"
endingLineNumber = "918"
landmarkName = "m6502_ColdReset(bundlePath, romFileName)"
startingLineNumber = "813"
endingLineNumber = "813"
landmarkName = "rom_loadFile(bundlePath, filename)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
@ -1227,8 +1227,8 @@
filePath = "src/cpu/6502.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "775"
endingLineNumber = "775"
startingLineNumber = "719"
endingLineNumber = "719"
landmarkName = "m6502_Run()"
landmarkType = "9">
</BreakpointContent>
@ -1243,9 +1243,9 @@
filePath = "src/cpu/6502.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "844"
endingLineNumber = "844"
landmarkName = "getFileSize(fullPath)"
startingLineNumber = "748"
endingLineNumber = "748"
landmarkName = "m6502_Run()"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
@ -1275,9 +1275,9 @@
filePath = "src/cpu/6502.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "893"
endingLineNumber = "893"
landmarkName = "m6502_ColdReset(bundlePath, romFileName)"
startingLineNumber = "788"
endingLineNumber = "788"
landmarkName = "getFileSize(fullPath)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
@ -1381,15 +1381,15 @@
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "66885E40-F885-4FBA-9685-7056F0E1C676"
shouldBeEnabled = "Yes"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "src/dev/mem/mmio.h"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "931"
endingLineNumber = "931"
landmarkName = "dest_abs()"
startingLineNumber = "927"
endingLineNumber = "927"
landmarkName = "addr_abs()"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
@ -1403,11 +1403,27 @@
filePath = "src/cpu/6502.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "472"
endingLineNumber = "472"
startingLineNumber = "416"
endingLineNumber = "416"
landmarkName = "m6502_Step()"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "8871CCC2-3BF8-4780-B743-7E264F6219FC"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "src/dev/disk/disk.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "49"
endingLineNumber = "49"
landmarkName = "disk_accelerator_speedup()"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

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();