Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S11: fix solenoids2 async access #395

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions src/wpc/s11.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ static struct {
int digSel;
int diagnosticLed;
int swCol;
int ssEn; /* Special solenoids and flippers enabled ? */
int sndCmd; /* external sound board cmd */
int ssEn; /* Enable switched solenoids (solenoids that can be fired by a switch or a solenoid output) */
int switchedSol; /* Output state for switched solenoid (which may be enabled/disabled by ssEn), usually slingshots, bumpers,... */
int sndCmd; /* External sound board cmd */
int piaIrq;
int deGame; /*Flag to see if it's a Data East game running*/
int deGame; /* Flag to see if it's a Data East game running */
UINT8 solBits1,solBits2;
UINT8 solBits2prv;
#ifndef PINMAME_NO_UNUSED
Expand Down Expand Up @@ -206,7 +207,7 @@ static INTERRUPT_GEN(s11_vblank) {
#endif
#endif
coreGlobals.solenoids = locals.solsmooth[0] | locals.solsmooth[1];
coreGlobals.solenoids2 = locals.extSol << 8;
coreGlobals.solenoids2 = (coreGlobals.solenoids2 & 0xFFFF00FF) | (locals.extSol << 8);
#if defined(LISY_SUPPORT)
lisy_w_solenoid_handler( ); //RTH: need to add solnoids2 ?
#endif
Expand Down Expand Up @@ -512,11 +513,21 @@ static void setSSSol(int data, int solNo) {
/* WMS DE */
static const int ssSolNo[2][6] = {{5,4,1,2,0,3},{3,4,5,1,0,2}};
int bit = CORE_SOLBIT(CORE_FIRSTSSSOL + ssSolNo[locals.deGame][solNo]);
if (~data & 1)
locals.switchedSol |= bit;
else
locals.switchedSol &= ~bit;
if (locals.ssEn & (~data & 1))
{ coreGlobals.pulsedSolState |= bit; locals.solenoids |= bit; }
{
coreGlobals.pulsedSolState |= bit;
locals.solenoids |= bit;
core_write_pwm_output(CORE_MODOUT_SOL0 + CORE_FIRSTSSSOL + ssSolNo[locals.deGame][solNo] - 1, 1, 1);
}
else
{
coreGlobals.pulsedSolState &= ~bit;
core_write_pwm_output(CORE_MODOUT_SOL0 + CORE_FIRSTSSSOL + ssSolNo[locals.deGame][solNo] - 1, 1, (locals.ssEn & (~data & 1)) ? 1 : 0);
core_write_pwm_output(CORE_MODOUT_SOL0 + CORE_FIRSTSSSOL + ssSolNo[locals.deGame][solNo] - 1, 1, 0);
}
}

static void updsol(void) {
Expand Down Expand Up @@ -574,7 +585,8 @@ static WRITE_HANDLER(latch2200) {
static WRITE_HANDLER(pia0cb2_w) {
locals.ssEn = !data;
coreGlobals.pulsedSolState = (coreGlobals.pulsedSolState & ~(1 << (S11_GAMEONSOL - 1))) | (data ? 0 : (1 << (S11_GAMEONSOL - 1)));
coreGlobals.physicOutputState[CORE_MODOUT_SOL0 + S11_GAMEONSOL - 1].value = data ? 0.f : 1.f;
core_write_pwm_output(CORE_MODOUT_SOL0 + S11_GAMEONSOL - 1, 1, locals.ssEn ? 1.f : 0.f);
core_write_pwm_output(CORE_MODOUT_SOL0 + CORE_FIRSTSSSOL, 6, locals.ssEn ? locals.switchedSol : 0);
}

static WRITE_HANDLER(pia1ca2_w) { setSSSol(data, 0); }
Expand Down Expand Up @@ -834,7 +846,7 @@ static MACHINE_INIT(s11) {
core_set_pwm_output_type(CORE_MODOUT_LAMP0, coreGlobals.nLamps, CORE_MODOUT_BULB_44_18V_DC_S11);
coreGlobals.nSolenoids = CORE_FIRSTCUSTSOL - 1 + core_gameData->hw.custSol;
core_set_pwm_output_type(CORE_MODOUT_SOL0, coreGlobals.nSolenoids, CORE_MODOUT_SOL_2_STATE);
core_set_pwm_output_type(CORE_MODOUT_SOL0 + S11_GAMEONSOL - 1, 1, CORE_MODOUT_NONE); // GameOn output for fast flips
core_set_pwm_output_type(CORE_MODOUT_SOL0 + S11_GAMEONSOL - 1, 1, CORE_MODOUT_PULSE);
if (core_gameData->sxx.muxSol)
core_set_pwm_output_type(CORE_MODOUT_SOL0 + core_gameData->sxx.muxSol - 1, 1, CORE_MODOUT_PULSE); // K1 mux relay
const struct GameDriver* rootDrv = Machine->gamedrv;
Expand Down
4 changes: 0 additions & 4 deletions src/wpc/s11.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,8 @@ int s11_m2sw(int col, int row);
SIM_PORTS(balls) \
DE_COMPORTS2

/*-- To access C-side multiplexed solenoid/flasher --*/
#define S11_CSOL(x) ((x)+(WPC_FIRSTFLIPPERSOL-1))
#define DE_CSOL(x) ((x)+24)
/*-- GameOn solenoids --*/
#define S11_GAMEONSOL 23
#define DE_GAMEONSOL 23

/*-- DE switch numbers --*/
#define DE_SWADVANCE -7
Expand Down
1 change: 0 additions & 1 deletion src/wpc/sims/s11/prelim/eatpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ S11_INPUT_PORTS_END

/* Solenoids, The rest are flashes I think */
#define sOuthole 1
#define sDummy S11_CSOL(1) /* this is just an example of a C line solenoid */
#define sRelease 2
#define sDropRel 3
#define sEject 5
Expand Down
Loading