From 3c1843ab4b9f6ece3e14e1d6383fa8f727636e1f Mon Sep 17 00:00:00 2001 From: Daniele Verducci Date: Wed, 25 May 2022 23:41:10 +0200 Subject: [PATCH] WIP implementing Pat80 IO device TODO: allow to dynamically load io devices modules to not override the original one --- src/z80/io.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/z80/io.py b/src/z80/io.py index 74aa3f2..773679e 100644 --- a/src/z80/io.py +++ b/src/z80/io.py @@ -17,7 +17,7 @@ class Interruptable(object): pass class Console(QTextEdit, IO): - _addresses = [0x80, 0x81] + _addresses = [0x00, 0x01] _wrt_sgnl = Signal(int, int) def __init__(self, interruptable): #assert isinstance(interruptable, Interruptable ) @@ -37,17 +37,15 @@ class Console(QTextEdit, IO): def read(self, address): print ("READ ", address) - if address == 0x80: - v = ((1 << 1) | # RTS - ((self._send_queue is not None) << 0) | # interrupt? - 0 ) - return v - elif address == 0x81: + # Sono invertiti? Per colpa dell'emulatore? + if address == 0x01: + pass + elif address == 0x00: if self._send_queue is not None: val = self._send_queue self._send_queue = None return val - return 0x13 + return 0x0 @Slot(int, int) @@ -56,15 +54,10 @@ class Console(QTextEdit, IO): self._wrt_sgnl.emit(address, value) def _write(self, address, value): - if address == 0x80: + if address == 0x01: pass - elif address == 0x81: - if value < 128 and value > 10: - self.setText(self.toPlainText()+chr(value)) - else: - self.setText(self.toPlainText()+".") - else: - raise Exception("Trying Console IO with wrong address") + elif address == 0x0: + self.setText(self.toPlainText()+chr(value)) def keyPressEvent(self, event): # print ("Event:", event)