mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
dec0.cpp latch cleanup: 'LS374 sensed positive edge others are educted guesses
This commit is contained in:
parent
6b88671241
commit
1296414948
@ -54,8 +54,8 @@ public:
|
||||
optional_shared_ptr<uint8_t> m_hippodrm_shared_ram;
|
||||
|
||||
mcu_type m_game;
|
||||
int m_i8751_return;
|
||||
int m_i8751_command;
|
||||
uint16_t m_i8751_return;
|
||||
uint16_t m_i8751_command;
|
||||
int m_slyspy_state;
|
||||
int m_hippodrm_msb;
|
||||
int m_hippodrm_lsb;
|
||||
|
@ -10,7 +10,9 @@ Data East machine functions - Bryan McPhail, mish@tendril.co.uk
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/dec0.h"
|
||||
|
||||
#include "cpu/h6280/h6280.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "cpu/mcs51/mcs51.h"
|
||||
|
||||
|
||||
@ -165,39 +167,35 @@ WRITE16_MEMBER(dec0_state::hippodrm_68000_share_w)
|
||||
|
||||
READ8_MEMBER(dec0_state::dec0_mcu_port_r)
|
||||
{
|
||||
int latchEnable=m_i8751_ports[2]>>4;
|
||||
uint8_t result = 0xff;
|
||||
|
||||
// P0 connected to 4 latches
|
||||
if (offset==0)
|
||||
// P0 connected to latches
|
||||
if (offset == 0)
|
||||
{
|
||||
if ((latchEnable&1)==0)
|
||||
return m_i8751_command>>8;
|
||||
else if ((latchEnable&2)==0)
|
||||
return m_i8751_command&0xff;
|
||||
else if ((latchEnable&4)==0)
|
||||
return m_i8751_return>>8;
|
||||
else if ((latchEnable&8)==0)
|
||||
return m_i8751_return&0xff;
|
||||
if (!BIT(m_i8751_ports[2], 4))
|
||||
result &= m_i8751_command >> 8;
|
||||
if (!BIT(m_i8751_ports[2], 5))
|
||||
result &= m_i8751_command & 0x00ff;
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
return result;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(dec0_state::dec0_mcu_port_w)
|
||||
{
|
||||
m_i8751_ports[offset]=data;
|
||||
|
||||
if (offset==2)
|
||||
if (offset == 2)
|
||||
{
|
||||
if ((data&0x4)==0)
|
||||
m_maincpu->set_input_line(5, HOLD_LINE);
|
||||
if ((data&0x8)==0)
|
||||
if (!BIT(data, 2) && BIT(m_i8751_ports[2], 2))
|
||||
m_maincpu->set_input_line(M68K_IRQ_5, HOLD_LINE);
|
||||
if (!BIT(data, 3))
|
||||
m_mcu->set_input_line(MCS51_INT1_LINE, CLEAR_LINE);
|
||||
if ((data&0x40)==0)
|
||||
m_i8751_return=(m_i8751_return&0xff00)|(m_i8751_ports[0]);
|
||||
if ((data&0x80)==0)
|
||||
m_i8751_return=(m_i8751_return&0xff)|(m_i8751_ports[0]<<8);
|
||||
if (BIT(data, 6) && !BIT(m_i8751_ports[2], 6))
|
||||
m_i8751_return = (m_i8751_return & 0xff00) | m_i8751_ports[0];
|
||||
if (BIT(data, 7) && !BIT(m_i8751_ports[2], 7))
|
||||
m_i8751_return = (m_i8751_return & 0x00ff) | (m_i8751_ports[0] << 8);
|
||||
}
|
||||
|
||||
m_i8751_ports[offset] = data;
|
||||
}
|
||||
|
||||
void dec0_state::baddudes_i8751_write(int data)
|
||||
@ -300,12 +298,22 @@ void dec0_state::birdtry_i8751_write(int data)
|
||||
|
||||
void dec0_state::dec0_i8751_write(int data)
|
||||
{
|
||||
m_i8751_command=data;
|
||||
m_i8751_command = data;
|
||||
|
||||
/* Writes to this address cause an IRQ to the i8751 microcontroller */
|
||||
if (m_game == mcu_type::EMULATED) m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE);
|
||||
if (m_game == mcu_type::BADDUDES_SIM) baddudes_i8751_write(data);
|
||||
if (m_game == mcu_type::BIRDTRY_SIM) birdtry_i8751_write(data);
|
||||
/* Writes to this address raise an IRQ on the i8751 microcontroller */
|
||||
switch (m_game)
|
||||
{
|
||||
case mcu_type::EMULATED:
|
||||
if (BIT(m_i8751_ports[2], 3))
|
||||
m_mcu->set_input_line(MCS51_INT1_LINE, ASSERT_LINE);
|
||||
break;
|
||||
case mcu_type::BADDUDES_SIM:
|
||||
baddudes_i8751_write(data);
|
||||
break;
|
||||
case mcu_type::BIRDTRY_SIM:
|
||||
birdtry_i8751_write(data);
|
||||
break;
|
||||
}
|
||||
|
||||
//logerror("%s: warning - write %02x to i8751\n",machine().describe_context(),data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user