Sync push

This commit is contained in:
OmniaX-Dev 2026-06-15 11:43:47 +02:00
parent de279f4721
commit 051a404e42
4 changed files with 15 additions and 6 deletions

View file

@ -4,7 +4,7 @@ CMOS = dragon/cmos.dr
cpuext = extmov, extalu cpuext = extmov, extalu
fixed_clock = true fixed_clock = true
clock_rate_sec = 5000 clock_rate_sec = 100
memory_extension_pages = 16 memory_extension_pages = 16
screen_redraw_rate_per_second = 10 screen_redraw_rate_per_second = 10

Binary file not shown.

View file

@ -300,7 +300,7 @@ namespace dragon
machine_config.destroy(); machine_config.destroy();
} }
void DragonRuntime::runMachine(void) void DragonRuntime::runMachine2(void)
{ {
f64 clock_speed_us = 1000000.0 / machine_config.clock_rate_sec; f64 clock_speed_us = 1000000.0 / machine_config.clock_rate_sec;
f64 acc = 0; f64 acc = 0;
@ -315,9 +315,6 @@ namespace dragon
while (running || vDiskInterface.isBusy()) while (running || vDiskInterface.isBusy())
{ {
clock_timer.startCount(ostd::eTimeUnits::Microseconds); clock_timer.startCount(ostd::eTimeUnits::Microseconds);
ostd::SignalHandler::handleDelegateSignals();
u16 addr = cpu.readRegister(dragon::data::Registers::IP);
u16 spAddr = cpu.readRegister(dragon::data::Registers::SP);
u8 screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate); u8 screenRedrawRate = vCMOS.read8(data::CMOSRegisters::ScreenRedrawRate);
running = cpu.execute() && vDisplay.isRunning(); running = cpu.execute() && vDisplay.isRunning();
vDisplay.mainLoop(); vDisplay.mainLoop();
@ -347,6 +344,18 @@ namespace dragon
} }
} }
void DragonRuntime::runMachine(void)
{
bool running = true;
ostd::StepTimer cycleTimer(machine_config.clock_rate_sec, [&](f64 dt) {
running = runStep();
});
while (running)
{
cycleTimer.update();
}
}
bool DragonRuntime::runStep(void) bool DragonRuntime::runStep(void)
{ {
bool running = cpu.execute() && vDisplay.isRunning(); bool running = cpu.execute() && vDisplay.isRunning();
@ -362,7 +371,6 @@ namespace dragon
vDisplay.redrawScreen(); vDisplay.redrawScreen();
} }
s_stepAcc2++; s_stepAcc2++;
// vDisplay.redrawScreen(); // This is slow...maybe it should be on a 100ms rate, like in normal runtime mode
vDiskInterface.cycleStep(); vDiskInterface.cycleStep();
return running || vDiskInterface.isBusy(); return running || vDiskInterface.isBusy();
} }

View file

@ -47,6 +47,7 @@ namespace dragon
static i32 initMachine(const tRuntimeInitInfo& info); static i32 initMachine(const tRuntimeInitInfo& info);
static void shutdownMachine(void); static void shutdownMachine(void);
static void runMachine(void); static void runMachine(void);
static void runMachine2(void);
static bool runStep(void); static bool runStep(void);
static void forceLoad(const String& filePath, u16 loadAddress); static void forceLoad(const String& filePath, u16 loadAddress);