From 3abd0bfbe5581fe8ac57cf5fadb28c9ee9b9a837 Mon Sep 17 00:00:00 2001 From: angelosa Date: Fri, 20 Mar 2020 19:53:46 +0100 Subject: taito_z.cpp: fix enforceja analog inputs (always been broken, promoted to working status), add screen set_raw (pending move to the whole driver) --- src/mame/drivers/taito_z.cpp | 43 +++++++++++++++++++++----- src/mame/includes/taito_z.h | 5 +++ src/mame/layout/enforce.lay | 72 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 8 deletions(-) create mode 100644 src/mame/layout/enforce.lay diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp index f5bb2799d7c..f4bee499a1b 100644 --- a/src/mame/drivers/taito_z.cpp +++ b/src/mame/drivers/taito_z.cpp @@ -1282,6 +1282,7 @@ DIP switches are not verified #include "contcirc.lh" #include "dblaxle.lh" +#include "enforce.lh" void taitoz_state::parse_cpu_control() @@ -1404,6 +1405,13 @@ CUSTOM_INPUT_MEMBER(taitoz_state::brake_pedal_r) return retval[m_brake.read_safe(0) & 7]; } +// enforceja only, 3 bits applied on both pots +template CUSTOM_INPUT_MEMBER(taitoz_state::adstick_r) +{ + static const u8 retval[8] = { 0,1,3,2,6,7,5,4 }; + u8 raw_value = ((axis == 0 ? m_stickx : m_sticky).read_safe(0) >> 5) & 7; + return retval[raw_value]; +} u8 taitoz_state::contcirc_input_bypass_r() { @@ -2402,8 +2410,8 @@ static INPUT_PORTS_START( enforce ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_START("IN1") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) /* Bomb */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* Laser */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Gatling Gun") PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Laser") PORT_PLAYER(1) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -2425,6 +2433,19 @@ INPUT_PORTS_END static INPUT_PORTS_START( enforceja ) PORT_INCLUDE(enforce) + PORT_MODIFY("IN0") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(taitoz_state, adstick_r<0>); + + PORT_MODIFY("IN1") + PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(taitoz_state, adstick_r<1>); + + PORT_MODIFY("IN2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Shifter") PORT_TOGGLE PORT_PLAYER(1) + PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_MODIFY("DSWA") TAITO_COINAGE_JAPAN_OLD_LOC(SW A) @@ -2432,8 +2453,14 @@ static INPUT_PORTS_START( enforceja ) PORT_DIPNAME( 0x30, 0x30, "3D Effects" ) PORT_DIPLOCATION("SW B:5,6") PORT_DIPSETTING( 0x30, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPSETTING( 0x10, "In Game Only" ) PORT_DIPSETTING( 0x00, "In Game Only" ) + PORT_DIPSETTING( 0x10, "In Game Only (duplicate)" ) + + PORT_START("STICKX") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(20) PORT_KEYDELTA(4) PORT_PLAYER(1) + + PORT_START("STICKY") + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(20) PORT_KEYDELTA(4) PORT_PLAYER(1) INPUT_PORTS_END static INPUT_PORTS_START( bshark ) @@ -3294,10 +3321,10 @@ void taitoz_state::enforce(machine_config &config) /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); - screen.set_size(40*8, 32*8); - screen.set_visarea(0*8, 40*8-1, 2*8, 31*8-1); + // TODO: Apply to the whole driver + // 26.860 MHz comes from the video board, assume /4 pixel clock + // vertical visible area comes from service mode + screen.set_raw(XTAL(26'686'000)/4, 426, 0, 320, 261, 24, 248); screen.set_screen_update(FUNC(taitoz_state::screen_update_contcirc)); screen.set_palette(m_tc0110pcr); @@ -5559,7 +5586,7 @@ GAMEL(1988, chasehqu, chasehq, chasehq, chasehq, taitoz_state, empty_init GAME( 1988, enforce, 0, enforce, enforce, taitoz_state, empty_init, ROT0, "Taito Corporation Japan", "Enforce (World)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1988, enforcej, enforce, enforce, enforcej, taitoz_state, empty_init, ROT0, "Taito Corporation", "Enforce (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1988, enforceja, enforce, enforce, enforceja, taitoz_state, empty_init, ROT0, "Taito Corporation", "Enforce (Japan, Analog Controls)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAMEL( 1988, enforceja, enforce, enforce, enforceja, taitoz_state, empty_init, ROT0, "Taito Corporation", "Enforce (Japan, Analog Controls)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_enforce ) GAME( 1989, bshark, 0, bshark, bshark, taitoz_state, init_bshark, ORIENTATION_FLIP_X, "Taito Corporation Japan", "Battle Shark (World)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1989, bsharku, bshark, bshark, bsharku, taitoz_state, init_bshark, ORIENTATION_FLIP_X, "Taito America Corporation", "Battle Shark (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/taito_z.h b/src/mame/includes/taito_z.h index 488192463ff..27c16400ef6 100644 --- a/src/mame/includes/taito_z.h +++ b/src/mame/includes/taito_z.h @@ -46,12 +46,15 @@ public: m_gas(*this, "GAS"), m_brake(*this, "BRAKE"), m_steer(*this, "STEER"), + m_stickx(*this, "STICKX"), + m_sticky(*this, "STICKY"), m_io_eepromout(*this, "EEPROMOUT"), m_lamps(*this, "lamp%u", 0U) { } DECLARE_CUSTOM_INPUT_MEMBER(gas_pedal_r); DECLARE_CUSTOM_INPUT_MEMBER(brake_pedal_r); + template DECLARE_CUSTOM_INPUT_MEMBER(adstick_r); void bshark_base(machine_config &config); void sci(machine_config &config); @@ -114,6 +117,8 @@ private: optional_ioport m_gas; optional_ioport m_brake; optional_ioport m_steer; + optional_ioport m_stickx; + optional_ioport m_sticky; optional_ioport m_io_eepromout; output_finder<2> m_lamps; diff --git a/src/mame/layout/enforce.lay b/src/mame/layout/enforce.lay new file mode 100644 index 00000000000..e904b1691df --- /dev/null +++ b/src/mame/layout/enforce.lay @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3