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

GTS3: rewrite DMD PWM integration #306

Merged
merged 1 commit into from
Aug 28, 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
4 changes: 2 additions & 2 deletions src/wpc/bowlgames.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,8 @@ CORE_CLONEDEF(afv,d4,l4,"Addams Family Values (Coin Dropper) (D-4 LED Ghost Fix)
/ Strikes N' Spares (#N111)
/-------------------------------------------------------------------*/
static struct core_dispLayout GTS3_dispDMD[] = {
{0,0,32,128,CORE_DMD|CORE_DMDNOAA,(genf *)gts3_dmd128x32},
{34,0,32,128,CORE_DMD|CORE_DMDNOAA,(genf *)gts3_dmd128x32a},
{0,0,32,128,CORE_DMD|CORE_DMDNOAA,(genf *)gts3_dmd128x32a},
{34,0,32,128,CORE_DMD|CORE_DMDNOAA,(genf *)gts3_dmd128x32b},
{0}
};
static core_tGameData snsparesGameData = {GEN_GTS3,GTS3_dispDMD,{FLIP_SWNO(21,22),4,4,0,SNDBRD_NONE,0}};
Expand Down
6 changes: 2 additions & 4 deletions src/wpc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
static UINT8 has_DMD_Video = 0;

#include "gts3dmd.h"
UINT8 g_raw_gtswpc_dmd[GTS3DMD_FRAMES_5C*0x200];
UINT8 g_raw_gtswpc_dmd[GTS3DMD_FRAMES*0x200];
UINT32 g_raw_gtswpc_dmdframes = 0;

UINT8 g_needs_DMD_update = 1;
Expand Down Expand Up @@ -854,9 +854,7 @@ void video_update_core_dmd(struct mame_bitmap *bitmap, const struct rectangle *c
int ii, jj;

// prepare all brightness & color/palette tables for mappings from internal DMD representation:
const int shade_16_enabled = ((core_gameData->gen & (GEN_SAM|GEN_SPA|GEN_ALVG_DMD2)) ||
// extended handling also for some GTS3 games (SMB, SMBMW and CBW):
(strncasecmp(Machine->gamedrv->name, "smb", 3) == 0) || (strncasecmp(Machine->gamedrv->name, "cueball", 7) == 0));
const int shade_16_enabled = (core_gameData->gen & (GEN_SAM|GEN_SPA|GEN_ALVG_DMD2|GEN_GTS3)) != 0;

#if defined(VPINMAME) || defined(LIBPINMAME)

Expand Down
8 changes: 2 additions & 6 deletions src/wpc/dmddevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ void renderDMDFrame(UINT64 gen, UINT16 width, UINT16 height, UINT8 *currbuffer,
dmd_height = height;
dmd_hasDMD = true;

if ((gen & (GEN_SAM|GEN_SPA|GEN_ALVG_DMD2)) ||
// extended handling also for some GTS3 games (SMB, SMBMW and CBW):
(strncasecmp(GameName, "smb", 3) == 0) || (strncasecmp(GameName, "cueball", 7) == 0)) {
if ((gen & (GEN_SAM | GEN_SPA | GEN_ALVG_DMD2 | GEN_GTS3)) != 0) {
if (noOfRawFrames != 0) {
if (DmdDev_Render_16_Shades_with_Raw) {
DmdDev_Render_16_Shades_with_Raw(width, height, currbuffer, noOfRawFrames, rawbuffer);
Expand Down Expand Up @@ -324,9 +322,7 @@ void render2ndDMDFrame(UINT64 gen, UINT16 width, UINT16 height, UINT8* currbuffe
dmd_height = height;
dmd_hasDMD = true;

if ((gen & (GEN_SAM|GEN_SPA|GEN_ALVG_DMD2)) ||
// extended handling also for some GTS3 games (SMB, SMBMW and CBW):
(strncasecmp(GameName, "smb", 3) == 0) || (strncasecmp(GameName, "cueball", 7) == 0)) {
if ((gen & (GEN_SAM | GEN_SPA | GEN_ALVG_DMD2 | GEN_GTS3)) != 0) {
if (noOfRawFrames != 0) {
if (DmdScr_Render_16_Shades_with_Raw) {
DmdScr_Render_16_Shades_with_Raw(width, height, currbuffer, noOfRawFrames, rawbuffer);
Expand Down
80 changes: 12 additions & 68 deletions src/wpc/gts3.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include "gts3dmd.h"
#include "gts80s.h"

UINT8 DMDFrames [GTS3DMD_FRAMES_5C][0x200];
UINT8 DMDFrames2[GTS3DMD_FRAMES_5C][0x200]; //2nd DMD Display for Strikes N Spares
UINT8 DMDFrames [GTS3DMD_FRAMES][0x200];
UINT8 DMDFrames2[GTS3DMD_FRAMES][0x200]; //2nd DMD Display for Strikes N Spares

#define GTS3_VBLANKFREQ 60 /* VBLANK frequency*/
#define GTS3_IRQFREQ 1500 /* IRQ Frequency (Guessed)*/
Expand Down Expand Up @@ -247,7 +247,7 @@ static READ_HANDLER( xvia_1_b_r )
{
// logerror1("via_1_b_r\n");
int data = 0 ;
if(GTS3_dmdlocals[0].version == 2)
if(GTS3_dmdlocals[0].has2DMD)
data |= (GTS3_dmdlocals[1].status1 << 7);
return data;
}
Expand Down Expand Up @@ -284,7 +284,7 @@ static WRITE_HANDLER( xvia_1_a_w )
GTS3locals.sound_data = data^0xff;

//Unless it's Strikes N Spares, send the sound command now!
if (GTS3_dmdlocals[0].version != 2)
if (GTS3_dmdlocals[0].has2DMD == 0)
sndbrd_0_data_w(0, GTS3locals.sound_data);
}

Expand Down Expand Up @@ -423,7 +423,7 @@ static INTERRUPT_GEN(GTS3_vblank) {

/*-- diagnostic leds --*/
if ((GTS3locals.vblankCount % GTS3_DISPLAYSMOOTH) == 0) { // TODO it seems that diag LEDs are PWMed => move to a lamp
if (GTS3_dmdlocals[0].version == 2) { //Strikes N Spares has 2 DMD LED, but no Sound Board LED
if (GTS3_dmdlocals[0].has2DMD) { //Strikes N Spares has 2 DMD LED, but no Sound Board LED
coreGlobals.diagnosticLed = GTS3locals.diagnosticLed |
(GTS3_dmdlocals[0].diagnosticLed << 1) |
(GTS3_dmdlocals[1].diagnosticLed << 2);
Expand Down Expand Up @@ -718,46 +718,16 @@ static void gts3dmd_init(void) {
}

/*DMD Generation Init*/
static MACHINE_INIT(gts3dmd_4c_a) {
static MACHINE_INIT(gts3dmd) {
gts3dmd_init();
GTS3_dmdlocals[0].color_mode = 0;
}

static MACHINE_INIT(gts3dmd_4c_b) {
gts3dmd_init();
GTS3_dmdlocals[0].color_mode = 1;
}

static MACHINE_INIT(gts3dmd_5c) {
gts3dmd_init();
GTS3_dmdlocals[0].color_mode = 2;
}

static MACHINE_INIT(gts3dmda_4c_a) {
gts3dmd_init();
GTS3_dmdlocals[0].color_mode = 0;
GTS3_dmdlocals[0].version = 1;
}

static MACHINE_INIT(gts3dmda_4c_b) {
gts3dmd_init();
GTS3_dmdlocals[0].color_mode = 1;
GTS3_dmdlocals[0].version = 1;
}

static MACHINE_INIT(gts3dmda_5c) {
gts3dmd_init();
GTS3_dmdlocals[0].color_mode = 2;
GTS3_dmdlocals[0].version = 1;
}

/* Strikes n' Spares: this game uses TWO complete DMD boards! */
static MACHINE_INIT(gts3dmd2) {
gts3dmd_init();
memset(&GTS3_dmdlocals[1], 0, sizeof(GTS3_DMDlocals));
memset(&DMDFrames2, 0, sizeof(DMDFrames2));
GTS3_dmdlocals[0].color_mode = 1;
GTS3_dmdlocals[0].version = 2;
GTS3_dmdlocals[0].has2DMD = 1;

//Init 2nd 6845
crtc6845_init(1);
Expand Down Expand Up @@ -958,7 +928,7 @@ static WRITE_HANDLER(dmd_aux) {
GTS3locals.ax[4+offset] = data;

//Strikes N Spares Stuff
if (GTS3_dmdlocals[0].version == 2)
if (GTS3_dmdlocals[0].has2DMD)
{
//AX4 Line - Clocks in a new DMD command for Display #2
if (offset == 0) {
Expand All @@ -982,7 +952,7 @@ static void dmd_vblank(int which) {
else
memcpy(DMDFrames[GTS3_dmdlocals[0].nextDMDFrame],memory_region(GTS3_MEMREG_DCPU1)+0x1000+offset,0x200);
cpu_set_nmi_line(which ? GTS3_DCPUNO2 : GTS3_DCPUNO, PULSE_LINE);
GTS3_dmdlocals[which].nextDMDFrame = (GTS3_dmdlocals[which].nextDMDFrame + 1) % (GTS3_dmdlocals[0].color_mode == 0 ? GTS3DMD_FRAMES_4C_a : (GTS3_dmdlocals[0].color_mode == 1 ? GTS3DMD_FRAMES_4C_b : GTS3DMD_FRAMES_5C));
GTS3_dmdlocals[which].nextDMDFrame = (GTS3_dmdlocals[which].nextDMDFrame + 1) % GTS3DMD_FRAMES;
}

/* Printer connector */
Expand Down Expand Up @@ -1160,40 +1130,14 @@ MACHINE_DRIVER_START(gts3_1bs)
MDRV_IMPORT_FROM(gts80s_s3)
MACHINE_DRIVER_END

MACHINE_DRIVER_START(gts3_2_4c_a)
MACHINE_DRIVER_START(gts3_21)
MDRV_IMPORT_FROM(gts3)
MDRV_CPU_ADD(M65C02, 3579545./2.)
MDRV_CPU_MEMORY(GTS3_dmdreadmem, GTS3_dmdwritemem)
MDRV_CORE_INIT_RESET_STOP(gts3dmd_4c_a,NULL,gts3)
MDRV_CORE_INIT_RESET_STOP(gts3dmd,NULL,gts3)
MDRV_IMPORT_FROM(gts80s_s3)
MACHINE_DRIVER_END

MACHINE_DRIVER_START(gts3_2_4c_b)
MDRV_IMPORT_FROM(gts3_2_4c_a)
MDRV_CORE_INIT_RESET_STOP(gts3dmd_4c_b,NULL,gts3)
MACHINE_DRIVER_END

MACHINE_DRIVER_START(gts3_2_5c)
MDRV_IMPORT_FROM(gts3_2_4c_a)
MDRV_CORE_INIT_RESET_STOP(gts3dmd_5c,NULL,gts3)
MACHINE_DRIVER_END

MACHINE_DRIVER_START(gts3_2a_4c_a)
MDRV_IMPORT_FROM(gts3_2_4c_a)
MDRV_CORE_INIT_RESET_STOP(gts3dmda_4c_a,NULL,gts3)
MACHINE_DRIVER_END

MACHINE_DRIVER_START(gts3_2a_4c_b)
MDRV_IMPORT_FROM(gts3_2_4c_a)
MDRV_CORE_INIT_RESET_STOP(gts3dmda_4c_b,NULL,gts3)
MACHINE_DRIVER_END

MACHINE_DRIVER_START(gts3_2a_5c)
MDRV_IMPORT_FROM(gts3_2_4c_a)
MDRV_CORE_INIT_RESET_STOP(gts3dmda_5c,NULL,gts3)
MACHINE_DRIVER_END


//Sound Interface for Strikes N Spares
static struct OKIM6295interface sns_okim6295_interface = {
1, /* 1 chip */
Expand All @@ -1207,7 +1151,7 @@ MACHINE_DRIVER_START(gts3_22)
MDRV_IMPORT_FROM(gts3)
MDRV_CPU_ADD(M65C02, 3579545./2.)
MDRV_CPU_MEMORY(GTS3_dmdreadmem, GTS3_dmdwritemem)
MDRV_CORE_INIT_RESET_STOP(gts3dmd_4c_b,NULL,gts3)
MDRV_CORE_INIT_RESET_STOP(gts3dmd,NULL,gts3)
MDRV_CPU_ADD(M65C02, 3579545./2.)
MDRV_CPU_MEMORY(GTS3_dmdreadmem2, GTS3_dmdwritemem2)
MDRV_CORE_INIT_RESET_STOP(gts3dmd2,NULL,gts3)
Expand Down
21 changes: 5 additions & 16 deletions src/wpc/gts3.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@
ROM_LOAD(n1, 0x00000, 0, chk1)

extern void UpdateSoundLEDS(int num,UINT8 bit);
extern PINMAME_VIDEO_UPDATE(gts3_dmd128x32);
extern PINMAME_VIDEO_UPDATE(gts3_dmd128x32a);
extern PINMAME_VIDEO_UPDATE(gts3_dmd128x32b);

/*-- These are only here so the game structure can be in the game file --*/
extern MACHINE_DRIVER_EXTERN(gts3_1a);
Expand All @@ -200,12 +200,7 @@ extern MACHINE_DRIVER_EXTERN(gts3_1as80b2);
extern MACHINE_DRIVER_EXTERN(gts3_1as80b3);
extern MACHINE_DRIVER_EXTERN(gts3_1b);
extern MACHINE_DRIVER_EXTERN(gts3_1bs);
extern MACHINE_DRIVER_EXTERN(gts3_2_4c_a);
extern MACHINE_DRIVER_EXTERN(gts3_2_4c_b);
extern MACHINE_DRIVER_EXTERN(gts3_2_5c);
extern MACHINE_DRIVER_EXTERN(gts3_2a_4c_a);
extern MACHINE_DRIVER_EXTERN(gts3_2a_4c_b);
extern MACHINE_DRIVER_EXTERN(gts3_2a_5c);
extern MACHINE_DRIVER_EXTERN(gts3_21);
extern MACHINE_DRIVER_EXTERN(gts3_22);

#define mGTS3 gts3_1a
Expand All @@ -215,16 +210,11 @@ extern MACHINE_DRIVER_EXTERN(gts3_22);
#define mGTS3S80B3 gts3_1as80b3
#define mGTS3B gts3_1b
#define mGTS3BS gts3_1bs
#define mGTS3DMDS_4C_a gts3_2_4c_a
#define mGTS3DMDS_4C_b gts3_2_4c_b
#define mGTS3DMDS_5C gts3_2_5c
#define mGTS3DMDSA_4C_a gts3_2a_4c_a
#define mGTS3DMDSA_4C_b gts3_2a_4c_b
#define mGTS3DMDSA_5C gts3_2a_5c
#define mGTS3DMDS2 gts3_22 // uses 4_a color_mode
#define mGTS3DMDS gts3_21
#define mGTS3DMDS2 gts3_22

typedef struct {
int version;
int has2DMD;
UINT8 pa0; // bool
UINT8 pa1; // bool
UINT8 pa2; // bool
Expand All @@ -238,7 +228,6 @@ typedef struct {
UINT8 dstrb; // bool
UINT8 dmd_visible_addr;
UINT8 nextDMDFrame;
UINT8 color_mode; // 4_a, 4_b or 5 (=0,1,2)
} GTS3_DMDlocals;

typedef struct {
Expand Down
Loading
Loading