From 63c03e55fa17a853c0427ca1b4154979dd5a29f1 Mon Sep 17 00:00:00 2001 From: shokre Date: Tue, 21 Sep 2021 21:33:35 +0200 Subject: [PATCH] feat(cpu): add read mem listeners --- orao/cpu.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/orao/cpu.py b/orao/cpu.py index d9dba41..1a2b53f 100755 --- a/orao/cpu.py +++ b/orao/cpu.py @@ -6,6 +6,7 @@ class CPU(object): CARRY, ZERO, INTERRUPT, DECIMAL, BREAK, UNUSED, OVERFLOW, NEGATIVE = [2**i for i in range(8)] alphaarray = None store_mem_listeners = [] + read_mem_listeners = [] def __init__(self, memory): s, self.tape_out, self.filename, self.samples = self, None, None, 0 @@ -91,6 +92,11 @@ class CPU(object): return 0x00 if addr == 0x8800: self.speaker() # Zvucnik + + if addr is not None: + for listener in self.read_mem_listeners: + listener(addr, 0, self) + return self.memory[addr] if addr is not None else self.a def store_byte(self, addr, val):