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

Generalized pwm #194

Merged
merged 8 commits into from
Jan 20, 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
5 changes: 3 additions & 2 deletions release/whatsnew.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ Added the emulation of physical bulbs & LEDs connected to binary outputs, for WP
To be emulated correctly, devices connected to binary output must be defined. PinMAME already has the definition for lots of them
(to be found in MACHINE_INIT of each driver) but if the one you want is missing, or you want to modify it, use 'SolMask(xx) = type'
to change it, where xx is the output to be modified (see vp_setSolMask), and yy is the type (see core.h). Also see the updated core
scripts coming with VPX. This also opens up the path for emulation of dimmed alphanumerical segments and strength modulated solenoids
(for example Capcom Kingpin, or the way most modern hardware handle Power/Hold and EOS switch).
scripts coming with VPX. This also includes emulation of dimmed alphanumerical segments for GTS3 and WPC, and opens up the path for
emulation of strength modulated solenoids (for example most magnets, Capcom Kingpin, or the way most modern hardware handle Power/Hold
and EOS switch).

*** CORE/CPU ***
Fixed WPC General Illumination (GI) Dimming (most noticably if more than one GI line is involved, also all 8 levels are now handled properly)
Expand Down
16 changes: 8 additions & 8 deletions src/wpc/capcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,12 @@ static WRITE16_HANDLER(u16_w) {
}
case 0x201: { // IRQ4 Line 1 frequency
LOG_U16(("PC %08x - U16w IRQ4 f1=%03x [data@%03x=%04x] (%04x)\n", activecpu_get_pc(), data, offset, data, mem_mask));
locals.u16IRQ4Line1Period = TIME_IN_SEC(((0x1000 - (data & 0x0FFF)) * 88.7) / (double)CPU_CLOCK);
locals.u16IRQ4Line1Period = TIME_IN_SEC(((0x1000 - (data & 0x0FFF)) * 88.675) / (double)CPU_CLOCK);
break;
}
case 0x202: { // IRQ4 Line 2 frequency
LOG_U16(("PC %08x - U16w IRQ4 f2=%03x [data@%03x=%04x] (%04x)\n", activecpu_get_pc(), data, offset, data, mem_mask));
locals.u16IRQ4Line2Period = TIME_IN_SEC(((0x1000 - (data & 0x0FFF)) * 88.7) / (double)CPU_CLOCK);
locals.u16IRQ4Line2Period = TIME_IN_SEC(((0x1000 - (data & 0x0FFF)) * 88.675) / (double)CPU_CLOCK);
break;
}
default:
Expand Down Expand Up @@ -724,7 +724,7 @@ static MACHINE_INIT(cc) {
core_set_pwm_output_type(CORE_MODOUT_LAMP0 + coreGlobals.nLamps - 7, 1, CORE_MODOUT_LED); // Sound Board Diagnostic LED
coreGlobals.nSolenoids = CORE_FIRSTCUSTSOL - 1 + core_gameData->hw.custSol;
core_set_pwm_output_type(CORE_MODOUT_SOL0, coreGlobals.nSolenoids, CORE_MODOUT_SOL_2_STATE);
coreGlobals.physicOutputState[CORE_MODOUT_SOL0 + CORE_FIRSTCUSTSOL - 1].type = CORE_MODOUT_LEGACY_SOL_CUSTOM; // GameOn solenoid for Fast Flips
core_set_pwm_output_type(CORE_MODOUT_SOL0 + CORE_FIRSTCUSTSOL - 1, 1, CORE_MODOUT_SOL_CUSTOM); // GameOn solenoid for Fast Flips
// Game specific hardware
const struct GameDriver* rootDrv = Machine->gamedrv;
while (rootDrv->clone_of && (rootDrv->clone_of->flags & NOT_A_DRIVER) == 0)
Expand All @@ -742,8 +742,8 @@ static MACHINE_INIT(cc) {
}
else if (strncasecmp(gn, "bsv103", 6) == 0) { // Breakshot
coreGlobals.flipperCoils = 0xFFFFFFFFFF0A0908;
coreGlobals.physicOutputState[CORE_MODOUT_SOL0 + 28 - 1].type = CORE_MODOUT_BULB_89_20V_DC_WPC; // Center pocket Flasher
// coreGlobals.physicOutputState[CORE_MODOUT_SOL0 + 27 - 1].type = CORE_MODOUT_BULB_89_20V_DC_WPC; // Plunger Flasher (appears in doc but was not kept in production)
core_set_pwm_output_type(CORE_MODOUT_SOL0 + 28 - 1, 5, CORE_MODOUT_BULB_89_20V_DC_WPC); // Center pocket Flasher
// core_set_pwm_output_type(CORE_MODOUT_SOL0 + 27 - 1, 5, CORE_MODOUT_BULB_89_20V_DC_WPC); // Plunger Flasher (appears in doc but was not kept in production)
}
else if (strncasecmp(gn, "ffv104", 6) == 0) { // Flipper Football
coreGlobals.flipperCoils = 0xFFFFFFFF0B0A0908;
Expand All @@ -769,11 +769,11 @@ static MACHINE_INIT(cc) {
locals.u16IRQ4Line3timer = timer_alloc(cc_u16irq4line3);
// defaults IRQ periods
locals.u16IRQ1Period = TIME_IN_SEC(22668 / (double)CPU_CLOCK);
locals.u16IRQ4Line1Period = TIME_IN_SEC(((0x1000 - (0x0800 & 0x0FFF)) * 88.7) / (double)CPU_CLOCK);
locals.u16IRQ4Line2Period = TIME_IN_SEC(((0x1000 - (0x0800 & 0x0FFF)) * 88.7) / (double)CPU_CLOCK);
locals.u16IRQ4Line1Period = TIME_IN_SEC(((0x1000 - (0x0800 & 0x0FFF)) * 88.675) / (double)CPU_CLOCK);
locals.u16IRQ4Line2Period = TIME_IN_SEC(((0x1000 - (0x0800 & 0x0FFF)) * 88.675) / (double)CPU_CLOCK);
// Flipper Football frequency for IRQ4 Line 3 is half of other games => likely DMD vblank since DMD has twice more lines (so 45.9Hz for FF, 91.8Hz for others)
int defaultLine3 = (core_gameData->hw.gameSpecific1 == 9 || core_gameData->hw.gameSpecific1 == 12) ? 0x0000 : 0x0800;
locals.u16IRQ4Line3Period = TIME_IN_SEC(((0x1000 - (defaultLine3 & 0x0FFF)) * 88.7) / (double)CPU_CLOCK);
locals.u16IRQ4Line3Period = TIME_IN_SEC(((0x1000 - (defaultLine3 & 0x0FFF)) * 88.675) / (double)CPU_CLOCK);

#if TEST_MPGAUDIO
//Freeze cpu so it won't slow down the emulation
Expand Down
Loading
Loading