Beispiel #1
0
static WRITE_HANDLER(ngg_wpc_w) {
  static int lastFlip, lastWheel = 0;
// writes to the flippers have to be delayed 1 cycle to not interfere with the flashers.
// also, an intermittent 0 byte write has to be avoided.
  if (!(data & 0xc0) && offset == WPC_FLIPPERCOIL95) {
    if (lastFlip & data & 0x3f) wpc_w(WPC_FLIPPERCOIL95, data);
    if (!lastFlip & !data) wpc_w(WPC_FLIPPERCOIL95, 0);
    lastFlip = data;
  } else
    wpc_w(offset, data);

// Wheel state handling
//
// Wheel motor is driven by two solenoid outputs
// The solenoid drivers are fed to the input of a motor driver chip with
// active low inputs. So the inputs are active when the solenoid outputs
// are _not_ energised.
// solenoid 38 drives wheel clockwise (state decreases by one)
// solenoid 37 drives wheel counter clockwise (state increases by one)
//
// there are 64 states and 16 positions on the wheel
// Wheel position sensing is provided by two optos as shown in table
//
// Wheel 0000 0000 0011 1111 1111 2222 2222 2233 3333 3333 4444 4444 4455 5555 5555 6666
// State 0123 4567 8901 2345 6789 0123 4567 8901 2345 6789 0123 4567 8901 2345 6789 0123
//
// Inner 0111 1111 1111 1111 1111 1111 1111 1111 1110 0000 0000 0000 0000 0000 0000 0000
// Outer 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011
//
// Pos.    0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   15
  if (offset == WPC_SOLENOID1) {
    if (lastWheel & ~data & 0x20) {
      locals.wheelpos++;
      if (locals.wheelpos > 63)
        locals.wheelpos = 0;
    }
    if (lastWheel & ~data & 0x10) {
      locals.wheelpos--;
      if (locals.wheelpos < 0)
        locals.wheelpos = 63;
    }
    core_setSw(swInnerWheel, locals.wheelpos > 0);
    core_setSw(swOuterWheel, locals.wheelpos % 4 == 0 || locals.wheelpos % 4 == 3);
    lastWheel = data;
  }
}
Beispiel #2
0
static WRITE_HANDLER(cftbl_wpc_w) {
    UINT8 state;
    wpc_w(offset, data);
    if (offset == WPC_SOLENOID3) {
        state = 1 << ((GET_BIT7 << 1) | GET_BIT3);
        coreGlobals.lampMatrix[8] = coreGlobals.tmpLampMatrix[8] = (state << 4) | state;
    }
}
Beispiel #3
0
static WRITE_HANDLER(afm_wpc_w) {
  wpc_w(offset, data);
  if (offset == WPC_SOLENOID1) {
    HC4094_data_w (0, GET_BIT5);
    HC4094_clock_w(0, GET_BIT4);
    HC4094_clock_w(1, GET_BIT4);
  }
}