WIP implementing Pat80 IO device

TODO: allow to dynamically load io devices modules to not override the
original one
This commit is contained in:
Daniele Verducci 2022-05-25 23:41:10 +02:00
parent 159803f6c6
commit 3c1843ab4b

View File

@ -17,7 +17,7 @@ class Interruptable(object):
pass pass
class Console(QTextEdit, IO): class Console(QTextEdit, IO):
_addresses = [0x80, 0x81] _addresses = [0x00, 0x01]
_wrt_sgnl = Signal(int, int) _wrt_sgnl = Signal(int, int)
def __init__(self, interruptable): def __init__(self, interruptable):
#assert isinstance(interruptable, Interruptable ) #assert isinstance(interruptable, Interruptable )
@ -37,17 +37,15 @@ class Console(QTextEdit, IO):
def read(self, address): def read(self, address):
print ("READ ", address) print ("READ ", address)
if address == 0x80: # Sono invertiti? Per colpa dell'emulatore?
v = ((1 << 1) | # RTS if address == 0x01:
((self._send_queue is not None) << 0) | # interrupt? pass
0 ) elif address == 0x00:
return v
elif address == 0x81:
if self._send_queue is not None: if self._send_queue is not None:
val = self._send_queue val = self._send_queue
self._send_queue = None self._send_queue = None
return val return val
return 0x13 return 0x0
@Slot(int, int) @Slot(int, int)
@ -56,15 +54,10 @@ class Console(QTextEdit, IO):
self._wrt_sgnl.emit(address, value) self._wrt_sgnl.emit(address, value)
def _write(self, address, value): def _write(self, address, value):
if address == 0x80: if address == 0x01:
pass pass
elif address == 0x81: elif address == 0x0:
if value < 128 and value > 10: self.setText(self.toPlainText()+chr(value))
self.setText(self.toPlainText()+chr(value))
else:
self.setText(self.toPlainText()+".")
else:
raise Exception("Trying Console IO with wrong address")
def keyPressEvent(self, event): def keyPressEvent(self, event):
# print ("Event:", event) # print ("Event:", event)