vsmile: remove need for reset hack joystick, enable second controller port (not working but doesn't prevent controller 1 from working)

This commit is contained in:
Vas Crabb 2019-01-22 02:41:25 +11:00
parent a27b5ee8b4
commit 3b8eb63948
4 changed files with 6 additions and 27 deletions

View File

@ -65,17 +65,6 @@ void vsmile_pad_device::device_start()
save_item(NAME(m_ctrl_probe_history));
}
void vsmile_pad_device::device_reset()
{
vsmile_ctrl_device_base::device_reset();
// HACK: the controller detects an RTS timeout or something, it doesn't have a reset line
m_stale = STALE_ALL;
m_active = false;
std::fill(std::begin(m_ctrl_probe_history), std::end(m_ctrl_probe_history), 0U);
m_idle_timer->adjust(attotime::from_seconds(1));
}
void vsmile_pad_device::tx_complete()
{
// update joystick
@ -137,12 +126,13 @@ void vsmile_pad_device::tx_timeout()
{
if (m_active)
{
m_idle_timer->adjust(attotime::from_seconds(1));
m_idle_timer->reset();
m_active = false;
m_stale = STALE_ALL;
std::fill(std::begin(m_ctrl_probe_history), std::end(m_ctrl_probe_history), 0U);
LOG("left active state\n");
}
uart_tx_fifo_push(0x55);
}
void vsmile_pad_device::rx_complete(uint8_t data, bool select)
@ -151,7 +141,7 @@ void vsmile_pad_device::rx_complete(uint8_t data, bool select)
{
if (((data & 0xf0) == 0x70) || ((data & 0xf0) == 0xb0))
{
m_ctrl_probe_history[0] = m_ctrl_probe_history[1];
m_ctrl_probe_history[0] = ((data & 0xf0) == 0x70) ? 0 : m_ctrl_probe_history[1];
m_ctrl_probe_history[1] = data;
uint8_t const response = ((m_ctrl_probe_history[0] + m_ctrl_probe_history[1] + 0x0f) & 0x0f) ^ 0x05;
LOG(

View File

@ -45,7 +45,6 @@ protected:
// device_t implementation
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
// vsmile_ctrl_device_base implementation
virtual void tx_complete() override;

View File

@ -102,7 +102,8 @@ void vsmile_ctrl_port_device::device_start()
if (card)
{
if (!m_device)
{ throw emu_fatalerror(
{
throw emu_fatalerror(
"vsmile_ctrl_port_device: card device %s (%s) does not implement device_vsmile_ctrl_interface\n",
card->tag(),
card->name());
@ -193,7 +194,7 @@ bool vsmile_ctrl_device_base::queue_tx(uint8_t data)
else
{
LOG("asserting RTS to transmit byte %02X\n", data);
m_rts_timer->adjust(attotime::from_msec(100));
m_rts_timer->adjust(attotime::from_msec(500));
}
}
else

View File

@ -32,7 +32,6 @@
#include "softlist.h"
#include "speaker.h"
#define ENABLE_2PADS (0)
class vsmile_base_state : public driver_device
{
@ -111,11 +110,7 @@ private:
VSMILE_PORTC_SYSRESET = 0x80,
};
#if ENABLE_2PADS
required_device_array<vsmile_ctrl_port_device, 2> m_ctrl;
#else
required_device_array<vsmile_ctrl_port_device, 1> m_ctrl;
#endif
required_ioport m_dsw_region;
bool m_ctrl_rts[2];
@ -227,9 +222,7 @@ WRITE8_MEMBER(vsmile_state::uart_rx)
{
//printf("Ctrl Rx: %02x\n", data);
m_ctrl[0]->data_w(data);
#if ENABLE_2PADS
m_ctrl[1]->data_w(data);
#endif
}
READ16_MEMBER(vsmile_state::portb_r)
@ -260,9 +253,7 @@ WRITE16_MEMBER(vsmile_state::portc_w)
{
//printf("Ctrl1 SEL: %d\n", BIT(data, 9));
m_ctrl_select[1] = BIT(data, 9);
#if ENABLE_2PADS
m_ctrl[1]->select_w(m_ctrl_select[1]);
#endif
}
}
@ -439,11 +430,9 @@ void vsmile_state::vsmile(machine_config &config)
m_ctrl[0]->rts_cb().set(FUNC(vsmile_state::ctrl_rts_w<0>));
m_ctrl[0]->data_cb().set(FUNC(vsmile_state::ctrl_tx_w));
#if ENABLE_2PADS
VSMILE_CTRL_PORT(config, m_ctrl[1], vsmile_controllers, nullptr);
m_ctrl[1]->rts_cb().set(FUNC(vsmile_state::ctrl_rts_w<1>));
m_ctrl[1]->data_cb().set(FUNC(vsmile_state::ctrl_tx_w));
#endif
SOFTWARE_LIST(config, "cart_list").set_original("vsmile_cart");
SOFTWARE_LIST(config, "cart_list2").set_original("vsmilem_cart");