diff --git a/src/mame/drivers/ggconnie.c b/src/mame/drivers/ggconnie.c index 6fedf5d4265..a1037b0b2fc 100644 --- a/src/mame/drivers/ggconnie.c +++ b/src/mame/drivers/ggconnie.c @@ -23,15 +23,14 @@ #include "sound/c6280.h" -class ggconnie_state : public driver_device +class ggconnie_state : public pce_common_state { public: ggconnie_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : pce_common_state(mconfig, type, tag) { } DECLARE_WRITE8_MEMBER(lamp_w); - DECLARE_WRITE8_MEMBER(output_w); - DECLARE_DRIVER_INIT(ggconnie); + DECLARE_WRITE8_MEMBER(output_w); }; @@ -193,9 +192,4 @@ ROM_START(ggconnie) ROM_LOAD( "adpcm_u31.bin", 0x0000, 0x80000, CRC(de514c2b) SHA1(da73aa825d73646f556f6d4dbb46f43acf7c3357) ) ROM_END -DRIVER_INIT_MEMBER(ggconnie_state,ggconnie) -{ - init_pce(); -} - -GAME( 1996, ggconnie, 0, ggconnie, ggconnie, ggconnie_state, ggconnie, ROT0, "Eighting", "Go! Go! Connie chan Jaka Jaka Janken", GAME_NO_SOUND | GAME_NOT_WORKING ) +GAME( 1996, ggconnie, 0, ggconnie, ggconnie, pce_common_state, pce_common, ROT0, "Eighting", "Go! Go! Connie chan Jaka Jaka Janken", GAME_NO_SOUND | GAME_NOT_WORKING ) diff --git a/src/mame/drivers/paranoia.c b/src/mame/drivers/paranoia.c index 0219ed940a6..012e4208a52 100644 --- a/src/mame/drivers/paranoia.c +++ b/src/mame/drivers/paranoia.c @@ -43,11 +43,11 @@ HuC6280A (Hudson) #include "sound/c6280.h" -class paranoia_state : public driver_device +class paranoia_state : public pce_common_state { public: paranoia_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : pce_common_state(mconfig, type, tag) { } DECLARE_WRITE8_MEMBER(paranoia_8085_d000_w); DECLARE_READ8_MEMBER(paranoia_z80_io_01_r); @@ -58,7 +58,6 @@ public: DECLARE_WRITE8_MEMBER(paranoia_i8155_b_w); DECLARE_WRITE8_MEMBER(paranoia_i8155_c_w); DECLARE_WRITE_LINE_MEMBER(paranoia_i8155_timer_out); - DECLARE_DRIVER_INIT(paranoia); }; @@ -81,7 +80,7 @@ static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8, paranoia_state ) AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE_LEGACY(vce_r, vce_w ) AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE_LEGACY("c6280", c6280_r, c6280_w ) AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE_LEGACY(h6280_timer_r, h6280_timer_w ) - AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE_LEGACY(pce_joystick_r, pce_joystick_w ) + AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE(pce_joystick_r, pce_joystick_w ) AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE_LEGACY(h6280_irq_status_r, h6280_irq_status_w ) ADDRESS_MAP_END @@ -228,9 +227,4 @@ ROM_START(paranoia) ROM_LOAD( "4.352", 0x18000, 0x8000, CRC(11297fed) SHA1(17a294e65ba1c4806307602dee4c7c627ad1fcfd) ) ROM_END -DRIVER_INIT_MEMBER(paranoia_state,paranoia) -{ - init_pce(); -} - -GAME( 1990, paranoia, 0, paranoia, paranoia, paranoia_state, paranoia, ROT0, "Naxat Soft", "Paranoia", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 1990, paranoia, 0, paranoia, paranoia, pce_common_state, pce_common, ROT0, "Naxat Soft", "Paranoia", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) diff --git a/src/mame/drivers/tourvis.c b/src/mame/drivers/tourvis.c index 18af78b6107..112e3666ba2 100644 --- a/src/mame/drivers/tourvis.c +++ b/src/mame/drivers/tourvis.c @@ -187,18 +187,17 @@ I can't tell ATM if units are seconds (even if values in tables seem very relate #include "machine/i8155.h" -class tourvision_state : public driver_device +class tourvision_state : public pce_common_state { public: tourvision_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : pce_common_state(mconfig, type, tag) { } DECLARE_WRITE8_MEMBER(tourvision_8085_d000_w); DECLARE_WRITE8_MEMBER(tourvision_i8155_a_w); DECLARE_WRITE8_MEMBER(tourvision_i8155_b_w); DECLARE_WRITE8_MEMBER(tourvision_i8155_c_w); DECLARE_WRITE_LINE_MEMBER(tourvision_timer_out); - DECLARE_DRIVER_INIT(tourvision); }; @@ -285,7 +284,7 @@ static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8, tourvision_state ) AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE_LEGACY(vce_r, vce_w ) AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE_LEGACY("c6280", c6280_r, c6280_w ) AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE_LEGACY(h6280_timer_r, h6280_timer_w ) - AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE_LEGACY(pce_joystick_r, pce_joystick_w ) + AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE(pce_joystick_r, pce_joystick_w ) AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE_LEGACY(h6280_irq_status_r, h6280_irq_status_w ) ADDRESS_MAP_END @@ -513,18 +512,12 @@ ROM_START(tvsvball) TOURVISION_BIOS ROM_END - -DRIVER_INIT_MEMBER(tourvision_state,tourvision) -{ - init_pce(); -} - -GAME( 19??, tourvis, 0, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision)", "Tourvision PCE bootleg", GAME_IS_BIOS_ROOT | GAME_NOT_WORKING ) -GAME( 1988, tvlegaxe, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Makyo Densetsu - The Legenary Axe (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) -GAME( 1989, tvusapb, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Aicom", "USA Pro Basketball (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) -GAME( 1989, tvdunexp, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Hudson / Atlus", "Dungeon Explorer (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) -GAME( 1990, tvthbld, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Sega / NEC Avenue", "Thunder Blade (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) -GAME( 1990, tvrs2, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Taito", "Rastan Saga II (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) -GAME( 1990, tvsvball, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Video System", "Super Volley ball (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) -GAME( 1991, tvpwlg4, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Hudson", "Power League IV (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) -GAME( 1991, tvsci, tourvis, tourvision, tourvision, tourvision_state, tourvision, ROT0, "bootleg (Tourvision) / Taito", "Special Criminal Investigation (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 19??, tourvis, 0, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision)", "Tourvision PCE bootleg", GAME_IS_BIOS_ROOT | GAME_NOT_WORKING ) +GAME( 1988, tvlegaxe, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Victor Musical Industries, Inc.", "Makyo Densetsu - The Legenary Axe (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 1989, tvusapb, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Aicom", "USA Pro Basketball (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 1989, tvdunexp, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson / Atlus", "Dungeon Explorer (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 1990, tvthbld, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Sega / NEC Avenue", "Thunder Blade (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 1990, tvrs2, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Taito", "Rastan Saga II (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 1990, tvsvball, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Video System", "Super Volley ball (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 1991, tvpwlg4, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Hudson", "Power League IV (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) +GAME( 1991, tvsci, tourvis, tourvision, tourvision, pce_common_state, pce_common, ROT0, "bootleg (Tourvision) / Taito", "Special Criminal Investigation (Tourvision PCE bootleg)", GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) diff --git a/src/mame/drivers/uapce.c b/src/mame/drivers/uapce.c index 50543630e53..035e43a3172 100644 --- a/src/mame/drivers/uapce.c +++ b/src/mame/drivers/uapce.c @@ -99,17 +99,17 @@ Alien Crush & Pac_Land: dumps made from PC-Engine dumps of JP versions #include "sound/discrete.h" -class uapce_state : public driver_device +class uapce_state : public pce_common_state { public: uapce_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : pce_common_state(mconfig, type, tag) { } UINT8 m_jamma_if_control_latch; DECLARE_WRITE8_MEMBER(jamma_if_control_latch_w); DECLARE_READ8_MEMBER(jamma_if_control_latch_r); DECLARE_READ8_MEMBER(jamma_if_read_dsw); - DECLARE_DRIVER_INIT(uapce); + virtual UINT8 joy_read(); virtual void machine_reset(); }; @@ -213,22 +213,20 @@ READ8_MEMBER(uapce_state::jamma_if_read_dsw) return dsw_val & 1; } -static UINT8 jamma_if_read_joystick( running_machine &machine ) +UINT8 uapce_state::joy_read() { - uapce_state *state = machine.driver_data(); - if ( state->m_jamma_if_control_latch & 0x10 ) + if ( m_jamma_if_control_latch & 0x10 ) { - return state->ioport("JOY" )->read(); + return ioport("JOY" )->read(); } else { - return machine.root_device().ioport("JOY" )->read() | 0x08; + return machine().root_device().ioport("JOY" )->read() | 0x08; } } void uapce_state::machine_reset() { - pce_set_joystick_readinputport_callback( jamma_if_read_joystick ); m_jamma_if_control_latch = 0; } @@ -290,7 +288,7 @@ static ADDRESS_MAP_START( pce_mem , AS_PROGRAM, 8, uapce_state ) AM_RANGE( 0x1FE400, 0x1FE7FF) AM_READWRITE_LEGACY(vce_r, vce_w ) AM_RANGE( 0x1FE800, 0x1FEBFF) AM_DEVREADWRITE_LEGACY("c6280", c6280_r, c6280_w ) AM_RANGE( 0x1FEC00, 0x1FEFFF) AM_READWRITE_LEGACY(h6280_timer_r, h6280_timer_w ) - AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE_LEGACY(pce_joystick_r, pce_joystick_w ) + AM_RANGE( 0x1FF000, 0x1FF3FF) AM_READWRITE(pce_joystick_r, pce_joystick_w ) AM_RANGE( 0x1FF400, 0x1FF7FF) AM_READWRITE_LEGACY(h6280_irq_status_r, h6280_irq_status_w ) ADDRESS_MAP_END @@ -374,12 +372,7 @@ ROM_START(paclandp) ROM_LOAD( "u1.bin", 0x0000, 0x800, CRC(f5e538a9) SHA1(19ac9525c9ad6bea1789cc9e63cdb7fe949867d9) ) ROM_END -DRIVER_INIT_MEMBER(uapce_state,uapce) -{ - init_pce(); -} - -GAME( 1989, blazlaz, 0, uapce, uapce, uapce_state, uapce, ROT0, "Hudson Soft", "Blazing Lazers", GAME_IMPERFECT_SOUND ) -GAME( 1989, keith, 0, uapce, uapce, uapce_state, uapce, ROT0, "Hudson Soft", "Keith Courage In Alpha Zones", GAME_IMPERFECT_SOUND ) -GAME( 1989, aliencr, 0, uapce, uapce, uapce_state, uapce, ROT0, "Hudson Soft", "Alien Crush", GAME_IMPERFECT_SOUND ) -GAME( 1989, paclandp,0, uapce, uapce, uapce_state, uapce, ROT0, "Namco", "Pac-Land (United Amusements PC Engine)", GAME_IMPERFECT_SOUND ) +GAME( 1989, blazlaz, 0, uapce, uapce, pce_common_state, pce_common, ROT0, "Hudson Soft", "Blazing Lazers", GAME_IMPERFECT_SOUND ) +GAME( 1989, keith, 0, uapce, uapce, pce_common_state, pce_common, ROT0, "Hudson Soft", "Keith Courage In Alpha Zones", GAME_IMPERFECT_SOUND ) +GAME( 1989, aliencr, 0, uapce, uapce, pce_common_state, pce_common, ROT0, "Hudson Soft", "Alien Crush", GAME_IMPERFECT_SOUND ) +GAME( 1989, paclandp,0, uapce, uapce, pce_common_state, pce_common, ROT0, "Namco", "Pac-Land (United Amusements PC Engine)", GAME_IMPERFECT_SOUND ) diff --git a/src/mame/machine/pcecommn.c b/src/mame/machine/pcecommn.c index 93c1479f6a6..d23b47e6f0e 100644 --- a/src/mame/machine/pcecommn.c +++ b/src/mame/machine/pcecommn.c @@ -4,68 +4,57 @@ #include "video/vdc.h" #include "cpu/h6280/h6280.h" -/* system RAM */ -struct pce_struct pce; +#define TG_16_JOY_SIG 0x00 +#define PCE_JOY_SIG 0x40 +#define NO_CD_SIG 0x80 +#define CD_SIG 0x00 +/* these might be used to indicate something, but they always seem to return 1 */ +#define CONST_SIG 0x30 /* joystick related data*/ - #define JOY_CLOCK 0x01 #define JOY_RESET 0x02 -static int joystick_port_select; /* internal index of joystick ports */ -static int joystick_data_select; /* which nibble of joystick data we want */ - -static UINT8 (*pce_joystick_readinputport_callback)(running_machine &) = NULL; - -void init_pce() { - pce.io_port_options = PCE_JOY_SIG | CONST_SIG; -} - -MACHINE_RESET( pce ) { -} /* todo: how many input ports does the PCE have? */ -WRITE8_HANDLER ( pce_joystick_w ) +WRITE8_MEMBER(pce_common_state::pce_joystick_w) { h6280io_set_buffer(&space.device(), data); /* bump counter on a low-to-high transition of bit 1 */ - if((!joystick_data_select) && (data & JOY_CLOCK)) + if((!m_joystick_data_select) && (data & JOY_CLOCK)) { - joystick_port_select = (joystick_port_select + 1) & 0x07; + m_joystick_port_select = (m_joystick_port_select + 1) & 0x07; } /* do we want buttons or direction? */ - joystick_data_select = data & JOY_CLOCK; + m_joystick_data_select = data & JOY_CLOCK; /* clear counter if bit 2 is set */ if(data & JOY_RESET) { - joystick_port_select = 0; + m_joystick_port_select = 0; } } -READ8_HANDLER ( pce_joystick_r ) +UINT8 pce_common_state::joy_read() +{ + return machine().root_device().ioport("JOY")->read(); +} + +READ8_MEMBER(pce_common_state::pce_joystick_r) { UINT8 ret; - int data; - - if ( pce_joystick_readinputport_callback != NULL ) - { - data = pce_joystick_readinputport_callback(space.machine()); - } - else - { - data = space.machine().root_device().ioport("JOY")->read(); - } - if(joystick_data_select) data >>= 4; - ret = (data & 0x0F) | pce.io_port_options; + int data = joy_read(); + if (m_joystick_data_select) data >>= 4; + ret = (data & 0x0F) | m_io_port_options; #ifdef UNIFIED_PCE ret &= ~0x40; #endif return (ret); } -void pce_set_joystick_readinputport_callback( UINT8 (*joy_read)(running_machine &)) +DRIVER_INIT_MEMBER(pce_common_state,pce_common) { - pce_joystick_readinputport_callback = joy_read; + m_io_port_options = PCE_JOY_SIG | CONST_SIG; } + diff --git a/src/mame/machine/pcecommn.h b/src/mame/machine/pcecommn.h index bec9ca39e97..aa4a2cc1289 100644 --- a/src/mame/machine/pcecommn.h +++ b/src/mame/machine/pcecommn.h @@ -11,23 +11,21 @@ #define PCE_MAIN_CLOCK 21477270 -DECLARE_WRITE8_HANDLER ( pce_joystick_w ); - DECLARE_READ8_HANDLER ( pce_joystick_r ); - -#define TG_16_JOY_SIG 0x00 -#define PCE_JOY_SIG 0x40 -#define NO_CD_SIG 0x80 -#define CD_SIG 0x00 -/* these might be used to indicate something, but they always seem to return 1 */ -#define CONST_SIG 0x30 - -struct pce_struct +class pce_common_state : public driver_device { - UINT8 io_port_options; /*driver-specific options for the PCE*/ -}; -extern struct pce_struct pce; -void init_pce(); -MACHINE_RESET( pce ); +public: + pce_common_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) { } -void pce_set_joystick_readinputport_callback( UINT8 (*joy_read)(running_machine &)); + DECLARE_WRITE8_MEMBER(pce_joystick_w); + DECLARE_READ8_MEMBER(pce_joystick_r); + + DECLARE_DRIVER_INIT(pce_common); + + virtual UINT8 joy_read(); +private: + UINT8 m_io_port_options; /*driver-specific options for the PCE*/ + int m_joystick_port_select; /* internal index of joystick ports */ + int m_joystick_data_select; /* which nibble of joystick data we want */ +}; #endif diff --git a/src/mess/drivers/x1twin.c b/src/mess/drivers/x1twin.c index 1e1d5cd25c0..0be88977a9b 100644 --- a/src/mess/drivers/x1twin.c +++ b/src/mess/drivers/x1twin.c @@ -18,7 +18,6 @@ #include "video/vdc.h" //#include "cpu/h6280/h6280.h" //#include "sound/c6280.h" -#include "machine/pcecommn.h" #include "rendlay.h" @@ -37,6 +36,7 @@ class x1twin_state : public x1_state #define X1_MAIN_CLOCK XTAL_16MHz #define VDP_CLOCK XTAL_42_9545MHz #define MCU_CLOCK XTAL_6MHz +#define PCE_MAIN_CLOCK VDP_CLOCK / 2 UINT32 x1twin_state::screen_update_x1pce(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) {