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

Fix Elvis/Monopoly flipper, SAM cleanups, bug list update #405

Merged
merged 1 commit into from
Jan 5, 2025
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
4 changes: 2 additions & 2 deletions docs/dmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ The table below gives the main information (PWM FPS / Display FPS / PWM pattern)
|[WPC](#wpc) | **122.1** / 61.1-40.7 | 2/3 frames | |
|[WPC Phantom Haus](#wpc) | 61.05 / 30.1 | 2 frames | |
|[Data East 128x16](#data-east-128x16) | 177.5 / **59.2** | 2u row | |
|[Data East 128x32](#data-east-128x32-segastern-whitestar) | 234.2 / **78.1** | 2u row | |
|Sega 192x64 | 224.2 / 74.73 | 2u row | |
|[Data East 128x32](#data-east-128x32-segastern-whitestar) | 234.2 / **78.1** | 2u row |Some machines exhibit slow startup |
|Sega 192x64 | 224.2 / 74.73 | 2u row |Title screen shows sometimes, likely due to timing issues |
|Gottlieb GTS3 | **375.9** / 125.3-37.6 | 3/6/8/10 frames | |
|[Alvin G. 1](#alvin-g) | 332.4 / 83.1 | 4 row |Still a little flicker on the title screen |
|[Alvin G. 2](#alvin-g) | 298.6 / **74.6** | 4 row | |
Expand Down
10 changes: 6 additions & 4 deletions release/bugs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Major bugs in PinMAME that we are aware of:
(~24 and above, for example on Nascar and Grand Prix, or even ~20 on LOTR, so avoid this)
This seems to happen on real machines (verified on 2 different Grand Prix pinballs), too.

#6) Data East/Sega/Stern/Gottlieb/Alvin G DMD timing is not 100% accurate for all machines.
#6) Some Data East have slow DMD startups (Star Wars,...), Sega 192x64 timing is not 100% accurate and
sometimes shows startup screen, Alvin G. has timings issues resulting in some flicker.

#7) Sound gets cut off in Alvin G games sometimes, and some weird notes in World Tour occasionally.

Expand All @@ -31,6 +32,7 @@ Major bugs in PinMAME that we are aware of:
#10) Some setups crash when using the AT91 JIT compiled code (e.g. Whitestar II and SAM), disable AT91 JIT
by setting "at91jit" to 0 in the registry.

#11) AT91 JIT is 32-bit and x86 only. The non-JIT core doesn't have tight IRQ timing, and that results in the SAM serial ports freezing
("slow DMD/CPU disease" on SAM LE tables). It would be possible to tighten up the timing in the interpreted core,
but it causes a huge performance hit (have to keep checking on memory writes whether an IRQ needs to fire).
#11) AT91 JIT is 32-bit and x86 only. The non-JIT core doesn't have tight IRQ timing that may cause emulation issues.
It would be possible to tighten up the timing in the interpreted core, but it causes a huge performance hit
(have to keep checking on memory writes whether an IRQ needs to fire).

25 changes: 14 additions & 11 deletions src/wpc/sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ struct {
INT16 bank;

// IO Board:
int lampcol;
int lamprow;
UINT16 lampcol;
UINT8 lamprow;
UINT8 auxstrb;
UINT8 auxdata;

Expand Down Expand Up @@ -884,7 +884,7 @@ static WRITE32_HANDLER(sambank_w)
break;
case 0x02400029: // AUX_LMP
samlocals.lampcol = (samlocals.lampcol & 0x00FF) | (data << 8);
core_write_pwm_output_lamp_matrix(CORE_MODOUT_LAMP0, samlocals.lampcol & 0x00FF, samlocals.lamprow, 8);
core_write_pwm_output_lamp_matrix(CORE_MODOUT_LAMP0, samlocals.lampcol & 0x00FF, samlocals.lamprow, 8);
core_write_pwm_output_lamp_matrix(CORE_MODOUT_LAMP0 + 64, (samlocals.lampcol >> 8) & 0x0003, samlocals.lamprow, 2);
break;
case 0x0240002A: // LMP_DRV
Expand Down Expand Up @@ -2246,22 +2246,25 @@ static PINMAME_VIDEO_UPDATE(samdmd_update) {

// Little 5x7 led matrix used in World Poker Tour (2 rows of 7 each)
static PINMAME_VIDEO_UPDATE(samminidmd_update) {
int ii,kk;
const int dmd_x = (layout->left-10)/7;
const int dmd_y = (layout->top-34)/9;
assert(layout->length == 5);
assert(layout->start == 7);
assert(0 <= dmd_x && dmd_x < 7);
assert(0 <= dmd_y && dmd_y < 2);
for (int y = 0; y < 7; y++)
for (int x = 0; x < 5; x++) {
const int target = 10 * 8 + (dmd_y * 5 + x) * 49 + (dmd_x * 7 + y);
const float v = coreGlobals.physicOutputState[CORE_MODOUT_LAMP0 + target].value;
coreGlobals.dmdDotRaw[y * layout->length + x] = SAT_NYB(v);
coreGlobals.dmdDotLum[y * layout->length + x] = SAT_BYTE(v);
coreGlobals.dmdDotRaw[y * 5 + x] = SAT_NYB(v); // TODO raw value should not be tied to the PWM integration
coreGlobals.dmdDotLum[y * 5 + x] = SAT_BYTE(v);
}
// Use the video update to output mini DMD as LED segments (somewhat hacky)
for (ii = 0; ii < 5; ii++) {
for (int x = 0; x < 5; x++) {
int bits = 0;
for (kk = 0; kk < 7; kk++)
bits = (bits<<1) | (coreGlobals.dmdDotRaw[kk * layout->length + ii] ? 1 : 0);
coreGlobals.drawSeg[5*dmd_x + 35*dmd_y + ii] = bits;
for (int y = 0; y < 7; y++)
bits = (bits << 1) | (coreGlobals.dmdDotRaw[y * 5 + x] ? 1 : 0);
coreGlobals.drawSeg[35 * dmd_y + 5 * dmd_x + x] = bits;
}
if (!pmoptions.dmd_only)
core_dmd_video_update(bitmap, cliprect, layout, NULL);
Expand All @@ -2275,7 +2278,7 @@ static PINMAME_VIDEO_UPDATE(samminidmd2_update) {
for (kk = 0; kk < 5; kk++) {
const int target = 140 + jj + (kk * 35);
const float v = coreGlobals.physicOutputState[CORE_MODOUT_LAMP0 + target].value;
coreGlobals.dmdDotRaw[kk * layout->length + jj] = SAT_NYB(v);
coreGlobals.dmdDotRaw[kk * layout->length + jj] = SAT_NYB(v); // TODO raw value should not be tied to the PWM integration
coreGlobals.dmdDotLum[kk * layout->length + jj] = SAT_BYTE(v);
}
// Use the video update to output mini DMD as LED segments (somewhat hacky)
Expand Down
18 changes: 9 additions & 9 deletions src/wpc/se.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,18 @@ static INTERRUPT_GEN(se_vblank) {
selocals.flipsol = selocals.flipsolPulse;
}
if ((selocals.vblankCount % (VBLANK*SE_SOLSMOOTH)) == 0) {
coreGlobals.solenoids = selocals.solenoids;
// Fast flips. Use Solenoid 15, this is the left flipper solenoid that is
// unused because it is remapped to VPM flipper constants.
coreGlobals.solenoids = selocals.solenoids;
// Fast flips. Use Solenoid 15, this is the left flipper solenoid that is
// unused because it is remapped to VPM flipper constants.
if (selocals.fastflipaddr > 0 && memory_region(SE_CPUREGION)[selocals.fastflipaddr - 1] > 0) {
coreGlobals.solenoids |= 0x4000;
core_write_pwm_output(CORE_MODOUT_SOL0 + 15 - 1, 1, 1);
coreGlobals.solenoids |= 0x4000;
core_write_pwm_output(CORE_MODOUT_SOL0 + 15 - 1, 1, 1);
}
else
{
core_write_pwm_output(CORE_MODOUT_SOL0 + 15 - 1, 1, 0);
core_write_pwm_output(CORE_MODOUT_SOL0 + 15 - 1, 1, 0);
}
selocals.solenoids = coreGlobals.pulsedSolState;
selocals.solenoids = coreGlobals.pulsedSolState;
#ifdef PROC_SUPPORT
if (coreGlobals.p_rocEn) {
static UINT64 lastSol = 0;
Expand Down Expand Up @@ -637,7 +637,7 @@ static READ_HANDLER(dip_r) { return ~core_getDip(0); }

/*-- Solenoids --*/
static const int solmaskno[] = { 8, 0, 16, 24 };
static WRITE_HANDLER(solenoid_w) {
WRITE_HANDLER(se_solenoid_w) {
UINT32 mask = ~(0xff<<solmaskno[offset]);
UINT32 sols = data<<solmaskno[offset];
if (offset == 0) { /* move flipper power solenoids (L=15,R=16) to (R=45,L=47) */
Expand Down Expand Up @@ -1049,7 +1049,7 @@ MEMORY_END

static MEMORY_WRITE_START(se_writemem)
{ 0x0000, 0x1fff, ram_w },
{ 0x2000, 0x2003, solenoid_w },
{ 0x2000, 0x2003, se_solenoid_w },
{ 0x2006, 0x2007, auxboard_w },
{ 0x2008, 0x2008, lampstrb_w },
{ 0x2009, 0x2009, auxlamp_w },
Expand Down
17 changes: 5 additions & 12 deletions src/wpc/sims/se/prelim/elvis.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,21 +515,14 @@ static core_tGameData elvisGameData = {
};

/*-- Solenoids --*/
extern WRITE_HANDLER(se_solenoid_w);
static WRITE_HANDLER(elvis_w) {
static const int solmaskno[] = { 8, 0, 16, 24 };
core_write_pwm_output_8b(CORE_MODOUT_SOL0 + solmaskno[offset], data);
UINT32 mask = ~(0xff<<solmaskno[offset]);
UINT32 sols = data<<solmaskno[offset];
if (offset == 0) { /* move flipper power solenoids (L=15,R=16) to (R=45,L=47) */
selocals.flipsol |= selocals.flipsolPulse = ((data & 0x80)>>7) | ((data & 0x40)>>4);
sols &= 0xffff3fff; /* mask off flipper solenoids */
}
coreGlobals.pulsedSolState = (coreGlobals.pulsedSolState & mask) | sols;
selocals.solenoids |= sols;
se_solenoid_w(offset, data);

if (offset == 3) {
int pos = data & 0x0f;
locals.legs = (data & 0x10) ? 1 : 0;
locals.arms = (data & 0x20) ? 1 : 0;
locals.legs = (data & 0x10) ? 1 : 0;
locals.arms = (data & 0x20) ? 1 : 0;
if (pos) {
if (locals.lastPos != pos) {
if ((locals.lastPos == 0x0c && pos == 0x06) || (locals.lastPos == 0x06 && pos == 0x03) || (locals.lastPos == 0x03 && pos == 0x09) || (locals.lastPos == 0x09 && pos == 0x0c)) {
Expand Down
13 changes: 3 additions & 10 deletions src/wpc/sims/se/prelim/monopoly.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,17 +517,10 @@ static core_tGameData monopolyGameData = {
};

/*-- Solenoids --*/
extern WRITE_HANDLER(se_solenoid_w);
static WRITE_HANDLER(monopoly_w) {
static const int solmaskno[] = { 8, 0, 16, 24 };
core_write_pwm_output_8b(CORE_MODOUT_SOL0 + solmaskno[offset], data);
UINT32 mask = ~(0xff<<solmaskno[offset]);
UINT32 sols = data<<solmaskno[offset];
if (offset == 0) { /* move flipper power solenoids (L=15,R=16) to (R=45,L=47) */
selocals.flipsol |= selocals.flipsolPulse = ((data & 0x80)>>7) | ((data & 0x40)>>4);
sols &= 0xffff3fff; /* mask off flipper solenoids */
}
coreGlobals.pulsedSolState = (coreGlobals.pulsedSolState & mask) | sols;
selocals.solenoids |= sols;
se_solenoid_w(offset, data);

if (offset == 3) {
locals.flipperDir = ((data & 0x04) >> 1) - 1; // so +1 for cw, -1 for ccw
if (data & 0x01) { // increase flipper speed if set
Expand Down
Loading