Speed improvements to 1300MHz

This commit is contained in:
tudnai 2020-05-08 19:47:19 -07:00
parent c6a7f211dc
commit bfb226d415
3 changed files with 8 additions and 11 deletions

View File

@ -710,7 +710,7 @@ class ViewController: NSViewController {
@IBAction func speedSelected(_ sender: NSButton) { @IBAction func speedSelected(_ sender: NSButton) {
if ( sender.title == "MAX" ) { if ( sender.title == "MAX" ) {
setCPUClockSpeed(freq: 1280) setCPUClockSpeed(freq: 1600)
} }
else if let freq = Double( sender.title ) { else if let freq = Double( sender.title ) {
setCPUClockSpeed(freq: freq) setCPUClockSpeed(freq: freq)

View File

@ -711,21 +711,18 @@ void softReset() {
} }
void m6502_Run() { void m6502_Run() {
static unsigned int clk = 0;
// init time // init time
//#ifdef CLK_WAIT //#ifdef CLK_WAIT
// unsigned long long elpased = (unsigned long long)-1LL; // unsigned long long elpased = (unsigned long long)-1LL;
//#endif //#endif
// we will also use this to pause the simulation if not finished by the end of the frame
clk_6502_per_frm_max = clk_6502_per_frm;
#ifdef SPEEDTEST #ifdef SPEEDTEST
for ( inst_cnt = 0; inst_cnt < iterations ; inst_cnt++ ) for ( inst_cnt = 0; inst_cnt < iterations ; inst_cnt++ )
#elif defined( CLK_WAIT ) #elif defined( CLK_WAIT )
// we clear the clkfrm from ViewController Update() // we clear the clkfrm from ViewController Update()
for ( ; clkfrm < clk_6502_per_frm_max ; clkfrm += clk ) // we will also use this to pause the simulation if not finished by the end of the frame
for ( clk_6502_per_frm_max = clk_6502_per_frm; clkfrm < clk_6502_per_frm_max ; clkfrm += m6502_Step() )
#else #else
// this is for max speed only -- WARNING! It works only if simulation runs in a completely different thread from the Update() // this is for max speed only -- WARNING! It works only if simulation runs in a completely different thread from the Update()
for ( ; ; ) for ( ; ; )
@ -763,10 +760,10 @@ void m6502_Run() {
} }
#endif // INTERRUPT_CHECK_PER_STEP #endif // INTERRUPT_CHECK_PER_STEP
m6502.clktime += ( clk = m6502_Step() );
printDisassembly( outdev );
} }
m6502.clktime += clk_6502_per_frm;
if( diskAccelerator_count ) { if( diskAccelerator_count ) {
if( --diskAccelerator_count <= 0 ) { if( --diskAccelerator_count <= 0 ) {
// make sure we only adjust clock once to get back to normal // make sure we only adjust clock once to get back to normal

View File

@ -251,11 +251,11 @@ uint8_t woz_read() {
#else // WOZ_REAL_SPIN #else // WOZ_REAL_SPIN
clkelpased = m6502.clktime - m6502.clklast; clkelpased = m6502.clktime + clkfrm - m6502.clklast;
m6502.clklast = m6502.clktime; m6502.clklast = m6502.clktime + clkfrm;
const int clkBeforeAdjusting = 250; const int clkBeforeAdjusting = 250;
const int magicShiftOffset = 90; const int magicShiftOffset = 80;
uint16_t usedBytes = woz_trks[track].bytes_used < WOZ_TRACK_BYTE_COUNT ? woz_trks[track].bytes_used : WOZ_TRACK_BYTE_COUNT; uint16_t usedBytes = woz_trks[track].bytes_used < WOZ_TRACK_BYTE_COUNT ? woz_trks[track].bytes_used : WOZ_TRACK_BYTE_COUNT;
if ( usedBytes ) { if ( usedBytes ) {