summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author MetalliC <0vetal0@gmail.com>2017-05-17 07:26:41 +0300
committer MetalliC <0vetal0@gmail.com>2017-05-17 07:26:41 +0300
commit5d2dae3db6030a0162ba74947393fa53a4850d2f (patch)
tree970502cfb1e3913c0c50b62feddeca36126ee7a9
parentdf507ea2a57300f458f52d9bd857b2b30745c586 (diff)
stv.cpp: patocar - hook hopper and trackball (not used by default), seems playable (nw)
-rw-r--r--src/mame/drivers/stv.cpp84
-rw-r--r--src/mame/includes/saturn.h2
-rw-r--r--src/mame/includes/stv.h8
3 files changed, 86 insertions, 8 deletions
diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp
index 10a036d7aa0..f64f906b4a5 100644
--- a/src/mame/drivers/stv.cpp
+++ b/src/mame/drivers/stv.cpp
@@ -97,6 +97,8 @@ offsets:
READ8_MEMBER(stv_state::stv_ioga_r)
{
+ const char *const portg[] = { "PORTG.0", "PORTG.1", "PORTG.2", "PORTG.3" };
+
uint8_t res;
res = 0xff;
@@ -113,8 +115,14 @@ READ8_MEMBER(stv_state::stv_ioga_r)
case 0x07: res = m_system_output; break; // port D, read-backs value written
case 0x09: res = ioport("PORTE")->read(); break; // P3
case 0x0b: res = ioport("PORTF")->read(); break; // P4
- case 0x0d: res = 0; break; // PORT-G
+ case 0x0d:
+ if (m_ioga_mode & 0x80)
+ res = (ioport(portg[(m_ioga_portg >> 1) & 3])->read()) >> (((m_ioga_portg & 1) ^ 1) * 8); // PORT-G counter mode
+ else
+ res = ioport("PORTG")->read();
+ break;
case 0x1b: res = 0; break; // Serial COM READ status
+ case 0x1d: res = m_ioga_mode; break;
}
return res;
@@ -131,7 +139,7 @@ WRITE8_MEMBER(stv_state::stv_ioga_w)
{
case 0x07:
// if (data != m_system_output)
-// printf("OUT %02x\n", data);
+// logerror("OUT %02x\n", data);
m_system_output = data;
/*Why does the BIOS tests these as ACTIVE HIGH? A program bug?*/
machine().bookkeeping().coin_counter_w(0,~data & 0x01);
@@ -139,6 +147,12 @@ WRITE8_MEMBER(stv_state::stv_ioga_w)
machine().bookkeeping().coin_lockout_w(0,~data & 0x04);
machine().bookkeeping().coin_lockout_w(1,~data & 0x08);
break;
+ case 0x0d:
+ m_ioga_portg = data;
+ break;
+ case 0x1d:
+ m_ioga_mode = data;
+ break;
}
}
@@ -240,6 +254,19 @@ WRITE8_MEMBER(stv_state::stvmp_ioga_w)
}
}
+WRITE8_MEMBER(stv_state::hop_ioga_w)
+{
+ if (offset == 7) {
+ if ((data & 0x80) == 0) {
+ m_hopper->motor_w(0); //
+ m_hopper->motor_w(0x80); // ugly hack to reset status of ticket dispenser device
+ m_hopper->motor_w(0);
+ } else
+ m_hopper->motor_w(0x80);
+ }
+ stv_ioga_w(space, offset, data);
+}
+
/* remaps with a 8-bit handler because MAME can't install r/w handlers with a different bus parallelism than the CPU native one, shrug ... */
READ32_MEMBER(stv_state::stv_ioga_r32)
{
@@ -345,6 +372,19 @@ WRITE32_MEMBER(stv_state::magzun_ioga_w32)
printf("Warning: IOGA writes to odd offset %02x (%08x) -> %08x!",offset*4,mem_mask,data);
}
+WRITE32_MEMBER(stv_state::hop_ioga_w32)
+{
+ if(ACCESSING_BITS_16_23)
+ hop_ioga_w(space,offset*4+1,data >> 16);
+ if(ACCESSING_BITS_0_7)
+ hop_ioga_w(space,offset*4+3,data);
+ if(ACCESSING_BITS_8_15 || ACCESSING_BITS_24_31)
+ if(!(ACCESSING_BITS_16_23 || ACCESSING_BITS_0_7))
+ printf("Warning: IOGA writes to odd offset %02x (%08x) -> %08x!",offset*4,mem_mask,data);
+
+ return;
+}
+
/*
06013AE8: MOV.L @($D4,PC),R5
@@ -935,6 +975,13 @@ DRIVER_INIT_MEMBER(stv_state,nameclv3)
DRIVER_INIT_CALL(stv);
}
+DRIVER_INIT_MEMBER(stv_state, hopper)
+{
+ DRIVER_INIT_CALL(stv);
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(stv_state::stv_ioga_r32),this), write32_delegate(FUNC(stv_state::hop_ioga_w32),this));
+ m_slave->space(AS_PROGRAM).install_readwrite_handler(0x00400000, 0x0040003f, read32_delegate(FUNC(stv_state::stv_ioga_r32),this), write32_delegate(FUNC(stv_state::hop_ioga_w32),this));
+}
+
static ADDRESS_MAP_START( stv_mem, AS_PROGRAM, 32, stv_state )
AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_SHARE("share6") // bios
AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE8(stv_SMPC_r, stv_SMPC_w,0xffffffff)
@@ -1093,6 +1140,9 @@ static MACHINE_CONFIG_DERIVED( stv_slot, stv )
MCFG_FRAGMENT_ADD( stv_cartslot )
MACHINE_CONFIG_END
+static MACHINE_CONFIG_DERIVED( hopper, stv )
+ MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(100), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH)
+MACHINE_CONFIG_END
MACHINE_RESET_MEMBER(stv_state,stv)
{
@@ -1292,6 +1342,18 @@ static INPUT_PORTS_START( stv )
PORT_START("PORTF")
STV_PLAYER_INPUTS(4, BUTTON1, BUTTON2, BUTTON3, START)
+
+ PORT_START("PORTG")
+ PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_START("PORTG.0")
+ PORT_BIT( 0x0000, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_START("PORTG.1")
+ PORT_BIT( 0x0000, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_START("PORTG.2")
+ PORT_BIT( 0x0000, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_START("PORTG.3")
+ PORT_BIT( 0x0000, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
static INPUT_PORTS_START( stv6b )
@@ -1638,18 +1700,26 @@ static INPUT_PORTS_START( patocar )
PORT_INCLUDE( stv )
PORT_MODIFY("PORTA")
- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) // hopper ?
- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) // hopper ?
+ PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) // hopper ?
+ PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("hopper", ticket_dispenser_device, line_r)
PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_MODIFY("PORTB")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) // ??
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON4 ) // Door switch ?
- PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_BUTTON5 )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 ) // Medal
+ PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_BUTTON5 ) // ??
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_NAME("Medal")
PORT_BIT( 0xd0, IP_ACTIVE_LOW, IPT_UNUSED )
+ // TODO: sense/delta values seems wrong
+ PORT_MODIFY("PORTG.0")
+ PORT_BIT( 0xffff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_RESET PORT_PLAYER(1)
+ PORT_MODIFY("PORTG.1")
+ PORT_BIT( 0xffff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_RESET PORT_REVERSE PORT_PLAYER(1)
+
PORT_MODIFY("PORTC")
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Select Button")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Power Button")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
@@ -3501,7 +3571,7 @@ GAME( 1997, maruchan, stvbios, stv, stv, stv_state, maruchan, ROT
GAME( 1996, mausuke, stvbios, stv, stv, stv_state, mausuke, ROT0, "Data East", "Mausuke no Ojama the World (J 960314 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1998, myfairld, stvbios, stv, myfairld, stv_state, stvmp, ROT0, "Micronet", "Virtual Mahjong 2 - My Fair Lady (J 980608 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1998, othellos, stvbios, stv, stv, stv_state, othellos, ROT0, "Success", "Othello Shiyouyo (J 980423 V1.002)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
-GAME( 1999, patocar, stvbios, stv, patocar, stv_state, stv, ROT0, "Sega", "Hashire Patrol Car (J 990326 V1.000)", MACHINE_NOT_WORKING )
+GAME( 1999, patocar, stvbios, hopper, patocar, stv_state, hopper, ROT0, "Sega", "Hashire Patrol Car (J 990326 V1.000)", MACHINE_NOT_WORKING )
GAME( 1995, pblbeach, stvbios, stv, stv, stv_state, pblbeach, ROT0, "T&E Soft", "Pebble Beach - The Great Shot (JUE 950913 V0.990)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1996, prikura, stvbios, stv, stv, stv_state, prikura, ROT0, "Atlus", "Princess Clara Daisakusen (J 960910 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
GAME( 1996, puyosun, stvbios, stv, stv, stv_state, puyosun, ROT0, "Compile", "Puyo Puyo Sun (J 961115 V0.001)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS )
diff --git a/src/mame/includes/saturn.h b/src/mame/includes/saturn.h
index bb8ebf478e5..b0d96a5fed2 100644
--- a/src/mame/includes/saturn.h
+++ b/src/mame/includes/saturn.h
@@ -161,6 +161,8 @@ public:
emu_timer *m_stv_rtc_timer;
uint8_t m_port_sel,m_mux_data;
uint8_t m_system_output;
+ uint8_t m_ioga_mode;
+ uint8_t m_ioga_portg;
uint16_t m_serial_tx;
required_device<sh2_device> m_maincpu;
diff --git a/src/mame/includes/stv.h b/src/mame/includes/stv.h
index 96525ff87b8..7a45f717aee 100644
--- a/src/mame/includes/stv.h
+++ b/src/mame/includes/stv.h
@@ -3,6 +3,7 @@
#include "includes/saturn.h"
#include "audio/rax.h"
+#include "machine/ticket.h"
class stv_state : public saturn_state
{
@@ -11,7 +12,8 @@ public:
: saturn_state(mconfig, type, tag),
m_rax(*this, "rax"),
m_cryptdevice(*this, "315_5881"),
- m_5838crypt(*this, "315_5838")
+ m_5838crypt(*this, "315_5838"),
+ m_hopper(*this, "hopper")
{
}
@@ -60,6 +62,7 @@ public:
DECLARE_DRIVER_INIT(znpwfv);
DECLARE_DRIVER_INIT(othellos);
DECLARE_DRIVER_INIT(mausuke);
+ DECLARE_DRIVER_INIT(hopper);
DECLARE_READ8_MEMBER(stv_ioga_r);
DECLARE_WRITE8_MEMBER(stv_ioga_w);
@@ -77,6 +80,8 @@ public:
DECLARE_WRITE32_MEMBER(magzun_ioga_w32);
DECLARE_READ32_MEMBER(magzun_hef_hack_r);
DECLARE_READ32_MEMBER(magzun_rx_hack_r);
+ DECLARE_WRITE8_MEMBER(hop_ioga_w);
+ DECLARE_WRITE32_MEMBER(hop_ioga_w32);
image_init_result load_cart(device_image_interface &image, generic_slot_device *slot);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( stv_cart1 ) { return load_cart(image, m_cart1); }
@@ -107,6 +112,7 @@ public:
optional_device<sega_315_5881_crypt_device> m_cryptdevice;
optional_device<sega_315_5838_comp_device> m_5838crypt;
+ optional_device<ticket_dispenser_device> m_hopper;
uint16_t crypt_read_callback(uint32_t addr);
uint16_t crypt_read_callback_ch1(uint32_t addr);
uint16_t crypt_read_callback_ch2(uint32_t addr);