add crude software implementation of Dvi ship
authorAdam Megacz <adam@megacz.com>
Mon, 27 Jul 2009 03:23:57 +0000 (20:23 -0700)
committerAdam Megacz <adam@megacz.com>
Mon, 27 Jul 2009 03:23:57 +0000 (20:23 -0700)
ships/Dvi.ship

index 2c925a2..ee02bc4 100644 (file)
@@ -552,13 +552,42 @@ NET  sram_oe_b            LOC="B12";   # Bank 20, Vcco=3.3V, DCI using 49.9 ohm
 
 == Fleeterpreter ====================================================
 
-  public void service() { }
+  private java.awt.Frame frame = null;
+  public void service() {
+  if (box_inPixelX.dataReadyForShip() &&
+      box_inPixelY.dataReadyForShip() &&
+      box_inPixelValue.dataReadyForShip()
+      ) {
+      long x      = box_inPixelX.removeDataForShip();
+      long y      = box_inPixelY.removeDataForShip();
+      long d      = box_inPixelValue.removeDataForShip();
+
+      if (frame==null) {
+           frame = new java.awt.Frame();
+           java.awt.Dimension dim = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
+           frame.setSize((int)dim.getWidth(),(int)dim.getHeight());
+           frame.show();
+           frame.setBackground(new java.awt.Color(0,0,0));
+      }
+      java.awt.Color c = new java.awt.Color(
+         ((d & (1L<<2))!=0) ? 0xff : 0x00,
+         ((d & (1L<<1))!=0) ? 0xff : 0x00,
+         ((d & (1L<<0))!=0) ? 0xff : 0x00
+      );
+      java.awt.Graphics2D g = (java.awt.Graphics2D)frame.getGraphics();
+      g.transform(java.awt.geom.AffineTransform.getScaleInstance(((double)frame.getWidth())/640, ((double)frame.getHeight())/480));
+      g.setColor(c);
+      g.fillRect((int)x,(int)y,1,1);
+
+    }
+  }
 
 == FleetSim ==============================================================
 
 == Constants =========================================================
 
 == Test ==============================================================
+#skip
 
 #expect 0
 #expect 0