From 92de76627baf7c239a517316d85150149403f0c9 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Thu, 11 Apr 2024 18:23:08 +0100 Subject: Add perf test --- atk16_emu/emu.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'atk16_emu') 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 -- cgit v1.3