mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
midvunit.cpp: crusnwld uses newer type PIC
midwayic.cpp: remove few unneeded HLE hacks, add debugger access guards
This commit is contained in:
parent
a7f7fb9e6a
commit
8cba504bb7
@ -280,25 +280,20 @@ void midvunit_state::tms32031_control_w(offs_t offset, uint32_t data, uint32_t m
|
||||
|
||||
uint32_t midvunit_state::crusnwld_serial_status_r()
|
||||
{
|
||||
uint16_t in1 = (m_in1->read() & 0x7fff) | (m_midway_serial_pic->status_r() << 15);
|
||||
uint16_t in1 = (m_in1->read() & 0x7fff) | (m_midway_serial_pic2->status_r() << 15);
|
||||
return in1 | in1 << 16;
|
||||
}
|
||||
|
||||
|
||||
uint32_t midvunit_state::crusnwld_serial_data_r()
|
||||
{
|
||||
return m_midway_serial_pic->read() << 16;
|
||||
return m_midway_serial_pic2->read() << 16;
|
||||
}
|
||||
|
||||
|
||||
void midvunit_state::crusnwld_serial_data_w(uint32_t data)
|
||||
{
|
||||
if ((data & 0xf0000) == 0x10000)
|
||||
{
|
||||
m_midway_serial_pic->reset_w(1);
|
||||
m_midway_serial_pic->reset_w(0);
|
||||
}
|
||||
m_midway_serial_pic->write(data >> 16);
|
||||
m_midway_serial_pic2->write(data >> 16);
|
||||
}
|
||||
|
||||
|
||||
@ -333,31 +328,6 @@ void midvunit_state::bit_reset_w(uint32_t data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Off Road Challenge PIC access
|
||||
*
|
||||
*************************************/
|
||||
|
||||
uint32_t midvunit_state::offroadc_serial_status_r()
|
||||
{
|
||||
uint16_t in1 = (m_in1->read() & 0x7fff) | (m_midway_serial_pic2->status_r() << 15);
|
||||
return in1 | in1 << 16;
|
||||
}
|
||||
|
||||
|
||||
uint32_t midvunit_state::offroadc_serial_data_r()
|
||||
{
|
||||
return m_midway_serial_pic2->read() << 16;
|
||||
}
|
||||
|
||||
|
||||
void midvunit_state::offroadc_serial_data_w(uint32_t data)
|
||||
{
|
||||
m_midway_serial_pic2->write(data >> 16);
|
||||
}
|
||||
|
||||
uint32_t midvunit_state::midvunit_wheel_board_r()
|
||||
{
|
||||
//logerror("midvunit_wheel_board_r: %08X\n", m_wheel_board_output);
|
||||
@ -1147,8 +1117,9 @@ void midvunit_state::crusnwld(machine_config &config)
|
||||
{
|
||||
midvunit(config);
|
||||
/* valid values are 450 or 460 */
|
||||
MIDWAY_SERIAL_PIC(config, m_midway_serial_pic, 0);
|
||||
m_midway_serial_pic->set_upper(450);
|
||||
MIDWAY_SERIAL_PIC2(config, m_midway_serial_pic2, 0);
|
||||
m_midway_serial_pic2->set_upper(450);
|
||||
m_midway_serial_pic2->set_yearoffs(94);
|
||||
}
|
||||
|
||||
void midvunit_state::offroadc(machine_config &config)
|
||||
@ -2005,8 +1976,9 @@ void midvunit_state::init_offroadc()
|
||||
/* control register is different */
|
||||
m_maincpu->space(AS_PROGRAM).install_write_handler(0x994000, 0x994000, write32s_delegate(*this, FUNC(midvunit_state::crusnwld_control_w)));
|
||||
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x991030, 0x991030, read32smo_delegate(*this, FUNC(midvunit_state::offroadc_serial_status_r)));
|
||||
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x996000, 0x996000, read32smo_delegate(*this, FUNC(midvunit_state::offroadc_serial_data_r)), write32smo_delegate(*this, FUNC(midvunit_state::offroadc_serial_data_w)));
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x991030, 0x991030, read32smo_delegate(*this, FUNC(midvunit_state::crusnwld_serial_status_r)));
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x996000, 0x996000, read32smo_delegate(*this, FUNC(midvunit_state::crusnwld_serial_data_r)));
|
||||
m_maincpu->space(AS_PROGRAM).install_write_handler(0x996000, 0x996000, write32smo_delegate(*this, FUNC(midvunit_state::crusnwld_serial_data_w)));
|
||||
|
||||
/* speedups */
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x195aa, 0x195aa, read32sm_delegate(*this, FUNC(midvunit_state::generic_speedup_r)));
|
||||
|
@ -61,7 +61,6 @@ public:
|
||||
m_watchdog(*this, "watchdog"),
|
||||
m_palette(*this, "palette"),
|
||||
m_adc(*this, "adc"),
|
||||
m_midway_serial_pic(*this, "serial_pic"),
|
||||
m_midway_serial_pic2(*this, "serial_pic2"),
|
||||
m_midway_ioasic(*this, "ioasic"),
|
||||
m_ata(*this, "ata"),
|
||||
@ -159,9 +158,6 @@ private:
|
||||
void crusnwld_serial_data_w(uint32_t data);
|
||||
uint32_t bit_data_r(offs_t offset);
|
||||
void bit_reset_w(uint32_t data);
|
||||
uint32_t offroadc_serial_status_r();
|
||||
uint32_t offroadc_serial_data_r();
|
||||
void offroadc_serial_data_w(uint32_t data);
|
||||
uint32_t midvplus_misc_r(offs_t offset);
|
||||
void midvplus_misc_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
|
||||
void midvplus_xf1_w(uint8_t data);
|
||||
@ -184,7 +180,6 @@ private:
|
||||
required_device<watchdog_timer_device> m_watchdog;
|
||||
required_device<palette_device> m_palette;
|
||||
optional_device<adc0844_device> m_adc;
|
||||
optional_device<midway_serial_pic_device> m_midway_serial_pic;
|
||||
optional_device<midway_serial_pic2_device> m_midway_serial_pic2;
|
||||
optional_device<midway_ioasic_device> m_midway_ioasic;
|
||||
optional_device<ata_interface_device> m_ata;
|
||||
|
@ -107,11 +107,6 @@ void midway_serial_pic_device::generate_serial_data(int upper)
|
||||
m_data[0] = temp & 0xff;
|
||||
m_data[1] = (temp >> 8) & 0xff;
|
||||
m_data[2] = (temp >> 16) & 0xff;
|
||||
|
||||
/* special hack for RevX */
|
||||
m_ormask = 0x80;
|
||||
if (upper == 419)
|
||||
m_ormask = 0x00;
|
||||
}
|
||||
|
||||
|
||||
@ -130,7 +125,6 @@ void midway_serial_pic_device::serial_register_state()
|
||||
save_item(NAME(m_idx));
|
||||
save_item(NAME(m_status));
|
||||
save_item(NAME(m_bits));
|
||||
save_item(NAME(m_ormask));
|
||||
}
|
||||
|
||||
DEFINE_DEVICE_TYPE(MIDWAY_SERIAL_PIC, midway_serial_pic_device, "midway_serial_pic_sim", "Midway Serial PIC Simulation")
|
||||
@ -152,8 +146,7 @@ midway_serial_pic_device::midway_serial_pic_device(const machine_config &mconfig
|
||||
m_buff(0),
|
||||
m_idx(0),
|
||||
m_status(0),
|
||||
m_bits(0),
|
||||
m_ormask(0)
|
||||
m_bits(0)
|
||||
{
|
||||
memset(m_data,0,sizeof(m_data));
|
||||
}
|
||||
@ -191,8 +184,11 @@ u8 midway_serial_pic_device::status_r()
|
||||
|
||||
u8 midway_serial_pic_device::read()
|
||||
{
|
||||
logerror("%s:security R = %04X\n", machine().describe_context(), m_buff);
|
||||
m_status = 1;
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
logerror("%s:security R = %04X\n", machine().describe_context(), m_buff);
|
||||
m_status = 1;
|
||||
}
|
||||
return m_buff;
|
||||
}
|
||||
|
||||
@ -208,9 +204,8 @@ void midway_serial_pic_device::write(u8 data)
|
||||
if (!m_status)
|
||||
{
|
||||
/* the self-test writes 1F, 0F, and expects to read an F in the low 4 bits */
|
||||
/* Cruis'n World expects the high bit to be set as well */
|
||||
if (data & 0x0f)
|
||||
m_buff = m_ormask | data;
|
||||
m_buff = data & 0xf;
|
||||
else
|
||||
m_buff = m_data[m_idx++ % sizeof(m_data)];
|
||||
}
|
||||
@ -409,17 +404,20 @@ u8 midway_serial_pic2_device::status_r()
|
||||
{
|
||||
uint8_t result = 0;
|
||||
|
||||
/* if we're still holding the data ready bit high, do it */
|
||||
if (m_latch & 0xf00)
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
if (machine().time() > m_latch_expire_time)
|
||||
m_latch &= 0xff;
|
||||
else
|
||||
m_latch -= 0x100;
|
||||
result = 1;
|
||||
}
|
||||
/* if we're still holding the data ready bit high, do it */
|
||||
if (m_latch & 0xf00)
|
||||
{
|
||||
if (machine().time() > m_latch_expire_time)
|
||||
m_latch &= 0xff;
|
||||
else
|
||||
m_latch -= 0x100;
|
||||
result = 1;
|
||||
}
|
||||
|
||||
logerror("%s:PIC status %d\n", machine().describe_context(), result);
|
||||
logerror("%s:PIC status %d\n", machine().describe_context(), result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -429,7 +427,8 @@ u8 midway_serial_pic2_device::read()
|
||||
uint8_t result = 0;
|
||||
|
||||
/* PIC data register */
|
||||
logerror("%s:PIC data read (index=%d total=%d latch=%03X) =", machine().describe_context(), m_index, m_total, m_latch);
|
||||
if (!machine().side_effects_disabled())
|
||||
logerror("%s:PIC data read (index=%d total=%d latch=%03X) =", machine().describe_context(), m_index, m_total, m_latch);
|
||||
|
||||
/* return the current result */
|
||||
if (m_latch & 0xf00)
|
||||
@ -439,7 +438,8 @@ u8 midway_serial_pic2_device::read()
|
||||
else if (m_index < m_total)
|
||||
result = 0xff;
|
||||
|
||||
logerror("%02X\n", result);
|
||||
if (!machine().side_effects_disabled())
|
||||
logerror("%02X\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,6 @@ private:
|
||||
uint8_t m_idx;
|
||||
uint8_t m_status;
|
||||
uint8_t m_bits;
|
||||
uint8_t m_ormask;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user