mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
segajw.cpp: Use 315-5296 for I/O
This commit is contained in:
parent
7330bd8ed9
commit
ab7d37c050
@ -32,6 +32,7 @@ Also seem to be running on the same/similar hardware:
|
||||
#include "cpu/z80/z80.h"
|
||||
#include "machine/gen_latch.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "machine/315_5296.h"
|
||||
#include "sound/2612intf.h"
|
||||
#include "video/hd63484.h"
|
||||
#include "video/ramdac.h"
|
||||
@ -50,14 +51,12 @@ public:
|
||||
m_soundlatch(*this, "soundlatch")
|
||||
{ }
|
||||
|
||||
DECLARE_READ16_MEMBER(coin_counter_r);
|
||||
DECLARE_WRITE16_MEMBER(coin_counter_w);
|
||||
DECLARE_READ16_MEMBER(hopper_r);
|
||||
DECLARE_WRITE16_MEMBER(hopper_w);
|
||||
DECLARE_READ8_MEMBER(lamps_r);
|
||||
DECLARE_WRITE8_MEMBER(lamps_w);
|
||||
DECLARE_READ16_MEMBER(coinlockout_r);
|
||||
DECLARE_WRITE16_MEMBER(coinlockout_w);
|
||||
DECLARE_READ8_MEMBER(coin_counter_r);
|
||||
DECLARE_WRITE8_MEMBER(coin_counter_w);
|
||||
DECLARE_WRITE8_MEMBER(hopper_w);
|
||||
DECLARE_WRITE8_MEMBER(lamps1_w);
|
||||
DECLARE_WRITE8_MEMBER(lamps2_w);
|
||||
DECLARE_WRITE8_MEMBER(coinlockout_w);
|
||||
DECLARE_WRITE8_MEMBER(audiocpu_cmd_w);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(coin_drop_start);
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(coin_sensors_r);
|
||||
@ -76,59 +75,39 @@ protected:
|
||||
uint64_t m_coin_start_cycles;
|
||||
uint64_t m_hopper_start_cycles;
|
||||
uint8_t m_coin_counter;
|
||||
uint8_t m_coin_lockout;
|
||||
uint8_t m_hopper_ctrl;
|
||||
uint8_t m_lamps[2];
|
||||
};
|
||||
|
||||
|
||||
READ16_MEMBER(segajw_state::coin_counter_r)
|
||||
READ8_MEMBER(segajw_state::coin_counter_r)
|
||||
{
|
||||
return m_coin_counter ^ 0xff;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(segajw_state::coin_counter_w)
|
||||
WRITE8_MEMBER(segajw_state::coin_counter_w)
|
||||
{
|
||||
if(ACCESSING_BITS_0_7)
|
||||
m_coin_counter = data;
|
||||
m_coin_counter = data;
|
||||
}
|
||||
|
||||
READ16_MEMBER(segajw_state::hopper_r)
|
||||
WRITE8_MEMBER(segajw_state::hopper_w)
|
||||
{
|
||||
return m_hopper_ctrl;
|
||||
m_hopper_start_cycles = data & 0x02 ? 0 : m_maincpu->total_cycles();
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(segajw_state::hopper_w)
|
||||
WRITE8_MEMBER(segajw_state::lamps1_w)
|
||||
{
|
||||
if(ACCESSING_BITS_0_7)
|
||||
{
|
||||
m_hopper_start_cycles = data & 0x02 ? 0 : m_maincpu->total_cycles();
|
||||
m_hopper_ctrl = data;
|
||||
}
|
||||
for (int i = 0; i < 8; i++)
|
||||
output().set_lamp_value(i, BIT(data, i));
|
||||
}
|
||||
|
||||
READ8_MEMBER(segajw_state::lamps_r)
|
||||
WRITE8_MEMBER(segajw_state::lamps2_w)
|
||||
{
|
||||
return m_lamps[offset];
|
||||
for (int i = 0; i < 8; i++)
|
||||
output().set_lamp_value(8 + i, BIT(data, i));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(segajw_state::lamps_w)
|
||||
{
|
||||
for(int i=0; i<8; i++)
|
||||
output().set_lamp_value((offset * 8) + i, BIT(data, i));
|
||||
|
||||
m_lamps[offset] = data;
|
||||
}
|
||||
|
||||
READ16_MEMBER(segajw_state::coinlockout_r)
|
||||
{
|
||||
return m_coin_lockout;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(segajw_state::coinlockout_w)
|
||||
WRITE8_MEMBER(segajw_state::coinlockout_w)
|
||||
{
|
||||
machine().bookkeeping().coin_lockout_w(0, data & 1);
|
||||
m_coin_lockout = data;
|
||||
|
||||
for(int i=0; i<3; i++)
|
||||
output().set_indexed_value("towerlamp", i, BIT(data, 3 + i));
|
||||
@ -200,18 +179,9 @@ static ADDRESS_MAP_START( segajw_map, AS_PROGRAM, 16, segajw_state )
|
||||
AM_RANGE(0x18000a, 0x18000b) AM_READ_PORT("DSW3")
|
||||
AM_RANGE(0x18000c, 0x18000d) AM_READ_PORT("DSW2")
|
||||
|
||||
AM_RANGE(0x1a0000, 0x1a0001) AM_WRITE(coin_counter_w)
|
||||
AM_RANGE(0x1a0002, 0x1a0005) AM_READWRITE8(lamps_r, lamps_w, 0x00ff)
|
||||
AM_RANGE(0x1a0006, 0x1a0007) AM_READWRITE(hopper_r, hopper_w)
|
||||
AM_RANGE(0x1a000a, 0x1a000b) AM_READ(coin_counter_r)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_DEVREADWRITE8("io1a", sega_315_5296_device, read, write, 0x00ff)
|
||||
|
||||
AM_RANGE(0x1a000e, 0x1a000f) AM_NOP
|
||||
|
||||
AM_RANGE(0x1c0000, 0x1c0001) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x1c0002, 0x1c0003) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0x1c0004, 0x1c0005) AM_READ_PORT("IN2")
|
||||
AM_RANGE(0x1c0006, 0x1c0007) AM_READ_PORT("IN3")
|
||||
AM_RANGE(0x1c000c, 0x1c000d) AM_READWRITE(coinlockout_r, coinlockout_w)
|
||||
AM_RANGE(0x1c0000, 0x1c001f) AM_DEVREADWRITE8("io1c", sega_315_5296_device, read, write, 0x00ff)
|
||||
|
||||
AM_RANGE(0x280000, 0x280001) AM_DEVWRITE8("ramdac", ramdac_device, index_w, 0x00ff)
|
||||
AM_RANGE(0x280002, 0x280003) AM_DEVWRITE8("ramdac", ramdac_device, pal_w, 0x00ff)
|
||||
@ -239,36 +209,36 @@ ADDRESS_MAP_END
|
||||
|
||||
static INPUT_PORTS_START( segajw )
|
||||
PORT_START("IN0")
|
||||
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_POKER_HOLD1 )
|
||||
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_POKER_HOLD2 )
|
||||
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_POKER_HOLD3 )
|
||||
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_POKER_HOLD4 )
|
||||
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
|
||||
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("1 Bet")
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Max Bet")
|
||||
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Draw")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD2 )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD3 )
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 )
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("1 Bet")
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Max Bet")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Draw")
|
||||
|
||||
PORT_START("IN1")
|
||||
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Double")
|
||||
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
|
||||
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Change")
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE )
|
||||
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_R)
|
||||
PORT_BIT( 0x000d, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Double")
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Change")
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Reset") PORT_CODE(KEYCODE_R)
|
||||
PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
|
||||
PORT_START("IN2")
|
||||
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Meter")
|
||||
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Last Game") PORT_CODE(KEYCODE_T)
|
||||
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("M-Door")
|
||||
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("D-Door")
|
||||
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, segajw_state, hopper_sensors_r, nullptr)
|
||||
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hopper Full")
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hopper Fill")
|
||||
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_SERVICE ) PORT_NAME("Meter")
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Last Game") PORT_CODE(KEYCODE_T)
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("M-Door")
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("D-Door")
|
||||
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, segajw_state, hopper_sensors_r, nullptr)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hopper Full")
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hopper Fill")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
|
||||
PORT_START("IN3")
|
||||
PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, segajw_state, coin_sensors_r, nullptr)
|
||||
PORT_BIT( 0x00f8, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, segajw_state, coin_sensors_r, nullptr)
|
||||
PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
|
||||
PORT_START("COIN1") // start the coin drop sequence (see coin_sensors_r)
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, segajw_state, coin_drop_start, nullptr)
|
||||
@ -372,9 +342,6 @@ void segajw_state::machine_start()
|
||||
save_item(NAME(m_coin_start_cycles));
|
||||
save_item(NAME(m_hopper_start_cycles));
|
||||
save_item(NAME(m_coin_counter));
|
||||
save_item(NAME(m_coin_lockout));
|
||||
save_item(NAME(m_hopper_ctrl));
|
||||
save_item(NAME(m_lamps));
|
||||
}
|
||||
|
||||
|
||||
@ -383,8 +350,6 @@ void segajw_state::machine_reset()
|
||||
m_coin_start_cycles = 0;
|
||||
m_hopper_start_cycles = 0;
|
||||
m_coin_counter = 0xff;
|
||||
m_coin_lockout = 0;
|
||||
m_hopper_ctrl = 0;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( ramdac_map, AS_0, 8, segajw_state )
|
||||
@ -405,6 +370,20 @@ static MACHINE_CONFIG_START( segajw, segajw_state )
|
||||
|
||||
MCFG_NVRAM_ADD_NO_FILL("nvram")
|
||||
|
||||
MCFG_DEVICE_ADD("io1a", SEGA_315_5296, 8000000) // unknown clock
|
||||
MCFG_315_5296_OUT_PORTA_CB(WRITE8(segajw_state, coin_counter_w))
|
||||
MCFG_315_5296_OUT_PORTB_CB(WRITE8(segajw_state, lamps1_w))
|
||||
MCFG_315_5296_OUT_PORTC_CB(WRITE8(segajw_state, lamps2_w))
|
||||
MCFG_315_5296_OUT_PORTD_CB(WRITE8(segajw_state, hopper_w))
|
||||
MCFG_315_5296_IN_PORTF_CB(READ8(segajw_state, coin_counter_r))
|
||||
|
||||
MCFG_DEVICE_ADD("io1c", SEGA_315_5296, 8000000) // unknown clock
|
||||
MCFG_315_5296_IN_PORTA_CB(IOPORT("IN0"))
|
||||
MCFG_315_5296_IN_PORTB_CB(IOPORT("IN1"))
|
||||
MCFG_315_5296_IN_PORTC_CB(IOPORT("IN2"))
|
||||
MCFG_315_5296_IN_PORTD_CB(IOPORT("IN3"))
|
||||
MCFG_315_5296_OUT_PORTG_CB(WRITE8(segajw_state, coinlockout_w))
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
|
@ -1340,7 +1340,7 @@ static MACHINE_CONFIG_START( yboard, segaybd_state )
|
||||
|
||||
MCFG_WATCHDOG_ADD("watchdog")
|
||||
|
||||
MCFG_DEVICE_ADD("io", SEGA_315_5296, 16000000)
|
||||
MCFG_DEVICE_ADD("io", SEGA_315_5296, 16000000) // probably SOUND_CLOCK/n
|
||||
MCFG_315_5296_IN_PORTA_CB(IOPORT("P1"))
|
||||
MCFG_315_5296_IN_PORTB_CB(IOPORT("GENERAL"))
|
||||
MCFG_315_5296_IN_PORTC_CB(IOPORT("LIMITSW"))
|
||||
|
Loading…
Reference in New Issue
Block a user