From fd10322acc085f225b04ed83eea5cfb584ac20d3 Mon Sep 17 00:00:00 2001 From: Ross Wilson Date: Thu, 18 Jun 2015 16:15:10 +0700 Subject: [PATCH] Working on getting display running --- pymlac/Display.py | 16 +++++++++++----- pymlac/DisplayCPU.py | 4 ++-- pymlac/test_Display.py | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pymlac/Display.py b/pymlac/Display.py index 7c6fea4..93afff6 100644 --- a/pymlac/Display.py +++ b/pymlac/Display.py @@ -148,15 +148,21 @@ class Display(_BufferedCanvas): self.OnSize() - def draw(self, sd, x1, y1, x2, y2): + def draw(self, x1, y1, x2, y2, dotted=False): """Draw a line on the screen. - sd True if solid line, False if dotted x1, y1 start coordinates x2, y2 end coordinates + dotted True if dotted line, else False """ - self.drawlist.append((sd, x1, y1, x2, y2)) + self.drawlist.append((x1, y1, x2, y2, dotted)) + self.Update() + + def clear(self): + """Clear the display.""" + + self.drawlist = [] self.Update() def Draw(self, dc): @@ -167,8 +173,8 @@ class Display(_BufferedCanvas): pen = wx.Pen(self.DrawColour) - for (sd, x1, y1, x2, y2) in self.drawlist: - if sd: + for (x1, y1, x2, y2, dotted) in self.drawlist: + if not dotted: pen.SetStyle(wx.SOLID) pen.SetWidth(2) else: diff --git a/pymlac/DisplayCPU.py b/pymlac/DisplayCPU.py index 6e84e8d..fdb702d 100644 --- a/pymlac/DisplayCPU.py +++ b/pymlac/DisplayCPU.py @@ -72,7 +72,7 @@ def doDEIMByte(byte): else: DY += (byte & 0x03) if byte & 0x40: - display.draw(0, prevDX, prevDY, DX, DY) + display.draw(prevDX, prevDY, DX, DY) else: # micro instructions if byte & 0x40: Mode = MODE_NORMAL @@ -250,7 +250,7 @@ def i_DLVH(word1): else: DY += N - display.draw(dotted, prevDX, prevDY, DX, DY) + display.draw(prevDX, prevDY, DX, DY, dotted) Trace.dtrace('DLVH') return 3 diff --git a/pymlac/test_Display.py b/pymlac/test_Display.py index c39da69..2debf50 100755 --- a/pymlac/test_Display.py +++ b/pymlac/test_Display.py @@ -55,8 +55,8 @@ class TestFrame(wx.Frame): self.Refresh() - self.display.draw(True, 0, 0, 2047, 2047) - self.display.draw(False, 2047, 0, 0, 2047) + self.display.draw(0, 0, 2047, 2047) + self.display.draw(2047, 0, 0, 2047, dotted=True) def OnSize(self, event): """Maintain square window."""