mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
bus/rs232: Add generic Radio Shack printer option (generates break condition when online). (#7652)
This commit is contained in:
parent
d28aa01821
commit
4214093a92
@ -1,12 +1,30 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:smf
|
||||
|
||||
/**************************************************************************
|
||||
|
||||
Simple printer emulation
|
||||
|
||||
This allows capturing the byte stream to a file.
|
||||
|
||||
Radio Shack printers differ in that the RX line is used as a
|
||||
busy signal.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "printer.h"
|
||||
|
||||
serial_printer_device::serial_printer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SERIAL_PRINTER, tag, owner, clock),
|
||||
: serial_printer_device(mconfig, SERIAL_PRINTER, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
serial_printer_device::serial_printer_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, type, tag, owner, clock),
|
||||
device_serial_interface(mconfig, *this),
|
||||
device_rs232_port_interface(mconfig, *this),
|
||||
m_initial_rx_state(1),
|
||||
m_printer(*this, "printer"),
|
||||
m_rs232_rxbaud(*this, "RS232_RXBAUD"),
|
||||
m_rs232_startbits(*this, "RS232_STARTBITS"),
|
||||
@ -52,7 +70,7 @@ WRITE_LINE_MEMBER(serial_printer_device::update_serial)
|
||||
set_rcv_rate(rxbaud);
|
||||
|
||||
// TODO: make this configurable
|
||||
output_rxd(1);
|
||||
output_rxd(m_initial_rx_state);
|
||||
output_dcd(0);
|
||||
output_dsr(0);
|
||||
output_cts(0);
|
||||
@ -74,4 +92,11 @@ void serial_printer_device::rcv_complete()
|
||||
m_printer->output(get_received_char());
|
||||
}
|
||||
|
||||
radio_shack_serial_printer_device::radio_shack_serial_printer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: serial_printer_device(mconfig, RADIO_SHACK_SERIAL_PRINTER, tag, owner, clock)
|
||||
{
|
||||
m_initial_rx_state = 0;
|
||||
}
|
||||
|
||||
DEFINE_DEVICE_TYPE(SERIAL_PRINTER, serial_printer_device, "serial_printer", "Serial Printer")
|
||||
DEFINE_DEVICE_TYPE(RADIO_SHACK_SERIAL_PRINTER, radio_shack_serial_printer_device, "rs_serial_printer", "Radio Shack Serial Printer")
|
||||
|
@ -21,12 +21,14 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER(update_serial);
|
||||
|
||||
protected:
|
||||
serial_printer_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void rcv_complete() override;
|
||||
int m_initial_rx_state;
|
||||
|
||||
private:
|
||||
DECLARE_WRITE_LINE_MEMBER(printer_online);
|
||||
@ -40,6 +42,13 @@ private:
|
||||
required_ioport m_rs232_stopbits;
|
||||
};
|
||||
|
||||
class radio_shack_serial_printer_device : public serial_printer_device
|
||||
{
|
||||
public:
|
||||
radio_shack_serial_printer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(SERIAL_PRINTER, serial_printer_device)
|
||||
DECLARE_DEVICE_TYPE(RADIO_SHACK_SERIAL_PRINTER, radio_shack_serial_printer_device)
|
||||
|
||||
#endif // MAME_BUS_RS232_PRINTER_H
|
||||
|
@ -174,14 +174,15 @@ device_rs232_port_interface::~device_rs232_port_interface()
|
||||
|
||||
void default_rs232_devices(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("dec_loopback", DEC_RS232_LOOPBACK);
|
||||
device.option_add("ie15", SERIAL_TERMINAL_IE15);
|
||||
device.option_add("keyboard", SERIAL_KEYBOARD);
|
||||
device.option_add("loopback", RS232_LOOPBACK);
|
||||
device.option_add("dec_loopback", DEC_RS232_LOOPBACK);
|
||||
device.option_add("null_modem", NULL_MODEM);
|
||||
device.option_add("printer", SERIAL_PRINTER);
|
||||
device.option_add("terminal", SERIAL_TERMINAL);
|
||||
device.option_add("pty", PSEUDO_TERMINAL);
|
||||
device.option_add("rs_printer", RADIO_SHACK_SERIAL_PRINTER);
|
||||
device.option_add("sunkbd", SUN_KBD_ADAPTOR);
|
||||
device.option_add("ie15", SERIAL_TERMINAL_IE15);
|
||||
device.option_add("swtpc8212", SERIAL_TERMINAL_SWTPC8212);
|
||||
device.option_add("terminal", SERIAL_TERMINAL);
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ void coco_state::coco_floating(machine_config &config)
|
||||
// DEVICE_INPUT_DEFAULTS_START( printer )
|
||||
//-------------------------------------------------
|
||||
|
||||
static DEVICE_INPUT_DEFAULTS_START( printer )
|
||||
static DEVICE_INPUT_DEFAULTS_START( rs_printer )
|
||||
DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_600 )
|
||||
DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 )
|
||||
DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 )
|
||||
@ -509,9 +509,9 @@ void coco12_state::coco(machine_config &config)
|
||||
m_cassette->set_formats(coco_cassette_formats);
|
||||
m_cassette->set_default_state(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
|
||||
|
||||
rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, "printer"));
|
||||
rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, "rs_printer"));
|
||||
rs232.dcd_handler().set(PIA1_TAG, FUNC(pia6821_device::ca1_w));
|
||||
rs232.set_option_device_input_defaults("printer", DEVICE_INPUT_DEFAULTS_NAME(printer));
|
||||
rs232.set_option_device_input_defaults("rs_printer", DEVICE_INPUT_DEFAULTS_NAME(rs_printer));
|
||||
|
||||
cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "pak"));
|
||||
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
|
||||
|
@ -239,7 +239,7 @@ static INPUT_PORTS_START( coco3dw )
|
||||
PORT_INCLUDE( coco_beckerport_dw )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static DEVICE_INPUT_DEFAULTS_START( printer )
|
||||
static DEVICE_INPUT_DEFAULTS_START( rs_printer )
|
||||
DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_600 )
|
||||
DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 )
|
||||
DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 )
|
||||
@ -293,9 +293,9 @@ void coco3_state::coco3(machine_config &config)
|
||||
m_cassette->set_formats(coco_cassette_formats);
|
||||
m_cassette->set_default_state(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED);
|
||||
|
||||
rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, "printer"));
|
||||
rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, "rs_printer"));
|
||||
rs232.dcd_handler().set(PIA1_TAG, FUNC(pia6821_device::ca1_w));
|
||||
rs232.set_option_device_input_defaults("printer", DEVICE_INPUT_DEFAULTS_NAME(printer));
|
||||
rs232.set_option_device_input_defaults("rs_printer", DEVICE_INPUT_DEFAULTS_NAME(rs_printer));
|
||||
|
||||
cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "fdcv11"));
|
||||
cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded
|
||||
|
Loading…
Reference in New Issue
Block a user