mirror of
https://github.com/holub/mame
synced 2025-04-27 02:33:13 +03:00
changed RP5H01 from read8/write8 to read_line/write_line + removed unneeded enable/disable in drivers
This commit is contained in:
parent
daf7a46866
commit
b0320975c4
@ -1,6 +1,6 @@
|
||||
/***************************************************************************
|
||||
|
||||
RP5H01
|
||||
RP5H01 - Ricoh 64x1bit PROM with 6/7-bit counter
|
||||
|
||||
TODO:
|
||||
- follow the datasheet better (all dumps presumably needs to be redone
|
||||
@ -59,7 +59,7 @@ void rp5h01_device::device_reset()
|
||||
m_counter_mode = COUNTER_MODE_6_BITS;
|
||||
m_enabled = 0;
|
||||
m_old_reset = -1;
|
||||
m_old_clock = -1;
|
||||
m_old_clock = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -71,46 +71,46 @@ void rp5h01_device::device_reset()
|
||||
enable_w
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_MEMBER( rp5h01_device::enable_w )
|
||||
WRITE_LINE_MEMBER( rp5h01_device::enable_w )
|
||||
{
|
||||
/* process the /CE signal and enable/disable the IC */
|
||||
m_enabled = (data == 0) ? 1 : 0;
|
||||
m_enabled = state ? 0 : 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
reset_w
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_MEMBER( rp5h01_device::reset_w )
|
||||
WRITE_LINE_MEMBER( rp5h01_device::reset_w )
|
||||
{
|
||||
int newstate = (data == 0) ? 0 : 1;
|
||||
state = !state;
|
||||
|
||||
/* if it's not enabled, ignore */
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
/* now look for a 0->1 transition */
|
||||
if (m_old_reset == 0 && newstate == 1)
|
||||
if (!m_old_reset && state)
|
||||
{
|
||||
/* reset the counter */
|
||||
m_counter = 0;
|
||||
}
|
||||
|
||||
/* update the pin */
|
||||
m_old_reset = newstate;
|
||||
m_old_reset = state;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cs_w
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_MEMBER( rp5h01_device::cs_w )
|
||||
WRITE_LINE_MEMBER( rp5h01_device::cs_w )
|
||||
{
|
||||
/* if it's not enabled, ignore */
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
if (data == 1)
|
||||
if (state)
|
||||
{
|
||||
/* reset the counter */
|
||||
m_counter = 0;
|
||||
@ -121,48 +121,46 @@ WRITE8_MEMBER( rp5h01_device::cs_w )
|
||||
clock_w
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_MEMBER( rp5h01_device::clock_w )
|
||||
WRITE_LINE_MEMBER( rp5h01_device::clock_w )
|
||||
{
|
||||
int newstate = (data == 0) ? 0 : 1;
|
||||
|
||||
/* if it's not enabled, ignore */
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
/* now look for a 1->0 transition */
|
||||
if (m_old_clock == 1 && newstate == 0)
|
||||
if (m_old_clock && !state)
|
||||
{
|
||||
/* increment the counter, and mask it with the mode */
|
||||
m_counter++;
|
||||
}
|
||||
|
||||
/* update the pin */
|
||||
m_old_clock = newstate;
|
||||
m_old_clock = state;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
test_w
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_MEMBER( rp5h01_device::test_w )
|
||||
WRITE_LINE_MEMBER( rp5h01_device::test_w )
|
||||
{
|
||||
/* if it's not enabled, ignore */
|
||||
if (!m_enabled)
|
||||
return;
|
||||
|
||||
/* process the test signal and change the counter mode */
|
||||
m_counter_mode = (data == 0) ? COUNTER_MODE_6_BITS : COUNTER_MODE_7_BITS;
|
||||
m_counter_mode = (state) ? COUNTER_MODE_7_BITS : COUNTER_MODE_6_BITS;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
counter_r
|
||||
-------------------------------------------------*/
|
||||
|
||||
READ8_MEMBER( rp5h01_device::counter_r )
|
||||
READ_LINE_MEMBER( rp5h01_device::counter_r )
|
||||
{
|
||||
/* if it's not enabled, ignore */
|
||||
if (!m_enabled)
|
||||
return 0; /* ? (should be high impedance) */
|
||||
return 1; /* high impedance */
|
||||
|
||||
/* return A5 */
|
||||
return (m_counter >> 5) & 1;
|
||||
@ -172,17 +170,15 @@ READ8_MEMBER( rp5h01_device::counter_r )
|
||||
data_r
|
||||
-------------------------------------------------*/
|
||||
|
||||
READ8_MEMBER( rp5h01_device::data_r )
|
||||
READ_LINE_MEMBER( rp5h01_device::data_r )
|
||||
{
|
||||
int byte, bit;
|
||||
|
||||
/* if it's not enabled, ignore */
|
||||
if (!m_enabled)
|
||||
return 0; /* ? (should be high impedance) */
|
||||
return 1; /* high impedance */
|
||||
|
||||
/* get the byte offset and bit offset */
|
||||
byte = (m_counter & m_counter_mode) >> 3;
|
||||
bit = 7 - (m_counter & 7);
|
||||
int byte = (m_counter & m_counter_mode) >> 3;
|
||||
int bit = 7 - (m_counter & 7);
|
||||
|
||||
/* return the data */
|
||||
return (m_data[byte] >> bit) & 1;
|
||||
|
@ -1,7 +1,16 @@
|
||||
/***************************************************************************
|
||||
|
||||
RP5H01
|
||||
RP5H01 - Ricoh 64x1bit PROM with 6/7-bit counter
|
||||
|
||||
****************************************************************************
|
||||
___________
|
||||
DATA 1 |* | 8 COUNTER OUT
|
||||
| |
|
||||
_CE/Vpp 2 | RP5H01 | 7 RESET
|
||||
| RF5H01 |
|
||||
Vcc 3 | | 6 DATA CLOCK
|
||||
| |
|
||||
GND 4 |___________| 5 TEST
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
@ -28,13 +37,13 @@ class rp5h01_device : public device_t
|
||||
public:
|
||||
rp5h01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
DECLARE_WRITE8_MEMBER( enable_w ); /* /CE */
|
||||
DECLARE_WRITE8_MEMBER( reset_w ); /* RESET */
|
||||
DECLARE_WRITE8_MEMBER( cs_w ); /* CS */
|
||||
DECLARE_WRITE8_MEMBER( clock_w ); /* DATA CLOCK (active low) */
|
||||
DECLARE_WRITE8_MEMBER( test_w ); /* TEST */
|
||||
DECLARE_READ8_MEMBER( counter_r ); /* COUNTER OUT */
|
||||
DECLARE_READ8_MEMBER( data_r ); /* DATA */
|
||||
DECLARE_WRITE_LINE_MEMBER( enable_w ); /* /CE */
|
||||
DECLARE_WRITE_LINE_MEMBER( reset_w ); /* RESET */
|
||||
DECLARE_WRITE_LINE_MEMBER( cs_w ); /* CS */
|
||||
DECLARE_WRITE_LINE_MEMBER( clock_w ); /* DATA CLOCK (active low) */
|
||||
DECLARE_WRITE_LINE_MEMBER( test_w ); /* TEST */
|
||||
DECLARE_READ_LINE_MEMBER( counter_r ); /* COUNTER OUT */
|
||||
DECLARE_READ_LINE_MEMBER( data_r ); /* DATA */
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
|
@ -304,7 +304,7 @@ public:
|
||||
m_rp5h01(*this,"rp5h01"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette")
|
||||
{ }
|
||||
{ }
|
||||
|
||||
required_device<m50458_device> m_m50458;
|
||||
required_device<s3520cf_device> m_s3520cf;
|
||||
@ -470,13 +470,9 @@ READ8_MEMBER(nss_state::nss_prot_r)
|
||||
|
||||
if (m_cart_sel == 0)
|
||||
{
|
||||
m_rp5h01->enable_w(space, 0, 0);
|
||||
data |= ((~m_rp5h01->counter_r(space, 0)) << 4) & 0x10; /* D4 */
|
||||
data |= ((m_rp5h01->data_r(space, 0)) << 3) & 0x08; /* D3 */
|
||||
m_rp5h01->enable_w(space, 0, 1);
|
||||
data |= ((~m_rp5h01->counter_r()) << 4) & 0x10; /* D4 */
|
||||
data |= (m_rp5h01->data_r() << 3) & 0x08; /* D3 */
|
||||
}
|
||||
else
|
||||
m_rp5h01->enable_w(space, 0, 1);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -485,14 +481,10 @@ WRITE8_MEMBER(nss_state::nss_prot_w)
|
||||
{
|
||||
if (m_cart_sel == 0)
|
||||
{
|
||||
m_rp5h01->enable_w(space, 0, 0);
|
||||
m_rp5h01->test_w(space, 0, data & 0x10); /* D4 */
|
||||
m_rp5h01->clock_w(space, 0, data & 0x08); /* D3 */
|
||||
m_rp5h01->cs_w(space, 0, ~data & 0x01);
|
||||
m_rp5h01->enable_w(space, 0, 1);
|
||||
m_rp5h01->test_w(data & 0x10); /* D4 */
|
||||
m_rp5h01->clock_w(data & 0x08); /* D3 */
|
||||
m_rp5h01->cs_w(~data & 0x01);
|
||||
}
|
||||
else
|
||||
m_rp5h01->enable_w(space, 0, 1);
|
||||
|
||||
ioport("EEPROMOUT")->write(data, 0xff);
|
||||
}
|
||||
@ -803,6 +795,12 @@ void nss_state::machine_reset()
|
||||
m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
|
||||
m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
|
||||
|
||||
/* reset the security chip */
|
||||
m_rp5h01->enable_w(1);
|
||||
m_rp5h01->enable_w(0);
|
||||
m_rp5h01->reset_w(0);
|
||||
m_rp5h01->reset_w(1);
|
||||
|
||||
m_game_over_flag = 1;
|
||||
m_joy_flag = 1;
|
||||
}
|
||||
|
@ -26,11 +26,10 @@ void playch10_state::machine_reset()
|
||||
m_MMC2_bank_latch[0] = m_MMC2_bank_latch[1] = 0xfe;
|
||||
|
||||
/* reset the security chip */
|
||||
address_space &space = generic_space();
|
||||
m_rp5h01->enable_w(space, 0, 0);
|
||||
m_rp5h01->reset_w(space, 0, 0);
|
||||
m_rp5h01->reset_w(space, 0, 1);
|
||||
m_rp5h01->enable_w(space, 0, 1);
|
||||
m_rp5h01->enable_w(1);
|
||||
m_rp5h01->enable_w(0);
|
||||
m_rp5h01->reset_w(0);
|
||||
m_rp5h01->reset_w(1);
|
||||
|
||||
pc10_set_mirroring(m_mirroring);
|
||||
}
|
||||
@ -160,10 +159,8 @@ READ8_MEMBER(playch10_state::pc10_prot_r)
|
||||
/* we only support a single cart connected at slot 0 */
|
||||
if (m_cart_sel == 0)
|
||||
{
|
||||
m_rp5h01->enable_w(space, 0, 0);
|
||||
data |= ((~m_rp5h01->counter_r(space, 0)) << 4) & 0x10; /* D4 */
|
||||
data |= ((m_rp5h01->data_r(space, 0)) << 3) & 0x08; /* D3 */
|
||||
m_rp5h01->enable_w(space, 0, 1);
|
||||
data |= ((~m_rp5h01->counter_r()) << 4) & 0x10; /* D4 */
|
||||
data |= (m_rp5h01->data_r() << 3) & 0x08; /* D3 */
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -173,11 +170,9 @@ WRITE8_MEMBER(playch10_state::pc10_prot_w)
|
||||
/* we only support a single cart connected at slot 0 */
|
||||
if (m_cart_sel == 0)
|
||||
{
|
||||
m_rp5h01->enable_w(space, 0, 0);
|
||||
m_rp5h01->test_w(space, 0, data & 0x10); /* D4 */
|
||||
m_rp5h01->clock_w(space, 0, data & 0x08); /* D3 */
|
||||
m_rp5h01->reset_w(space, 0, ~data & 0x01); /* D0 */
|
||||
m_rp5h01->enable_w(space, 0, 1);
|
||||
m_rp5h01->test_w(data & 0x10); /* D4 */
|
||||
m_rp5h01->clock_w(data & 0x08); /* D3 */
|
||||
m_rp5h01->reset_w(~data & 0x01); /* D0 */
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user