Skip to content

Commit

Permalink
PWM: Fix missing S11 aux solenoids
Browse files Browse the repository at this point in the history
  • Loading branch information
vbousquet committed Jan 18, 2024
1 parent 9ebe5c8 commit a7bb427
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
8 changes: 8 additions & 0 deletions src/wpc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2700,6 +2700,14 @@ void core_set_pwm_output_type(int startIndex, int count, int type)
coreGlobals.physicOutputState[i].state.bulb.relative_brightness = 1.f;
coreGlobals.physicOutputState[i].integrator = &core_update_pwm_output_bulb;
break;
case CORE_MODOUT_BULB_89_25V_DC_S11: // Flasher 25V DC switched through a TIP 122 (Vcesat max= 2 to 4V, 1V used here) with a 1,5 Ohms serial resistor and a diode (1V voltage drop), from Police Force (and others) schematics
coreGlobals.physicOutputState[i].state.bulb.bulb = BULB_89;
coreGlobals.physicOutputState[i].state.bulb.U = 25.f - 1.0f - 1.0f;
coreGlobals.physicOutputState[i].state.bulb.isAC = FALSE;
coreGlobals.physicOutputState[i].state.bulb.serial_R = 1.5f;
coreGlobals.physicOutputState[i].state.bulb.relative_brightness = 1.f;
coreGlobals.physicOutputState[i].integrator = &core_update_pwm_output_bulb;
break;
case CORE_MODOUT_LED:
coreGlobals.physicOutputState[i].state.bulb.relative_brightness = 1.f;
coreGlobals.physicOutputState[i].integrator = &core_update_pwm_output_led;
Expand Down
1 change: 1 addition & 0 deletions src/wpc/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ extern void video_update_core_dmd(struct mame_bitmap *bitmap, const struct recta
#define CORE_MODOUT_BULB_89_20V_DC_WPC 301 /* Incandescent #89/906 Bulb connected to 20V, commonly used for flashers */
#define CORE_MODOUT_BULB_89_20V_DC_GTS3 302 /* Incandescent #89/906 Bulb connected to 20V, commonly used for flashers */
#define CORE_MODOUT_BULB_89_32V_DC_S11 303 /* Incandescent #89/906 Bulb connected to 32V, used for flashers on S11 with output strobing */
#define CORE_MODOUT_BULB_89_25V_DC_S11 304 /* Incandescent #89/906 Bulb connected to 25V, used for flashers on S11 with output strobing */
#define CORE_MODOUT_LED 400 /* LED PWM (in fact mostly human eye reaction, since LED are nearly instantaneous) */
#define CORE_MODOUT_LED_STROBE_1_10MS 401 /* LED Strobed 1ms over 10ms for full power */
#define CORE_MODOUT_VFD_STROBE_05_20MS 450 /* Vacuum Fluorescent Display used for alpha numeric segment displays */
Expand Down
58 changes: 23 additions & 35 deletions src/wpc/s11.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include "lisy/lisy_w.h"
#endif /* PINMAME && LISY_SUPPORT */

#define FIXMUX // DataEast Playboy 35th fix

// TODO:
// DE display layouts
#define S11_PIA0 0
Expand Down Expand Up @@ -92,10 +90,8 @@ static struct {
int sndCmd; /* external sound board cmd */
int piaIrq;
int deGame; /*Flag to see if it's a Data East game running*/
#ifdef FIXMUX
UINT8 solBits1,solBits2;
UINT8 solBits2prv;
#endif
#ifndef PINMAME_NO_UNUSED
int soundSys; /* 0 = CPU board sound, 1 = Sound board */
#endif
Expand Down Expand Up @@ -194,26 +190,15 @@ static INTERRUPT_GEN(s11_vblank) {
/*-- but only when no P-ROC, otherwise special solenoids -- */
/*-- lock on when controlled by direct switches -- */
for (ii = 0; ii < 6; ii++) {
if (core_gameData->sxx.ssSw[ii] && core_getSw(core_gameData->sxx.ssSw[ii]))
if (core_gameData->sxx.ssSw[ii] && core_getSw(core_gameData->sxx.ssSw[ii])) {
locals.solenoids |= CORE_SOLBIT(CORE_FIRSTSSSOL+ii);
core_write_pwm_output(CORE_MODOUT_SOL0 + CORE_FIRSTSSSOL + ii - 1, 1, 1);
}
}
#if defined(PROC_SUPPORT) || defined(LISY_SUPPORT)
}
#endif
}
#ifdef FIXMUX
// mux translation moved
#else
if ((core_gameData->sxx.muxSol) &&
(locals.solenoids & CORE_SOLBIT(core_gameData->sxx.muxSol))) {
if (core_gameData->hw.gameSpecific1 & S11_RKMUX)
locals.solenoids = (locals.solenoids & 0x00ff8fef) |
((locals.solenoids & 0x00000010)<<20) |
((locals.solenoids & 0x00007000)<<13);
else
locals.solenoids = (locals.solenoids & 0x00ffff00) | (locals.solenoids<<24);
}
#endif
locals.solsmooth[locals.vblankCount % S11_SOLSMOOTH] = locals.solenoids;
#if !defined(PROC_SUPPORT) && !defined(LISY_SUPPORT)
#if S11_SOLSMOOTH != 2
Expand Down Expand Up @@ -403,9 +388,15 @@ static WRITE_HANDLER(pia2b_w) {
....
data = 0x80, CN3-Pin 1 (Blinder on Tommy)*/
if (core_gameData->gen & GEN_DEDMD16) {
if (core_gameData->hw.gameSpecific1 & S11_PRINTERLINE) locals.extSol |= locals.extSolPulse = (data ^ 0xff);
if (core_gameData->hw.gameSpecific1 & S11_PRINTERLINE) {
locals.extSol |= locals.extSolPulse = (data ^ 0xff);
core_write_pwm_output_8b(CORE_MODOUT_SOL0 + 40, locals.extSolPulse);
}
} else if (core_gameData->gen & (GEN_DEDMD32|GEN_DEDMD64)) {
if (core_gameData->hw.gameSpecific1 & S11_PRINTERLINE) locals.extSol |= locals.extSolPulse = data;
if (core_gameData->hw.gameSpecific1 & S11_PRINTERLINE) {
locals.extSol |= locals.extSolPulse = data;
core_write_pwm_output_8b(CORE_MODOUT_SOL0 + 40, locals.extSolPulse);
}
}
else {
if (core_gameData->hw.display & S11_DISPINV) data = ~data;
Expand Down Expand Up @@ -488,8 +479,6 @@ static void setSSSol(int data, int solNo) {
core_write_pwm_output(CORE_MODOUT_SOL0 + CORE_FIRSTSSSOL + ssSolNo[locals.deGame][solNo] - 1, 1, (locals.ssEn & (~data & 1)) ? 1 : 0);
}

#ifdef FIXMUX

static void updsol(void) {
/* set new solenoids, preserve SSSol */
coreGlobals.pulsedSolState = (coreGlobals.pulsedSolState & 0x00ff0000)
Expand Down Expand Up @@ -542,17 +531,6 @@ static WRITE_HANDLER(latch2200) {
}
}

#else
static WRITE_HANDLER(pia0b_w) {
coreGlobals.pulsedSolState = (coreGlobals.pulsedSolState & 0xffff00ff) | (data<<8);
locals.solenoids |= (data<<8);
}
static WRITE_HANDLER(latch2200) {
coreGlobals.pulsedSolState = (coreGlobals.pulsedSolState & 0xffffff00) | data;
locals.solenoids |= data;
}
#endif

static WRITE_HANDLER(pia0cb2_w) { locals.ssEn = !data; coreGlobals.physicOutputState[CORE_MODOUT_SOL0 + S11_GAMEONSOL - 1].value = data ? 0.f : 1.f; }

static WRITE_HANDLER(pia1ca2_w) { setSSSol(data, 0); }
Expand Down Expand Up @@ -605,7 +583,10 @@ static WRITE_HANDLER(pia5cb2_w) {
/* don't pass to sound board if a sound overlay board is available */
if ((core_gameData->hw.gameSpecific1 & S11_SNDOVERLAY) &&
((locals.sndCmd & 0xe0) == 0)) {
if (!data) locals.extSol |= locals.extSolPulse = (~locals.sndCmd) & 0x1f;
if (!data) {
locals.extSol |= locals.extSolPulse = (~locals.sndCmd) & 0x1f;
core_write_pwm_output_8b(CORE_MODOUT_SOL0 + 40, locals.extSolPulse);
}
}
else sndbrd_1_ctrl_w(0,data);
}
Expand Down Expand Up @@ -818,8 +799,15 @@ static MACHINE_INIT(s11) {
while (rootDrv->clone_of && (rootDrv->clone_of->flags & NOT_A_DRIVER) == 0)
rootDrv = rootDrv->clone_of;
const char* const gn = rootDrv->name;
// Williams S11
if (strncasecmp(gn, "polic_l4", 8) == 0) { // Police Force
core_set_pwm_output_type(CORE_MODOUT_SOL0 + 10 - 1, 2, CORE_MODOUT_BULB_44_6_3V_AC); // Playfield and Backbox GI output
core_set_pwm_output_type(CORE_MODOUT_SOL0 + 25 - 1, 8, CORE_MODOUT_BULB_89_25V_DC_S11); // 8 muxed flasher outputs (Mux relay is solenoid #12)
core_set_pwm_output_type(CORE_MODOUT_SOL0 + 9 - 1, 1, CORE_MODOUT_BULB_89_25V_DC_S11);
core_set_pwm_output_type(CORE_MODOUT_SOL0 + 13 - 1, 2, CORE_MODOUT_BULB_89_25V_DC_S11);
}
// DataEast/Sega 1
if (strncasecmp(gn, "lwar_a83", 8) == 0) { // Laser War
else if (strncasecmp(gn, "lwar_a83", 8) == 0) { // Laser War
core_set_pwm_output_type(CORE_MODOUT_SOL0 + 11 - 1, 1, CORE_MODOUT_BULB_44_6_3V_AC); // GI output
core_set_pwm_output_type(CORE_MODOUT_SOL0 + 25 - 1, 8, CORE_MODOUT_BULB_89_32V_DC_S11); // 8 muxed flasher outputs (K1 relay is solenoid #10)
core_set_pwm_output_type(CORE_MODOUT_SOL0 + 1 - 1, 3, CORE_MODOUT_BULB_89_32V_DC_S11);
Expand Down

0 comments on commit a7bb427

Please sign in to comment.