aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_emu/emu.py
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-04-11 18:23:08 +0100
committerJan Tuomi <jan@jantuomi.fi>2024-04-11 18:23:08 +0100
commit92de76627baf7c239a517316d85150149403f0c9 (patch)
treeea8d80e88584f5d383a4e11237d8e56c37c414e8 /atk16_emu/emu.py
parent3963742d5cc195bbbcc8081ec261b0d3e0c1d83d (diff)
Add perf test
Diffstat (limited to 'atk16_emu/emu.py')
-rw-r--r--atk16_emu/emu.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/atk16_emu/emu.py b/atk16_emu/emu.py
index 4257636..f0671bd 100644
--- a/atk16_emu/emu.py
+++ b/atk16_emu/emu.py
@@ -2,6 +2,7 @@ import random
from typing import Literal
from dataclasses import dataclass
import sys
+import time
from .opcodes import *
from .colors import C
@@ -278,6 +279,11 @@ class Machine:
while self.running:
self.step()
+ # TODO limit emulation speed to 393359.375 Hz ~= 2542 ns per instruction
+ # this is in order to have similar speed as the actual machine
+ # see: test_emulation_speed.py
+ # naive time.sleep is slow and not accurate enough
+
def check_nth_flag(self, n: int) -> bool:
match n:
case 0: return self.fr.carry