private void PsgDevice_OnIrbHandler(IPsgDevice sender, PsgPortState state) { if (!state.DirOut) { state.InState = 0xFE; /*always ready??? Alone Coder us0.36.6*/ } }
private void PsgDevice_OnUpdateIra(IPsgDevice sender, PsgPortState 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; } }