aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_emu/peripherals.py
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-05-17 09:17:47 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-05-17 09:17:47 +0300
commit853918f4b7e9f3724be4d71014689c18c28fe61e (patch)
tree28b295ba47a4987a65655965749262363e074c4b /atk16_emu/peripherals.py
parent0611d3d4b9b3644c1029440b9cccb9097184a569 (diff)
Add hotspot analysis
Diffstat (limited to 'atk16_emu/peripherals.py')
-rw-r--r--atk16_emu/peripherals.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/atk16_emu/peripherals.py b/atk16_emu/peripherals.py
index 3bc0443..9b65410 100644
--- a/atk16_emu/peripherals.py
+++ b/atk16_emu/peripherals.py
@@ -1,5 +1,5 @@
import pygame
-import sys
+from sys import stdout
import os
import random
from .memory import RAM, ROM
@@ -8,18 +8,19 @@ from typing import Callable
IRQ_LINE_KEYBOARD = 0
class Peripherals:
- def __init__(self, set_irq_line: Callable[[int], None]):
+ def __init__(self, set_irq_line: Callable[[int], None], request_quit: Callable[[], None]):
pygame.init()
self.graphics = Graphics()
self.keyboard = Keyboard(set_irq_line=set_irq_line)
self.terminal = Terminal()
+ self.request_quit = request_quit
self.set_irq_line = set_irq_line
def step(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
- sys.exit(0)
+ self.request_quit()
elif event.type == pygame.KEYDOWN:
self.keyboard.set_key_down(event.key)
elif event.type == pygame.KEYUP:
@@ -242,4 +243,4 @@ class Terminal:
def write(self, s: int):
print(chr(s), end="")
- sys.stdout.flush()
+ stdout.flush()