+ public void keyTyped(KeyEvent k) {
+ }
+ public void keyReleased(KeyEvent k) {
+ }
+ public void keyPressed(KeyEvent k) {
+ switch(k==null ? '_' : k.getKeyChar()) {
+ case '1': {
+ if (selx==-1 || sely==-1) break;
+ At40k.Cell cell = dev.cell(selx, sely);
+ cell.xlut(0xff);
+ cell.ylut(0xff);
+ drawCell(getGraphics(), selx, sely);
+ break;
+ }
+ case ' ': {
+ enabled = !enabled;
+ }
+ case 'C': {
+ if (selx==-1 || sely==-1) break;
+ At40k.Cell cell = dev.cell(selx, sely);
+ cell.ylut(0xB2);
+ drawCell(getGraphics(), selx, sely);
+ break;
+ }
+ case '0': {
+ if (selx==-1 || sely==-1) break;
+ At40k.Cell cell = dev.cell(selx, sely);
+ cell.xlut(0x00);
+ cell.ylut(0x00);
+ drawCell(getGraphics(), selx, sely);
+ break;
+ }
+ }
+ for(int x=5; x<=PIPELEN; x++) {
+ At40k.Cell cell = dev.cell(x, 22);
+ scan(dev, cell, YLUT, true);
+ boolean y = (drone.readBus() & 0x80) != 0;
+ scan(dev, cell, YLUT, false);
+
+ Graphics g = getGraphics();
+ g.setFont(new Font("sansserif", Font.BOLD, 24));
+ g.setColor(Color.white);
+ g.drawString("0", left(cell) + 12, top(cell) + 30);
+ g.drawString("1", left(cell) + 12, top(cell) + 30);
+ //g.setColor(RED);
+ //g.drawString("X="+(x?"1":"0"), left(cell) + 10, top(cell) + 20);
+
+ //g.drawString((y?"1":"0"), left(cell) + 12, top(cell) + 30);
+ drawCell(g, x, 22, y?new Color(0xff, 0x99, 0x99):new Color(0x99, 0xff, 0x99));
+ }
+ }
+ public void mousePressed(MouseEvent e) {
+ At40k.Cell cell = dev.cell(selx, sely);
+ if (cell==null) return;
+ int old = cell.c();
+ scan(dev, cell, YLUT, true);
+ boolean y = (drone.readBus() & 0x80) != 0;
+ //scan(dev, cell, XLUT, true);
+ //boolean x = (drone.readBus() & 0x80) != 0;
+ scan(dev, cell, YLUT, false);
+ cell.c(old);
+ Graphics g = getGraphics();
+ g.setFont(new Font("sansserif", Font.BOLD, 14));
+ g.setColor(Color.white);
+ //g.drawString("X=0", left(cell) + 10, top(cell) + 20);
+ //g.drawString("X=1", left(cell) + 10, top(cell) + 20);
+ /*
+ g.setColor(Color.white);
+ g.drawString("Y=0", left(cell) + 8, top(cell) + 35);
+ g.drawString("Y=1", left(cell) + 8, top(cell) + 35);
+ */
+ //g.setColor(RED);
+ //g.drawString("X="+(x?"1":"0"), left(cell) + 10, top(cell) + 20);
+ g.setColor(BLUE);
+ g.drawString("Y="+(y?"1":"0"), left(cell) + 8, top(cell) + 35);
+ }
+