summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-02-10 11:42:39 -0500
committer AJR <ajrhacker@users.noreply.github.com>2019-02-10 11:43:42 -0500
commit0a20e27372eac880e83cf717595981988602c396 (patch)
treef4d37b4cb3565692a368d80f9bd5187be636858a
parent2db96447bc789ca51a9133e1b1284d690b3f5c48 (diff)
ay31015: Remove baud clock generation from device emulation (not a built-in UART feature)
-rw-r--r--src/devices/machine/ay31015.cpp70
-rw-r--r--src/devices/machine/ay31015.h20
-rw-r--r--src/mame/drivers/cm1800.cpp7
-rw-r--r--src/mame/drivers/hp2640.cpp13
-rw-r--r--src/mame/drivers/hpz80unk.cpp16
-rw-r--r--src/mame/drivers/micral.cpp8
-rw-r--r--src/mame/drivers/nascom1.cpp7
-rw-r--r--src/mame/drivers/notetaker.cpp13
-rw-r--r--src/mame/drivers/ptcsol.cpp23
-rw-r--r--src/mame/drivers/sapi1.cpp13
-rw-r--r--src/mame/drivers/sorcerer.cpp6
-rw-r--r--src/mame/drivers/trs80.cpp4
-rw-r--r--src/mame/drivers/z80ne.cpp18
-rw-r--r--src/mame/drivers/zms8085.cpp9
-rw-r--r--src/mame/includes/sorcerer.h3
-rw-r--r--src/mame/includes/trs80.h3
-rw-r--r--src/mame/includes/z80ne.h4
-rw-r--r--src/mame/machine/sorcerer.cpp3
-rw-r--r--src/mame/machine/trs80.cpp3
-rw-r--r--src/mame/machine/z80ne.cpp16
20 files changed, 114 insertions, 145 deletions
diff --git a/src/devices/machine/ay31015.cpp b/src/devices/machine/ay31015.cpp
index b9cc6c74a9b..6ab1103b28a 100644
--- a/src/devices/machine/ay31015.cpp
+++ b/src/devices/machine/ay31015.cpp
@@ -116,14 +116,10 @@ ay31015_device::ay31015_device(const machine_config &mconfig, device_type type,
m_rx_bit_count(0),
m_rx_parity(0),
m_rx_pulses(0),
- m_rx_clock(0),
- m_rx_timer(nullptr),
m_tx_data(0),
m_tx_buffer(0),
m_tx_parity(0),
m_tx_pulses(0),
- m_tx_clock(0),
- m_tx_timer(nullptr),
m_read_si_cb(*this),
m_write_so_cb(*this),
m_write_pe_cb(*this),
@@ -173,14 +169,6 @@ void ay31015_device::device_resolve_objects()
void ay31015_device::device_start()
{
- m_rx_timer = timer_alloc(TIMER_RX);
- m_rx_timer->adjust(attotime::never);
- update_rx_timer();
-
- m_tx_timer = timer_alloc(TIMER_TX);
- m_tx_timer->adjust(attotime::never);
- update_tx_timer();
-
save_item(NAME(m_pins));
save_item(NAME(m_control_reg));
save_item(NAME(m_status_reg));
@@ -194,14 +182,12 @@ void ay31015_device::device_start()
save_item(NAME(m_rx_bit_count));
save_item(NAME(m_rx_parity));
save_item(NAME(m_rx_pulses));
- save_item(NAME(m_rx_clock));
save_item(NAME(m_tx_state));
save_item(NAME(m_tx_data));
save_item(NAME(m_tx_buffer));
save_item(NAME(m_tx_parity));
save_item(NAME(m_tx_pulses));
- save_item(NAME(m_tx_clock));
}
//-------------------------------------------------
@@ -270,14 +256,6 @@ void ay31015_device::update_status_pins()
update_status_pin(STATUS_EOC, EOC, m_write_eoc_cb);
}
-void ay31015_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
-{
- if (id == TIMER_RX)
- rx_process();
- else if(id == TIMER_TX)
- tx_process();
-}
-
/*************************************************** RECEIVE CONTROLS *************************************************/
@@ -732,54 +710,6 @@ int ay31015_device::get_output_pin( ay31015_device::output_pin pin )
}
-inline void ay31015_device::update_rx_timer()
-{
- if (m_rx_clock > 0.0)
- {
- m_rx_timer->adjust(attotime::from_hz(m_rx_clock), 0, attotime::from_hz(m_rx_clock));
- }
- else
- {
- m_rx_timer->enable(0);
- }
-}
-
-
-inline void ay31015_device::update_tx_timer()
-{
- if (m_tx_clock > 0.0)
- {
- m_tx_timer->adjust(attotime::from_hz(m_tx_clock), 0, attotime::from_hz(m_tx_clock));
- }
- else
- {
- m_tx_timer->enable(0);
- }
-}
-
-
-/*-------------------------------------------------
- ay31015_set_receiver_clock - set receive clock
--------------------------------------------------*/
-
-void ay31015_device::set_receiver_clock( double new_clock )
-{
- m_rx_clock = new_clock;
- update_rx_timer();
-}
-
-
-/*-------------------------------------------------
- ay31015_set_transmitter_clock - set transmit clock
--------------------------------------------------*/
-
-void ay31015_device::set_transmitter_clock( double new_clock )
-{
- m_tx_clock = new_clock;
- update_tx_timer();
-}
-
-
/*-------------------------------------------------
ay31015_get_received_data - return a byte to the computer
-------------------------------------------------*/
diff --git a/src/devices/machine/ay31015.h b/src/devices/machine/ay31015.h
index 497c6b6a9f9..42518cb9a85 100644
--- a/src/devices/machine/ay31015.h
+++ b/src/devices/machine/ay31015.h
@@ -20,10 +20,6 @@ class ay31015_device : public device_t
public:
ay31015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
- void set_tx_clock(double tx_clock) { m_tx_clock = tx_clock; }
- 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; }
auto read_si_callback() { return m_read_si_cb.bind(); }
@@ -58,12 +54,6 @@ public:
DECLARE_READ_LINE_MEMBER(eoc_r) { return get_output_pin(EOC); }
DECLARE_READ_LINE_MEMBER(so_r) { return get_output_pin(SO); }
- /* Set a new transmitter clock (new_clock is in Hz) */
- void set_transmitter_clock( double new_clock );
-
- /* Set a new receiver clock (new_clock is in Hz) */
- void set_receiver_clock( double new_clock );
-
/* Reead the received data */
/* The received data is available on RD8-RD1 (pins 5-12) */
uint8_t get_received_data();
@@ -114,16 +104,12 @@ protected:
PREP_TIME
};
- static constexpr device_timer_id TIMER_RX = 0;
- static constexpr device_timer_id TIMER_TX = 1;
-
ay31015_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
void rx_process();
void tx_process();
@@ -137,8 +123,6 @@ protected:
void transfer_control_pins();
void set_input_pin(input_pin pin, int data);
int get_output_pin(output_pin pin);
- inline void update_rx_timer();
- inline void update_tx_timer();
int m_pins[41];
@@ -154,16 +138,12 @@ protected:
uint8_t m_rx_bit_count;
uint8_t m_rx_parity;
uint16_t m_rx_pulses; // total pulses left
- double m_rx_clock; /* RCP - pin 17 */
- emu_timer *m_rx_timer;
state_t m_tx_state;
uint8_t m_tx_data; // byte being sent
uint8_t m_tx_buffer; // next byte to send
uint8_t m_tx_parity;
uint16_t m_tx_pulses; // total pulses left
- double m_tx_clock; /* TCP - pin 40 */
- emu_timer *m_tx_timer;
devcb_read_line m_read_si_cb; // SI - pin 20 - This will be called whenever the SI pin is sampled. Optional
devcb_write_line m_write_so_cb; // SO - pin 25 - This will be called whenever data is put on the SO pin. Optional
diff --git a/src/mame/drivers/cm1800.cpp b/src/mame/drivers/cm1800.cpp
index 9307be3cd83..f89a09c66d8 100644
--- a/src/mame/drivers/cm1800.cpp
+++ b/src/mame/drivers/cm1800.cpp
@@ -36,6 +36,7 @@ to be a save command.
#include "emu.h"
#include "cpu/i8085/i8085.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "bus/rs232/rs232.h"
@@ -106,12 +107,14 @@ void cm1800_state::cm1800(machine_config &config)
/* video hardware */
AY51013(config, m_uart); // exact uart type is unknown
- m_uart->set_tx_clock(153600);
- m_uart->set_rx_clock(153600);
m_uart->read_si_callback().set("rs232", FUNC(rs232_port_device::rxd_r));
m_uart->write_so_callback().set("rs232", FUNC(rs232_port_device::write_txd));
m_uart->set_auto_rdav(true);
+ clock_device &uart_clock(CLOCK(config, "uart_clock", 153600));
+ uart_clock.signal_handler().set(m_uart, FUNC(ay31015_device::write_tcp));
+ uart_clock.signal_handler().append(m_uart, FUNC(ay31015_device::write_rcp));
+
RS232_PORT(config, "rs232", default_rs232_devices, "terminal");
}
diff --git a/src/mame/drivers/hp2640.cpp b/src/mame/drivers/hp2640.cpp
index 8f0059cdcc2..8dd8de2d50a 100644
--- a/src/mame/drivers/hp2640.cpp
+++ b/src/mame/drivers/hp2640.cpp
@@ -62,6 +62,7 @@
#include "machine/timer.h"
#include "bus/rs232/rs232.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "sound/beep.h"
#include "emupal.h"
#include "speaker.h"
@@ -170,6 +171,7 @@ private:
required_device<timer_device> m_timer_cursor_blink_inh;
required_device<rs232_port_device> m_rs232;
required_device<ay51013_device> m_uart;
+ required_device<clock_device> m_uart_clock;
required_device<beep_device> m_beep;
required_device<timer_device> m_timer_beep;
@@ -231,6 +233,7 @@ hp2645_state::hp2645_state(const machine_config &mconfig, device_type type, cons
m_timer_cursor_blink_inh(*this , "timer_cursor_blink_inh"),
m_rs232(*this , "rs232"),
m_uart(*this , "uart"),
+ m_uart_clock(*this , "uart_clock"),
m_beep(*this , "beep"),
m_timer_beep(*this , "timer_beep"),
m_chargen(*this , "chargen%u" , 0)
@@ -262,8 +265,7 @@ void hp2645_state::machine_reset()
m_uart->write_cs(1);
m_uart->write_nb2(1);
m_async_control = 0;
- m_uart->set_receiver_clock(0);
- m_uart->set_transmitter_clock(0);
+ m_uart_clock->set_unscaled_clock(0);
update_async_control(0x00);
m_rs232->write_dtr(0);
async_txd_w(0);
@@ -699,8 +701,7 @@ void hp2645_state::update_async_control(uint8_t new_control)
} else {
rxc_txc_freq = SYS_CLOCK.dvalue() / baud_rate_divisors[ new_rate_idx ];
}
- m_uart->set_receiver_clock(rxc_txc_freq);
- m_uart->set_transmitter_clock(rxc_txc_freq);
+ m_uart_clock->set_unscaled_clock(rxc_txc_freq);
m_uart->write_tsb(new_rate_idx == 1);
LOG("ASYNC freq=%f\n" , rxc_txc_freq);
}
@@ -996,6 +997,10 @@ MACHINE_CONFIG_START(hp2645_state::hp2645)
m_uart->write_dav_callback().set(FUNC(hp2645_state::async_dav_w));
m_uart->set_auto_rdav(true);
+ CLOCK(config, m_uart_clock, 19200 * 16);
+ m_uart_clock->signal_handler().set(m_uart, FUNC(ay51013_device::write_rcp));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay51013_device::write_tcp));
+
// Beep
SPEAKER(config, "mono").front_center();
BEEP(config, m_beep, BEEP_FREQUENCY).add_route(ALL_OUTPUTS, "mono", 1.00);
diff --git a/src/mame/drivers/hpz80unk.cpp b/src/mame/drivers/hpz80unk.cpp
index 46e2f9eef9e..20993cd1c09 100644
--- a/src/mame/drivers/hpz80unk.cpp
+++ b/src/mame/drivers/hpz80unk.cpp
@@ -44,6 +44,7 @@ Z nothing
#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "bus/rs232/rs232.h"
@@ -169,30 +170,31 @@ void hpz80unk_state::hpz80unk(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &hpz80unk_state::hpz80unk_mem);
m_maincpu->set_addrmap(AS_IO, &hpz80unk_state::hpz80unk_io);
- /* video hardware */
AY51013(config, m_uart[0]); // COM2502
- m_uart[0]->set_tx_clock(153600);
- m_uart[0]->set_rx_clock(153600);
m_uart[0]->read_si_callback().set("rs232a", FUNC(rs232_port_device::rxd_r));
m_uart[0]->write_so_callback().set("rs232a", FUNC(rs232_port_device::write_txd));
m_uart[0]->set_auto_rdav(true);
RS232_PORT(config, "rs232a", default_rs232_devices, "terminal");
AY51013(config, m_uart[1]); // COM2502
- m_uart[1]->set_tx_clock(153600);
- m_uart[1]->set_rx_clock(153600);
m_uart[1]->read_si_callback().set("rs232b", FUNC(rs232_port_device::rxd_r));
m_uart[1]->write_so_callback().set("rs232b", FUNC(rs232_port_device::write_txd));
m_uart[1]->set_auto_rdav(true);
RS232_PORT(config, "rs232b", default_rs232_devices, nullptr);
AY51013(config, m_uart[2]); // COM2502
- m_uart[2]->set_tx_clock(153600);
- m_uart[2]->set_rx_clock(153600);
m_uart[2]->read_si_callback().set("rs232c", FUNC(rs232_port_device::rxd_r));
m_uart[2]->write_so_callback().set("rs232c", FUNC(rs232_port_device::write_txd));
m_uart[2]->set_auto_rdav(true);
RS232_PORT(config, "rs232c", default_rs232_devices, nullptr);
+
+ clock_device &uart_clock(CLOCK(config, "uart_clock", 153600));
+ uart_clock.signal_handler().set(m_uart[0], FUNC(ay51013_device::write_tcp));
+ uart_clock.signal_handler().append(m_uart[0], FUNC(ay51013_device::write_rcp));
+ uart_clock.signal_handler().append(m_uart[1], FUNC(ay51013_device::write_tcp));
+ uart_clock.signal_handler().append(m_uart[1], FUNC(ay51013_device::write_rcp));
+ uart_clock.signal_handler().append(m_uart[2], FUNC(ay51013_device::write_tcp));
+ uart_clock.signal_handler().append(m_uart[2], FUNC(ay51013_device::write_rcp));
}
/* ROM definition */
diff --git a/src/mame/drivers/micral.cpp b/src/mame/drivers/micral.cpp
index 4cf29f9debb..762fd2067f5 100644
--- a/src/mame/drivers/micral.cpp
+++ b/src/mame/drivers/micral.cpp
@@ -57,6 +57,7 @@ Other things...
#include "screen.h"
#include "speaker.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "bus/rs232/rs232.h"
@@ -410,10 +411,13 @@ MACHINE_CONFIG_START(micral_state::micral)
//MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
AY31015(config, m_uart); // CDP6402
- m_uart->set_tx_clock(153600);
- m_uart->set_rx_clock(153600);
m_uart->read_si_callback().set("rs232", FUNC(rs232_port_device::rxd_r));
m_uart->write_so_callback().set("rs232", FUNC(rs232_port_device::write_txd));
+
+ clock_device &uart_clock(CLOCK(config, "uart_clock", 153600));
+ uart_clock.signal_handler().set(m_uart, FUNC(ay31015_device::write_tcp));
+ uart_clock.signal_handler().append(m_uart, FUNC(ay31015_device::write_rcp));
+
RS232_PORT(config, "rs232", default_rs232_devices, "keyboard");
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/nascom1.cpp b/src/mame/drivers/nascom1.cpp
index 5f34272a69b..27a3e13c8c2 100644
--- a/src/mame/drivers/nascom1.cpp
+++ b/src/mame/drivers/nascom1.cpp
@@ -14,6 +14,7 @@
#include "imagedev/cassette.h"
#include "imagedev/snapquik.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "machine/ram.h"
#include "machine/z80pio.h"
@@ -701,11 +702,13 @@ void nascom_state::nascom(machine_config &config)
// uart
AY31015(config, m_hd6402);
- m_hd6402->set_tx_clock((16_MHz_XTAL / 16) / 256);
- m_hd6402->set_rx_clock((16_MHz_XTAL / 16) / 256);
m_hd6402->read_si_callback().set(FUNC(nascom_state::nascom1_hd6402_si));
m_hd6402->write_so_callback().set(FUNC(nascom_state::nascom1_hd6402_so));
+ clock_device &uart_clock(CLOCK(config, "uart_clock", (16_MHz_XTAL / 16) / 256));
+ uart_clock.signal_handler().set(m_hd6402, FUNC(ay31015_device::write_tcp));
+ uart_clock.signal_handler().append(m_hd6402, FUNC(ay31015_device::write_rcp));
+
// cassette is connected to the uart
CASSETTE(config, m_cassette);
m_cassette->set_interface("nascom_cass");
diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp
index ce4cd30b1e6..31f10ad4638 100644
--- a/src/mame/drivers/notetaker.cpp
+++ b/src/mame/drivers/notetaker.cpp
@@ -104,6 +104,7 @@ DONE:
#include "cpu/i86/i86.h"
#include "imagedev/floppy.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "machine/pic8259.h"
#include "machine/wd_fdc.h"
#include "sound/dac.h"
@@ -847,15 +848,19 @@ MACHINE_CONFIG_START(notetaker_state::notetakr)
m_crtc->set_screen("screen");
AY31015(config, m_kbduart); // HD6402, == AY-3-1015D
- m_kbduart->set_rx_clock(960_kHz_XTAL); // hard-wired to 960KHz xtal #f11 (60000 baud, 16 clocks per baud)
- m_kbduart->set_tx_clock(960_kHz_XTAL); // hard-wired to 960KHz xtal #f11 (60000 baud, 16 clocks per baud)
m_kbduart->write_dav_callback().set(m_iop_pic, FUNC(pic8259_device::ir6_w)); // DataRecvd = KbdInt
+ clock_device &kbdclock(CLOCK(config, "kbdclock", 960_kHz_XTAL)); // hard-wired to 960KHz xtal #f11 (60000 baud, 16 clocks per baud)
+ kbdclock.signal_handler().set(m_kbduart, FUNC(ay31015_device::write_rcp));
+ kbdclock.signal_handler().append(m_kbduart, FUNC(ay31015_device::write_tcp));
+
AY31015(config, m_eiauart); // HD6402, == AY-3-1015D
- m_eiauart->set_rx_clock(((960_kHz_XTAL/10)/4)/5); // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud)
- m_eiauart->set_tx_clock(((960_kHz_XTAL/10)/4)/5); // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud)
m_eiauart->write_dav_callback().set(m_iop_pic, FUNC(pic8259_device::ir3_w)); // EIADataReady = EIAInt
+ clock_device &eiaclock(CLOCK(config, "eiaclock", ((960_kHz_XTAL/10)/4)/5)); // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud)
+ eiaclock.signal_handler().set(m_eiauart, FUNC(ay31015_device::write_rcp));
+ eiaclock.signal_handler().append(m_eiauart, FUNC(ay31015_device::write_tcp));
+
/* Floppy */
FD1791(config, m_fdc, (((24_MHz_XTAL/3)/2)/2)); // 2mhz, from 24mhz ip clock divided by 6 via 8284, an additional 2 by LS161 at #e1 on display/floppy board
FLOPPY_CONNECTOR(config, "wd1791:0", notetaker_floppies, "525dd", floppy_image_device::default_floppy_formats);
diff --git a/src/mame/drivers/ptcsol.cpp b/src/mame/drivers/ptcsol.cpp
index 381e6361a31..750a85a6842 100644
--- a/src/mame/drivers/ptcsol.cpp
+++ b/src/mame/drivers/ptcsol.cpp
@@ -121,6 +121,7 @@
//#include "bus/s100/s100.h"
#include "imagedev/cassette.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "machine/keyboard.h"
#include "sound/spkrdev.h"
#include "sound/wave.h"
@@ -157,6 +158,8 @@ public:
, m_cass2(*this, "cassette2")
, m_uart(*this, "uart")
, m_uart_s(*this, "uart_s")
+ , m_uart_clock(*this, "uart_clock")
+ , m_uart_s_clock(*this, "uart_s_clock")
, m_rs232(*this, "rs232")
, m_p_videoram(*this, "videoram")
, m_p_chargen(*this, "chargen")
@@ -211,6 +214,8 @@ private:
required_device<cassette_image_device> m_cass2;
required_device<ay31015_device> m_uart;
required_device<ay31015_device> m_uart_s;
+ required_device<clock_device> m_uart_clock;
+ required_device<clock_device> m_uart_s_clock;
required_device<rs232_port_device> m_rs232;
required_shared_ptr<uint8_t> m_p_videoram;
required_region_ptr<u8> m_p_chargen;
@@ -420,8 +425,7 @@ WRITE8_MEMBER( sol20_state::sol20_fa_w )
m_cassette_timer->adjust(attotime::zero);
// bit 5 baud rate */
- m_uart->set_receiver_clock((BIT(data, 5)) ? 4800.0 : 19200.0);
- m_uart->set_transmitter_clock((BIT(data, 5)) ? 4800.0 : 19200.0);
+ m_uart_clock->set_unscaled_clock(BIT(data, 5) ? 4800 : 19200);
}
WRITE8_MEMBER( sol20_state::sol20_fd_w )
@@ -613,8 +617,7 @@ void sol20_state::machine_reset()
s_clock = s_bauds[s_count] << 4;
// these lines could be commented out for now if you want better performance
- m_uart_s->set_receiver_clock(s_clock);
- m_uart_s->set_transmitter_clock(s_clock);
+ m_uart_s_clock->set_unscaled_clock(s_clock);
// boot-bank
membank("boot")->set_entry(1);
@@ -769,19 +772,23 @@ void sol20_state::sol20(machine_config &config)
m_cass2->set_interface("sol20_cass");
AY51013(config, m_uart); // TMS6011NC
- m_uart->set_tx_clock(4800.0);
- m_uart->set_rx_clock(4800.0);
m_uart->set_auto_rdav(true); // ROD (pin 4) tied to RDD (pin 18)
+ CLOCK(config, m_uart_clock, 4800);
+ m_uart_clock->signal_handler().set(m_uart, FUNC(ay51013_device::write_rcp));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay51013_device::write_tcp));
+
RS232_PORT(config, m_rs232, default_rs232_devices, nullptr);
AY51013(config, m_uart_s); // TMS6011NC
m_uart_s->read_si_callback().set(m_rs232, FUNC(rs232_port_device::rxd_r));
m_uart_s->write_so_callback().set(m_rs232, FUNC(rs232_port_device::write_txd));
- m_uart_s->set_tx_clock(4800.0);
- m_uart_s->set_rx_clock(4800.0);
m_uart_s->set_auto_rdav(true); // ROD (pin 4) tied to RDD (pin 18)
+ CLOCK(config, m_uart_s_clock, 4800);
+ m_uart_s_clock->signal_handler().set(m_uart_s, FUNC(ay51013_device::write_rcp));
+ m_uart_s_clock->signal_handler().append(m_uart_s, FUNC(ay51013_device::write_tcp));
+
generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0));
keyboard.set_keyboard_callback(FUNC(sol20_state::kbd_put));
diff --git a/src/mame/drivers/sapi1.cpp b/src/mame/drivers/sapi1.cpp
index e837307202e..a1d57466d0c 100644
--- a/src/mame/drivers/sapi1.cpp
+++ b/src/mame/drivers/sapi1.cpp
@@ -37,6 +37,7 @@ ZPS stands for "Základní Počítačová Sestava" (basic computer system).
//#include "cpu/z80/z80.h"
#include "bus/rs232/rs232.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "machine/keyboard.h"
#include "machine/ram.h"
#include "video/mc6845.h"
@@ -57,6 +58,7 @@ public:
m_line4(*this, "LINE4"),
m_maincpu(*this, "maincpu"),
m_uart(*this, "uart"),
+ m_uart_clock(*this, "uart_clock"),
m_v24(*this, "v24"),
m_palette(*this, "palette")
{
@@ -115,6 +117,7 @@ private:
required_ioport m_line4;
required_device<cpu_device> m_maincpu;
optional_device<ay31015_device> m_uart;
+ optional_device<clock_device> m_uart_clock;
optional_device<rs232_port_device> m_v24;
optional_device<palette_device> m_palette;
@@ -625,7 +628,7 @@ void sapi1_state::init_sapizps3b()
/* Machine driver */
MACHINE_CONFIG_START(sapi1_state::sapi1)
/* basic machine hardware */
- MCFG_DEVICE_ADD(m_maincpu, I8080A, XTAL(18'000'000) / 9) // Tesla MHB8080A + MHB8224 + MHB8228
+ MCFG_DEVICE_ADD(m_maincpu, I8080A, 18_MHz_XTAL / 9) // Tesla MHB8080A + MHB8224 + MHB8228
MCFG_DEVICE_PROGRAM_MAP(sapi1_mem)
MCFG_MACHINE_RESET_OVERRIDE(sapi1_state, sapi1)
@@ -696,19 +699,21 @@ DEVICE_INPUT_DEFAULTS_END
MACHINE_CONFIG_START(sapi1_state::sapi3a)
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", I8080A, XTAL(18'000'000) / 9) // Tesla MHB8080A + MHB8224 + MHB8228
+ MCFG_DEVICE_ADD("maincpu", I8080A, 18_MHz_XTAL / 9) // Tesla MHB8080A + MHB8224 + MHB8228
MCFG_DEVICE_PROGRAM_MAP(sapi3a_mem)
MCFG_DEVICE_IO_MAP(sapi3a_io)
MCFG_MACHINE_RESET_OVERRIDE(sapi1_state, sapizps3 )
/* video hardware */
AY51013(config, m_uart); // Tesla MHB1012
- m_uart->set_tx_clock(XTAL(12'288'000) / 80); // not actual rate?
- m_uart->set_rx_clock(XTAL(12'288'000) / 80); // not actual rate?
m_uart->read_si_callback().set(m_v24, FUNC(rs232_port_device::rxd_r));
m_uart->write_so_callback().set(m_v24, FUNC(rs232_port_device::write_txd));
m_uart->set_auto_rdav(true); // RDAV not actually tied to RDE, but pulsed by K155AG3 (=74123N): R25=22k, C14=220
+ CLOCK(config, m_uart_clock, 12.288_MHz_XTAL / 80); // TODO: divider selectable by jumpers
+ m_uart_clock->signal_handler().set(m_uart, FUNC(ay51013_device::write_tcp));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay51013_device::write_rcp));
+
RS232_PORT(config, m_v24, default_rs232_devices, "terminal").set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal));
/* internal ram */
diff --git a/src/mame/drivers/sorcerer.cpp b/src/mame/drivers/sorcerer.cpp
index 8e5040dfb6d..a6f45c26460 100644
--- a/src/mame/drivers/sorcerer.cpp
+++ b/src/mame/drivers/sorcerer.cpp
@@ -430,10 +430,12 @@ MACHINE_CONFIG_START(sorcerer_state::sorcerer)
WAVE(config, "wave2", m_cassette2).add_route(ALL_OUTPUTS, "mono", 0.05); // cass2 speaker
AY31015(config, m_uart);
- m_uart->set_tx_clock(ES_UART_CLOCK);
- m_uart->set_rx_clock(ES_UART_CLOCK);
m_uart->set_auto_rdav(true);
+ CLOCK(config, m_uart_clock, ES_UART_CLOCK);
+ m_uart_clock->signal_handler().set(m_uart, FUNC(ay31015_device::write_tcp));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay31015_device::write_rcp));
+
RS232_PORT(config, "rs232", default_rs232_devices, "null_modem").set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal));
/* printer */
diff --git a/src/mame/drivers/trs80.cpp b/src/mame/drivers/trs80.cpp
index 96a901869df..3a98bb6827b 100644
--- a/src/mame/drivers/trs80.cpp
+++ b/src/mame/drivers/trs80.cpp
@@ -571,7 +571,11 @@ MACHINE_CONFIG_START(trs80_state::sys80)
model1(config);
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_IO_MAP(sys80_io)
+
config.device_remove("brg");
+ CLOCK(config, m_uart_clock, 19200 * 16);
+ m_uart_clock->signal_handler().set(m_uart, FUNC(ay31015_device::write_rcp));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay31015_device::write_tcp));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(trs80_state::ht1080z)
diff --git a/src/mame/drivers/z80ne.cpp b/src/mame/drivers/z80ne.cpp
index 7b36b2eae5b..1f9874fec00 100644
--- a/src/mame/drivers/z80ne.cpp
+++ b/src/mame/drivers/z80ne.cpp
@@ -424,8 +424,10 @@ MACHINE_CONFIG_START(z80ne_state::z80ne)
MCFG_MACHINE_RESET_OVERRIDE(z80ne_state,z80ne)
AY31015(config, m_uart);
- m_uart->set_tx_clock(4800.0);
- m_uart->set_rx_clock(4800.0);
+
+ CLOCK(config, m_uart_clock, 4800);
+ m_uart_clock->signal_handler().set(FUNC(z80ne_state::lx385_uart_tx_clock_w));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay31015_device::write_rcp));
CASSETTE(config, m_cassette1);
m_cassette1->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
@@ -493,8 +495,10 @@ MACHINE_CONFIG_START(z80ne_state::z80netb)
MCFG_MACHINE_RESET_OVERRIDE(z80ne_state,z80netb)
AY31015(config, m_uart);
- m_uart->set_tx_clock(4800.0);
- m_uart->set_rx_clock(4800.0);
+
+ CLOCK(config, m_uart_clock, 4800);
+ m_uart_clock->signal_handler().set(FUNC(z80ne_state::lx385_uart_tx_clock_w));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay31015_device::write_rcp));
CASSETTE(config, m_cassette1);
m_cassette1->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
@@ -543,8 +547,10 @@ MACHINE_CONFIG_START(z80netf_state::z80netf)
MCFG_MACHINE_RESET_OVERRIDE(z80netf_state,z80netf)
AY31015(config, m_uart);
- m_uart->set_tx_clock(4800.0);
- m_uart->set_rx_clock(4800.0);
+
+ CLOCK(config, m_uart_clock, 4800);
+ m_uart_clock->signal_handler().set(FUNC(z80netf_state::lx385_uart_tx_clock_w));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay31015_device::write_rcp));
CASSETTE(config, m_cassette1);
m_cassette1->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
diff --git a/src/mame/drivers/zms8085.cpp b/src/mame/drivers/zms8085.cpp
index a867f448ce9..e0a4b07a621 100644
--- a/src/mame/drivers/zms8085.cpp
+++ b/src/mame/drivers/zms8085.cpp
@@ -17,6 +17,7 @@ hardware, since no schematics or manuals have been found.
#include "cpu/i8085/i8085.h"
#include "bus/rs232/rs232.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "screen.h"
class zms8085_state : public driver_device
@@ -26,6 +27,7 @@ public:
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_uart(*this, "uart")
+ , m_uart_clock(*this, "uart_clock")
, m_rs232(*this, "rs232")
, m_screen(*this, "screen")
, m_mainram(*this, "mainram")
@@ -51,6 +53,7 @@ private:
required_device<cpu_device> m_maincpu;
required_device<ay51013_device> m_uart;
+ required_device<clock_device> m_uart_clock;
required_device<rs232_port_device> m_rs232;
required_device<screen_device> m_screen;
required_shared_ptr<u8> m_mainram;
@@ -335,13 +338,15 @@ void zms8085_state::zephyr(machine_config &config)
screen.screen_vblank().set_inputline(m_maincpu, I8085_RST55_LINE, ASSERT_LINE);
AY51013(config, m_uart); // SMC COM2017
- m_uart->set_tx_clock(153600); // should actually be configurable somehow
- m_uart->set_rx_clock(153600);
m_uart->read_si_callback().set("rs232", FUNC(rs232_port_device::rxd_r));
m_uart->write_so_callback().set("rs232", FUNC(rs232_port_device::write_txd));
m_uart->write_dav_callback().set_inputline("maincpu", I8085_RST65_LINE);
m_uart->set_auto_rdav(true);
+ CLOCK(config, m_uart_clock, 153600); // should actually be configurable somehow
+ m_uart_clock->signal_handler().set(m_uart, FUNC(ay51013_device::write_tcp));
+ m_uart_clock->signal_handler().append(m_uart, FUNC(ay51013_device::write_rcp));
+
RS232_PORT(config, "rs232", default_rs232_devices, nullptr);
}
diff --git a/src/mame/includes/sorcerer.h b/src/mame/includes/sorcerer.h
index 72e55d03b85..87a9fe95b3d 100644
--- a/src/mame/includes/sorcerer.h
+++ b/src/mame/includes/sorcerer.h
@@ -13,6 +13,7 @@
#include "cpu/z80/z80.h"
#include "sound/wave.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "bus/centronics/ctronics.h"
#include "bus/rs232/rs232.h"
#include "machine/ram.h"
@@ -54,6 +55,7 @@ public:
, m_wave1(*this, "wave")
, m_wave2(*this, "wave2")
, m_uart(*this, "uart")
+ , m_uart_clock(*this, "uart_clock")
, m_rs232(*this, "rs232")
, m_centronics(*this, "centronics")
, m_cart(*this, "cartslot")
@@ -122,6 +124,7 @@ private:
required_device<wave_device> m_wave1;
required_device<wave_device> m_wave2;
required_device<ay31015_device> m_uart;
+ required_device<clock_device> m_uart_clock;
required_device<rs232_port_device> m_rs232;
required_device<centronics_device> m_centronics;
required_device<generic_slot_device> m_cart;
diff --git a/src/mame/includes/trs80.h b/src/mame/includes/trs80.h
index 6a4ee33673d..58ce67f4c52 100644
--- a/src/mame/includes/trs80.h
+++ b/src/mame/includes/trs80.h
@@ -14,6 +14,7 @@
#include "imagedev/floppy.h"
#include "imagedev/snapquik.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "machine/com8116.h"
#include "machine/i8255.h"
#include "bus/rs232/rs232.h"
@@ -41,6 +42,7 @@ public:
, m_cent_data_out(*this, "cent_data_out")
, m_cent_status_in(*this, "cent_status_in")
, m_uart(*this, "uart")
+ , m_uart_clock(*this, "uart_clock")
, m_ppi(*this, "ppi") // Radionic only
, m_brg(*this, "brg")
, m_fdc(*this, "fdc")
@@ -135,6 +137,7 @@ private:
optional_device<output_latch_device> m_cent_data_out;
optional_device<input_buffer_device> m_cent_status_in;
optional_device<ay31015_device> m_uart;
+ optional_device<clock_device> m_uart_clock;
optional_device<i8255_device> m_ppi;
optional_device<com8116_device> m_brg;
optional_device<fd1793_device> m_fdc;
diff --git a/src/mame/includes/z80ne.h b/src/mame/includes/z80ne.h
index 5e77718158a..418fda1b6c5 100644
--- a/src/mame/includes/z80ne.h
+++ b/src/mame/includes/z80ne.h
@@ -19,6 +19,7 @@
#include "imagedev/cassette.h"
#include "imagedev/floppy.h"
#include "machine/ay31015.h"
+#include "machine/clock.h"
#include "machine/kr2376.h"
#include "machine/ram.h"
#include "machine/wd_fdc.h"
@@ -69,6 +70,7 @@ public:
m_vdg(*this, "mc6847"),
m_videoram(*this, "videoram"),
m_uart(*this, "uart"),
+ m_uart_clock(*this, "uart_clock"),
m_lx387_kr2376(*this, "lx387_kr2376"),
m_maincpu(*this, "z80ne"),
m_cassette1(*this, "cassette"),
@@ -109,6 +111,7 @@ protected:
optional_device<mc6847_base_device> m_vdg;
optional_shared_ptr<uint8_t> m_videoram;
required_device<ay31015_device> m_uart;
+ required_device<clock_device> m_uart_clock;
optional_device<kr2376_device> m_lx387_kr2376;
uint8_t m_lx383_scan_counter;
uint8_t m_lx383_key[LX383_KEYS];
@@ -121,6 +124,7 @@ protected:
DECLARE_WRITE8_MEMBER(lx383_w);
DECLARE_READ8_MEMBER(lx385_ctrl_r);
DECLARE_WRITE8_MEMBER(lx385_ctrl_w);
+ DECLARE_WRITE_LINE_MEMBER(lx385_uart_tx_clock_w);
DECLARE_READ_LINE_MEMBER(lx387_shift_r);
DECLARE_READ_LINE_MEMBER(lx387_control_r);
DECLARE_READ8_MEMBER(lx387_data_r);
diff --git a/src/mame/machine/sorcerer.cpp b/src/mame/machine/sorcerer.cpp
index 76e5651652b..b6700d76b0d 100644
--- a/src/mame/machine/sorcerer.cpp
+++ b/src/mame/machine/sorcerer.cpp
@@ -272,8 +272,7 @@ WRITE8_MEMBER(sorcerer_state::port_fe_w)
// bit 6 baud rate */
if (BIT(changed_bits, 6))
{
- m_uart->set_receiver_clock(BIT(data, 6) ? ES_UART_CLOCK*4 : ES_UART_CLOCK);
- m_uart->set_transmitter_clock(BIT(data, 6) ? ES_UART_CLOCK*4 : ES_UART_CLOCK);
+ m_uart_clock->set_unscaled_clock(BIT(data, 6) ? ES_UART_CLOCK*4 : ES_UART_CLOCK);
}
}
diff --git a/src/mame/machine/trs80.cpp b/src/mame/machine/trs80.cpp
index 1012bf5d8b7..42a49a0cfcc 100644
--- a/src/mame/machine/trs80.cpp
+++ b/src/mame/machine/trs80.cpp
@@ -357,8 +357,7 @@ void trs80_state::machine_reset()
{
const uint16_t s_bauds[8]={ 110, 300, 600, 1200, 2400, 4800, 9600, 19200 };
u16 s_clock = s_bauds[m_io_baud->read()] << 4;
- m_uart->set_receiver_clock(s_clock);
- m_uart->set_transmitter_clock(s_clock);
+ m_uart_clock->set_unscaled_clock(s_clock);
}
}
diff --git a/src/mame/machine/z80ne.cpp b/src/mame/machine/z80ne.cpp
index 6d1251a69ee..c9e1677e667 100644
--- a/src/mame/machine/z80ne.cpp
+++ b/src/mame/machine/z80ne.cpp
@@ -276,8 +276,7 @@ MACHINE_RESET_MEMBER(z80ne_state,z80ne_base)
m_uart->write_eps(1);
m_uart->write_np(m_io_lx_385->read() & 0x80 ? 1 : 0);
m_uart->write_cs(1);
- m_uart->set_receiver_clock(m_cass_data.speed * 16.0);
- m_uart->set_transmitter_clock(m_cass_data.speed * 16.0);
+ m_uart_clock->set_unscaled_clock(m_cass_data.speed * 16);
lx385_ctrl_w(m_maincpu->space(AS_PROGRAM), 0, 0);
@@ -511,14 +510,13 @@ WRITE8_MEMBER(z80ne_state::lx385_ctrl_w)
* 3 *TAPEA Enable (active low) (at reset: low)
* 4 *TAPEB Enable (active low) (at reset: low)
*/
- uint8_t uart_reset, uart_rdav, uart_tx_clock;
+ uint8_t uart_reset, uart_rdav;
uint8_t motor_a, motor_b;
uint8_t changed_bits = (m_lx385_ctrl ^ data) & 0x1C;
m_lx385_ctrl = data;
uart_reset = ((data & 0x03) == 0x00);
uart_rdav = ((data & 0x03) == 0x01);
- uart_tx_clock = ((data & 0x04) == 0x04);
motor_a = ((data & 0x08) == 0x00);
motor_b = ((data & 0x10) == 0x00);
@@ -537,10 +535,6 @@ WRITE8_MEMBER(z80ne_state::lx385_ctrl_w)
if (!changed_bits) return;
- /* UART Tx Clock enable/disable */
- if (changed_bits & 0x04)
- m_uart->set_transmitter_clock(uart_tx_clock ? m_cass_data.speed * 16.0 : 0.0);
-
/* motors */
if(changed_bits & 0x18)
{
@@ -557,6 +551,12 @@ WRITE8_MEMBER(z80ne_state::lx385_ctrl_w)
}
}
+WRITE_LINE_MEMBER(z80ne_state::lx385_uart_tx_clock_w)
+{
+ if (BIT(m_lx385_ctrl, 2))
+ m_uart->write_tcp(state);
+}
+
READ_LINE_MEMBER(z80ne_state::lx387_shift_r)
{
return BIT(m_io_modifiers->read(), 0) || BIT(m_io_modifiers->read(), 2);