private void ay_UpdateIRA(AY8910 sender, AyPortState state) { // // Emulation AY-Mouse (V.M.G. schema) // int x = 0; int y = 0; int b = 0; if (MouseState != null) { x = MouseState.X; y = MouseState.Y; b = MouseState.Buttons; } int pcDelta; if ((state.OutState & 0x40) != 0) // selected V counter pcDelta = _lastAyMouseY - y / 4; else // selected H counter pcDelta = x / 4 - _lastAyMouseX; // make signed 4 bit integer... pcDelta = pcDelta + 8; // prevent overflow (this feature not present in original schema)... if (pcDelta < 0) pcDelta = 0; if (pcDelta > 15) pcDelta = 15; // buttons 0 and 1... state.InState = (byte)((pcDelta & 0x0F) | ((b & 3) ^ 3) << 4 | (state.OutState & 0xC0)); if (state.DirOut && ((state.OutState ^ state.OldOutState) & 0x40) != 0 && (state.OutState & 0x40) == 0) { // reset H and V counters _lastAyMouseX = x / 4; _lastAyMouseY = y / 4; } }
public override void BusInit(IBusManager bmgr) { m_ay8910 = bmgr.FindDevice<AY8910>(); }