From d5cee776d00f84a23824c75243960cc12c209f29 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 21 May 2017 15:40:43 -0400 Subject: forgottn: Add uPD4701A device (nw) --- src/devices/machine/upd4701.cpp | 20 ++++++++++ src/devices/machine/upd4701.h | 2 + src/mame/drivers/cps1.cpp | 82 +++++++++++++++++------------------------ src/mame/includes/cps1.h | 6 --- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/devices/machine/upd4701.cpp b/src/devices/machine/upd4701.cpp index d5a83cfd0dd..46129b3a92a 100644 --- a/src/devices/machine/upd4701.cpp +++ b/src/devices/machine/upd4701.cpp @@ -144,6 +144,26 @@ WRITE_LINE_MEMBER(upd4701_device::resety_w) } } +//------------------------------------------------- +// reset_x - pulse the X counter reset line +//------------------------------------------------- + +WRITE8_MEMBER(upd4701_device::reset_x) +{ + resetx_w(1); + resetx_w(0); +} + +//------------------------------------------------- +// reset_y - pulse the Y counter reset line +//------------------------------------------------- + +WRITE8_MEMBER(upd4701_device::reset_y) +{ + resety_w(1); + resety_w(0); +} + //------------------------------------------------- // reset_xy - pulse the counter reset lines //------------------------------------------------- diff --git a/src/devices/machine/upd4701.h b/src/devices/machine/upd4701.h index f182d92a839..ff254e8ab36 100644 --- a/src/devices/machine/upd4701.h +++ b/src/devices/machine/upd4701.h @@ -61,6 +61,8 @@ public: DECLARE_WRITE_LINE_MEMBER(ul_w); DECLARE_WRITE_LINE_MEMBER(resetx_w); DECLARE_WRITE_LINE_MEMBER(resety_w); + DECLARE_WRITE8_MEMBER(reset_x); + DECLARE_WRITE8_MEMBER(reset_y); DECLARE_READ8_MEMBER(reset_xy); DECLARE_WRITE8_MEMBER(reset_xy); diff --git a/src/mame/drivers/cps1.cpp b/src/mame/drivers/cps1.cpp index 490b6489f3c..a6a96002f63 100644 --- a/src/mame/drivers/cps1.cpp +++ b/src/mame/drivers/cps1.cpp @@ -244,6 +244,7 @@ Stephh's log (2006.09.20) : #include "cpu/pic16c5x/pic16c5x.h" #include "cpu/m68000/m68000.h" #include "machine/eepromser.h" +#include "machine/upd4701.h" #include "sound/ym2151.h" #include "sound/okim6295.h" #include "sound/qsound.h" @@ -284,26 +285,6 @@ READ16_MEMBER(cps_state::cps1_in3_r) return (in << 8) | in; } -READ16_MEMBER(cps_state::forgottn_dial_0_r) -{ - return ((ioport("DIAL0")->read() - m_dial[0]) >> (8 * offset)) & 0xff; -} - -READ16_MEMBER(cps_state::forgottn_dial_1_r) -{ - return ((ioport("DIAL1")->read() - m_dial[1]) >> (8 * offset)) & 0xff; -} - -WRITE16_MEMBER(cps_state::forgottn_dial_0_reset_w) -{ - m_dial[0] = ioport("DIAL0")->read(); -} - -WRITE16_MEMBER(cps_state::forgottn_dial_1_reset_w) -{ - m_dial[1] = ioport("DIAL1")->read(); -} - WRITE8_MEMBER(cps_state::cps1_snd_bankswitch_w) { @@ -551,7 +532,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, cps_state ) AM_RANGE(0x800018, 0x80001f) AM_READ(cps1_dsw_r) /* System input ports / Dip Switches */ AM_RANGE(0x800020, 0x800021) AM_READNOP /* ? Used by Rockman ? not mapped according to PAL */ AM_RANGE(0x800030, 0x800037) AM_WRITE(cps1_coinctrl_w) - /* Forgotten Worlds has dial controls on B-board mapped at 800040-80005f. See DRIVER_INIT */ + /* Forgotten Worlds has dial controls on B-board mapped at 800040-80005f. See below */ AM_RANGE(0x800100, 0x80013f) AM_WRITE(cps1_cps_a_w) AM_SHARE("cps_a_regs") /* CPS-A custom */ /* CPS-B custom is mapped by the PAL IOB2 on the B-board. SF2 revision "E" World and USA 910228 has it at a different address, see DRIVER_INIT */ @@ -562,6 +543,17 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, cps_state ) AM_RANGE(0xff0000, 0xffffff) AM_RAM AM_SHARE("mainram") ADDRESS_MAP_END +/* Forgotten Worlds has a NEC uPD4701AC on the B-board handling dial inputs from the CN-MOWS connector. */ +/* The memory mapping is handled by PAL LWIO */ + +static ADDRESS_MAP_START( forgottn_map, AS_PROGRAM, 16, cps_state ) + AM_RANGE(0x800040, 0x800041) AM_DEVWRITE8("upd4701", upd4701_device, reset_x, 0x00ff) + AM_RANGE(0x800048, 0x800049) AM_DEVWRITE8("upd4701", upd4701_device, reset_y, 0x00ff) + AM_RANGE(0x800052, 0x800055) AM_DEVREAD8("upd4701", upd4701_device, read_x, 0x00ff) + AM_RANGE(0x80005a, 0x80005d) AM_DEVREAD8("upd4701", upd4701_device, read_y, 0x00ff) + AM_IMPORT_FROM(main_map) +ADDRESS_MAP_END + /* PAL SOU1 (16P8 @ 13E): @@ -912,10 +904,10 @@ static INPUT_PORTS_START( forgottn ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DIAL0") - PORT_BIT( 0x0fff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1) + PORT_BIT( 0x0fff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1) PORT_START("DIAL1") - PORT_BIT( 0x0fff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) + PORT_BIT( 0x0fff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_RESET PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) INPUT_PORTS_END static INPUT_PORTS_START( ghouls ) @@ -3338,6 +3330,15 @@ static MACHINE_CONFIG_START( cps1_10MHz ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( forgottn, cps1_10MHz ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(forgottn_map) + + MCFG_DEVICE_ADD("upd4701", UPD4701A, 0) + MCFG_UPD4701_PORTX("DIAL0") + MCFG_UPD4701_PORTY("DIAL1") +MACHINE_CONFIG_END + MACHINE_CONFIG_DERIVED( cps1_12MHz, cps1_10MHz ) /* basic machine hardware */ @@ -12086,23 +12087,6 @@ ROM_START( sfzbch ) ROM_END -DRIVER_INIT_MEMBER(cps_state,forgottn) -{ - /* Forgotten Worlds has a NEC uPD4701AC on the B-board handling dial inputs from the CN-MOWS connector. */ - /* The memory mapping is handled by PAL LWIO */ - m_maincpu->space(AS_PROGRAM).install_write_handler(0x800040, 0x800041, write16_delegate(FUNC(cps_state::forgottn_dial_0_reset_w),this)); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x800048, 0x800049, write16_delegate(FUNC(cps_state::forgottn_dial_1_reset_w),this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x800052, 0x800055, read16_delegate(FUNC(cps_state::forgottn_dial_0_r),this)); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x80005a, 0x80005d, read16_delegate(FUNC(cps_state::forgottn_dial_1_r),this)); - - save_item(NAME(m_dial)); - - m_dial[0] = 0; - m_dial[1] = 0; - - DRIVER_INIT_CALL(cps1); -} - READ16_MEMBER(cps_state::sf2rb_prot_r) { switch (offset) @@ -12357,15 +12341,15 @@ WRITE16_MEMBER( cps_state::sf2m3_layer_w ) /*************************************************** Game Macros *****************************************************/ -GAME( 1988, forgottn, 0, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Forgotten Worlds (World, newer)", MACHINE_SUPPORTS_SAVE ) // (c) Capcom U.S.A. but World "warning" -GAME( 1988, forgottna, forgottn, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Forgotten Worlds (World)", MACHINE_SUPPORTS_SAVE ) // (c) Capcom U.S.A. but World "warning" -GAME( 1988, forgottnu, forgottn, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88621B-2, Rev. C)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, forgottnue, forgottn, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88618B-2, Rev. E)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, forgottnuc, forgottn, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88618B-2, Rev. C)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, forgottnua, forgottn, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88618B-2, Rev. A)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, forgottnuaa, forgottn, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88618B-2, Rev. AA)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, lostwrld, forgottn, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Lost Worlds (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1988, lostwrldo, forgottn, cps1_10MHz, forgottn, cps_state, forgottn, ROT0, "Capcom", "Lost Worlds (Japan Old Ver.)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, forgottn, 0, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Forgotten Worlds (World, newer)", MACHINE_SUPPORTS_SAVE ) // (c) Capcom U.S.A. but World "warning" +GAME( 1988, forgottna, forgottn, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Forgotten Worlds (World)", MACHINE_SUPPORTS_SAVE ) // (c) Capcom U.S.A. but World "warning" +GAME( 1988, forgottnu, forgottn, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88621B-2, Rev. C)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, forgottnue, forgottn, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88618B-2, Rev. E)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, forgottnuc, forgottn, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88618B-2, Rev. C)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, forgottnua, forgottn, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88618B-2, Rev. A)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, forgottnuaa, forgottn, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Forgotten Worlds (USA, B-Board 88618B-2, Rev. AA)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, lostwrld, forgottn, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Lost Worlds (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1988, lostwrldo, forgottn, forgottn, forgottn, cps_state, cps1, ROT0, "Capcom", "Lost Worlds (Japan Old Ver.)", MACHINE_SUPPORTS_SAVE ) GAME( 1988, ghouls, 0, cps1_10MHz, ghouls, cps_state, cps1, ROT0, "Capcom", "Ghouls'n Ghosts (World)", MACHINE_SUPPORTS_SAVE ) // "EXPORT" // Wed.26.10.1988 in the ROMs GAME( 1988, ghoulsu, ghouls, cps1_10MHz, ghoulsu, cps_state, cps1, ROT0, "Capcom", "Ghouls'n Ghosts (USA)", MACHINE_SUPPORTS_SAVE ) // "EXPORT" // Wed.26.10.1988 in the ROMs GAME( 1988, daimakai, ghouls, cps1_10MHz, daimakai, cps_state, cps1, ROT0, "Capcom", "Daimakaimura (Japan)", MACHINE_SUPPORTS_SAVE ) // Wed.26.10.1988 in the ROMs diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index 9ab83bf145f..dab35fff9a5 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -184,7 +184,6 @@ public: int m_objram_bank; /* misc */ - int m_dial[2]; // forgottn int m_readpaddle; // pzloop2 int m_cps2networkpresent; int m_cps2digitalvolumelevel; @@ -247,10 +246,6 @@ public: DECLARE_READ16_MEMBER(cps1_in1_r); DECLARE_READ16_MEMBER(cps1_in2_r); DECLARE_READ16_MEMBER(cps1_in3_r); - DECLARE_READ16_MEMBER(forgottn_dial_0_r); - DECLARE_READ16_MEMBER(forgottn_dial_1_r); - DECLARE_WRITE16_MEMBER(forgottn_dial_0_reset_w); - DECLARE_WRITE16_MEMBER(forgottn_dial_1_reset_w); DECLARE_WRITE8_MEMBER(cps1_snd_bankswitch_w); DECLARE_WRITE16_MEMBER(cps1_soundlatch_w); DECLARE_WRITE16_MEMBER(cps1_soundlatch2_w); @@ -287,7 +282,6 @@ public: DECLARE_DRIVER_INIT(sf2rb2); DECLARE_DRIVER_INIT(sf2thndr); DECLARE_DRIVER_INIT(dinohunt); - DECLARE_DRIVER_INIT(forgottn); DECLARE_DRIVER_INIT(sf2hack); DECLARE_DRIVER_INIT(slammast); DECLARE_DRIVER_INIT(pang3b); -- cgit v1.2.3