decoupled timers from interpreter tick rate

This commit is contained in:
2025-03-14 20:41:08 -04:00
parent 22526c1b90
commit 19506dd218
7 changed files with 67 additions and 32 deletions

View File

@@ -16,7 +16,6 @@ private:
public:
constexpr static sreg_t scLowRestFontAddr = 0x0000;
constexpr static sreg_t scResetVector = 0x0200;
constexpr static sreg_t scTimerFreq = 60;
constexpr static size_t scMemorySize = 4096;
enum {
@@ -26,7 +25,7 @@ public:
};
enum {
SR_PC, SR_I, SR_T1, SR_T2,
SR_PC, SR_I, /*SR_T1, SR_T2,*/
SR_COUNT
};
@@ -35,7 +34,7 @@ public:
};
public:
Interpreter(unsigned ticksPerSecond, Display &display, Buzzer &buzzer, Keypad &keypad);
Interpreter(Display &display, Buzzer &buzzer, Keypad &keypad, CountdownTimer &delayTimer, CountdownTimer &soundTimer);
void tick();
void loadProgram(char const* data, size_t count, size_t where = scResetVector);
@@ -49,7 +48,8 @@ private:
Display &mrDisplay;
Buzzer &mrBuzzer;
Keypad &mrKeypad;
const unsigned mcTicksPerSecond;
CountdownTimer &mrDelayTimer;
CountdownTimer &mrSoundTimer;
sreg_t mvSpecialReg[SR_COUNT];
reg_t mvReg[R_COUNT];
bool mIsHighResMode;