+ default: throw new RuntimeException("invalid argument: zi=="+(mode4(0x02, row, col) & 0x9B));
+ }
+ }
+
+ public Cell dir(int i) {
+ switch(i) {
+ case NORTH: return north();
+ case SOUTH: return south();
+ case EAST: return east();
+ case WEST: return west();
+ case NW: return nw();
+ case SW: return sw();
+ case SE: return se();
+ case NE: return ne();
+ }
+ return null;
+ }
+ public int dir(Cell c) {
+ if (c.row==row-1 && c.col==col-1) return SW;
+ else if (c.row==row+1 && c.col==col-1) return NW;
+ else if (c.row==row-1 && c.col==col+1) return SE;
+ else if (c.row==row+1 && c.col==col+1) return NE;
+ else if (c.row==row-1 && c.col==col) return SOUTH;
+ else if (c.row==row+1 && c.col==col) return NORTH;
+ else if (c.row==row && c.col==col-1) return WEST;
+ else if (c.row==row && c.col==col+1) return EAST;
+ return -1;
+ }
+
+ public void generalized_c_element() {
+
+ /*
+ ylut(LUT_SELF & (~LUT_OTHER));
+ xlut((~LUT_SELF) | LUT_OTHER);
+ c(ZMUX);
+ zi(L2);
+ //h(L2, true);
+ out(L2, true);
+ xo(true);
+ yo(true);
+ */
+
+ //ylut(0xB2);
+ ylut((LUT_SELF & ~LUT_OTHER) | (LUT_Z & ~LUT_OTHER) | (LUT_Z & LUT_SELF & LUT_OTHER));
+ xlut(LUT_Z);
+ c(YLUT);
+ f(false);
+ b(false);
+ t(false, false, true);
+ yo(false);
+ xo(false);