summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/cps1.cpp
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-05-21 15:40:43 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-05-21 15:40:43 -0400
commitd5cee776d00f84a23824c75243960cc12c209f29 (patch)
treeb85d35e7dba2cbcf8989a1da2fcffdc7bcd3d945 /src/mame/drivers/cps1.cpp
parent17bd0ab30627bf1967b5ac82bb91b54d4e2f652e (diff)
forgottn: Add uPD4701A device (nw)
Diffstat (limited to 'src/mame/drivers/cps1.cpp')
-rw-r--r--src/mame/drivers/cps1.cpp82
1 files changed, 33 insertions, 49 deletions
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