ay31015: Add READ8 and WRITE8 handlers to be placed in memory maps; allow reads to reset DAV automatically (nw)

This commit is contained in:
AJR 2018-03-04 17:57:49 -05:00
parent b3671d5a53
commit 9639e3aa06
4 changed files with 37 additions and 36 deletions

View File

@ -129,7 +129,8 @@ ay31015_device::ay31015_device(const machine_config &mconfig, device_type type,
m_write_or_cb(*this),
m_write_dav_cb(*this),
m_write_tbmt_cb(*this),
m_write_eoc_cb(*this)
m_write_eoc_cb(*this),
m_auto_rdav(false)
{
for (auto & elem : m_pins)
elem = 0;
@ -656,7 +657,7 @@ void ay31015_device::set_input_pin( ay31015_device::input_pin pin, int data )
if (!data)
{
m_status_reg &= ~STATUS_DAV;
m_pins[DAV] = 0;
update_status_pins();
}
break;
case SI:
@ -745,9 +746,20 @@ void ay31015_device::set_transmitter_clock( double new_clock )
uint8_t ay31015_device::get_received_data()
{
if (m_auto_rdav && !machine().side_effects_disabled())
{
m_status_reg &= ~STATUS_DAV;
update_status_pins();
}
return m_rx_buffer;
}
READ8_MEMBER(ay31015_device::receive)
{
return get_received_data();
}
/*-------------------------------------------------
ay31015_set_transmit_data - accept a byte to transmit, if able
@ -761,3 +773,8 @@ void ay31015_device::set_transmit_data( uint8_t data )
update_status_pins();
}
}
WRITE8_MEMBER(ay31015_device::transmit)
{
set_transmit_data(data);
}

View File

@ -24,6 +24,7 @@ public:
void set_tx_clock(const XTAL &xtal) { set_tx_clock(xtal.dvalue()); }
void set_rx_clock(double rx_clock) { m_rx_clock = rx_clock; }
void set_rx_clock(const XTAL &xtal) { set_rx_clock(xtal.dvalue()); }
void set_auto_rdav(bool auto_rdav) { m_auto_rdav = auto_rdav; }
template <class Object> devcb_base &set_read_si_callback(Object &&cb) { return m_read_si_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_write_so_callback(Object &&cb) { return m_write_so_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_write_pe_callback(Object &&cb) { return m_write_pe_cb.set_callback(std::forward<Object>(cb)); }
@ -70,6 +71,9 @@ public:
/* The data to transmit is set on DB1-DB8 (pins 26-33) */
void set_transmit_data( uint8_t data );
DECLARE_READ8_MEMBER(receive);
DECLARE_WRITE8_MEMBER(transmit);
void rx_process();
void tx_process();
@ -168,6 +172,8 @@ protected:
devcb_write_line m_write_dav_cb; // DAV - pin 19 - This will be called whenever the DAV pin may have changed. Optional
devcb_write_line m_write_tbmt_cb; // TBMT - pin 22 - This will be called whenever the TBMT pin may have changed. Optional
devcb_write_line m_write_eoc_cb; // EOC - pin 24 - This will be called whenever the EOC pin may have changed. Optional
bool m_auto_rdav; // true if RDAV (pin 18) is tied to RDE (pin 4)
};
class ay51013_device : public ay31015_device
@ -198,6 +204,9 @@ DECLARE_DEVICE_TYPE(AY51013, ay51013_device) // For AY-3-1014, AY-5-1013 and A
#define MCFG_AY31015_RX_CLOCK(_rxclk) \
downcast<ay31015_device &>(*device).set_rx_clock(_rxclk);
#define MCFG_AY31015_AUTO_RDAV(_auto_rdav) \
downcast<ay31015_device &>(*device).set_auto_rdav(_auto_rdav);
#define MCFG_AY31015_READ_SI_CB(_devcb) \
devcb = &downcast<ay31015_device &>(*device).set_read_si_callback(DEVCB_##_devcb);
@ -229,6 +238,9 @@ DECLARE_DEVICE_TYPE(AY51013, ay51013_device) // For AY-3-1014, AY-5-1013 and A
#define MCFG_AY51013_RX_CLOCK(_rxclk) \
downcast<ay51013_device &>(*device).set_rx_clock(_rxclk);
#define MCFG_AY51013_AUTO_RDAV(_auto_rdav) \
downcast<ay51013_device &>(*device).set_auto_rdav(_auto_rdav);
#define MCFG_AY51013_READ_SI_CB(_devcb) \
devcb = &downcast<ay51013_device &>(*device).set_read_si_callback(DEVCB_##_devcb);

View File

@ -43,8 +43,6 @@ public:
DECLARE_READ8_MEMBER(read_5841);
DECLARE_WRITE8_MEMBER(write_5841);
DECLARE_READ8_MEMBER(read_5842);
DECLARE_WRITE8_MEMBER(write_5842);
DECLARE_READ8_MEMBER(read_5843);
DECLARE_WRITE8_MEMBER(write_5843);
DECLARE_READ8_MEMBER(read_5846);
DECLARE_READ8_MEMBER(read_5847);
@ -112,19 +110,6 @@ READ8_MEMBER(ampex_state::read_5842)
return 0;
}
WRITE8_MEMBER(ampex_state::write_5842)
{
m_uart->set_transmit_data(data);
}
READ8_MEMBER(ampex_state::read_5843)
{
m_uart->write_rdav(0);
u8 data = m_uart->get_received_data();
m_uart->write_rdav(1);
return data;
}
WRITE8_MEMBER(ampex_state::write_5843)
{
logerror("%s: Write %02X to 5843\n", machine().describe_context(), data);
@ -178,8 +163,8 @@ ADDRESS_MAP_START(ampex_state::mem_map)
AM_RANGE(0x4400, 0x57ff) AM_RAM // expansion RAM
AM_RANGE(0x5840, 0x5840) AM_READWRITE(read_5840, write_5840)
AM_RANGE(0x5841, 0x5841) AM_READWRITE(read_5841, write_5841)
AM_RANGE(0x5842, 0x5842) AM_READWRITE(read_5842, write_5842)
AM_RANGE(0x5843, 0x5843) AM_READWRITE(read_5843, write_5843)
AM_RANGE(0x5842, 0x5842) AM_READ(read_5842) AM_DEVWRITE("uart", ay31015_device, transmit)
AM_RANGE(0x5843, 0x5843) AM_DEVREAD("uart", ay31015_device, receive) AM_WRITE(write_5843)
AM_RANGE(0x5846, 0x5846) AM_READ(read_5846)
AM_RANGE(0x5847, 0x5847) AM_READ(read_5847)
AM_RANGE(0x5c00, 0x5c0f) AM_DEVREADWRITE("vtac", crt5037_device, read, write)
@ -235,6 +220,7 @@ MACHINE_CONFIG_START(ampex_state::ampex)
MCFG_DEVICE_ADD("uart", AY31015, 0) // COM8017, actually
MCFG_AY31015_WRITE_SO_CB(WRITELINE(ampex_state, so_w))
MCFG_AY31015_WRITE_DAV_CB(WRITELINE(ampex_state, dav_w))
MCFG_AY31015_AUTO_RDAV(true)
MCFG_DEVICE_ADD("dbrg", COM5016_5, XTAL(4'915'200))
MCFG_COM8116_FR_HANDLER(DEVWRITELINE("uart", ay31015_device, write_rcp))

View File

@ -97,8 +97,6 @@ public:
DECLARE_READ8_MEMBER(crtc_r);
DECLARE_WRITE8_MEMBER(crtc_w);
DECLARE_READ8_MEMBER(uart_status_r);
DECLARE_READ8_MEMBER(uart_data_r);
DECLARE_WRITE8_MEMBER(uart_data_w);
DECLARE_READ8_MEMBER(keyboard_r);
DECLARE_WRITE8_MEMBER(output_40c);
@ -214,19 +212,6 @@ READ8_MEMBER(tv912_state::uart_status_r)
return status;
}
READ8_MEMBER(tv912_state::uart_data_r)
{
m_uart->write_rdav(0);
u8 data = m_uart->get_received_data();
m_uart->write_rdav(1);
return data;
}
WRITE8_MEMBER(tv912_state::uart_data_w)
{
m_uart->set_transmit_data(data);
}
WRITE8_MEMBER(tv912_state::output_40c)
{
// DB6: -PRTOL
@ -378,9 +363,9 @@ ADDRESS_MAP_END
ADDRESS_MAP_START(tv912_state::bank_map)
AM_RANGE(0x000, 0x0ff) AM_MIRROR(0x300) AM_RAM
AM_RANGE(0x400, 0x403) AM_MIRROR(0x3c0) AM_SELECT(0x030) AM_READWRITE(crtc_r, crtc_w)
AM_RANGE(0x404, 0x404) AM_MIRROR(0x3f3) AM_READ(uart_data_r)
AM_RANGE(0x404, 0x404) AM_MIRROR(0x3f3) AM_DEVREAD("uart", ay51013_device, receive)
AM_RANGE(0x408, 0x40b) AM_MIRROR(0x3f0) AM_READ(uart_status_r)
AM_RANGE(0x408, 0x408) AM_MIRROR(0x3f3) AM_WRITE(uart_data_w)
AM_RANGE(0x408, 0x408) AM_MIRROR(0x3f3) AM_DEVWRITE("uart", ay51013_device, transmit)
AM_RANGE(0x40c, 0x40f) AM_MIRROR(0x3f0) AM_READ(keyboard_r)
AM_RANGE(0x40c, 0x40c) AM_MIRROR(0x3f3) AM_WRITE(output_40c)
AM_RANGE(0x800, 0xfff) AM_RAMBANK("dispram")
@ -911,6 +896,7 @@ MACHINE_CONFIG_START(tv912_state::tv912)
MCFG_DEVICE_ADD("uart", AY51013, 0)
MCFG_AY51013_READ_SI_CB(DEVREADLINE("rs232", rs232_port_device, rxd_r))
MCFG_AY51013_WRITE_SO_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd))
MCFG_AY51013_AUTO_RDAV(true)
MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "loopback")