summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess
diff options
context:
space:
mode:
Diffstat (limited to 'src/mess')
-rw-r--r--src/mess/drivers/bullet.c6
-rw-r--r--src/mess/drivers/exp85.c6
-rw-r--r--src/mess/drivers/horizon.c6
-rw-r--r--src/mess/drivers/isbc.c12
-rw-r--r--src/mess/drivers/pipbug.c6
-rw-r--r--src/mess/drivers/sage2.c6
-rw-r--r--src/mess/drivers/sdk86.c6
-rw-r--r--src/mess/drivers/softbox.c6
-rw-r--r--src/mess/drivers/super6.c6
-rw-r--r--src/mess/drivers/superslave.c6
-rw-r--r--src/mess/drivers/xor100.c6
-rw-r--r--src/mess/machine/terminal.c86
-rw-r--r--src/mess/machine/terminal.h11
13 files changed, 101 insertions, 68 deletions
diff --git a/src/mess/drivers/bullet.c b/src/mess/drivers/bullet.c
index 8de35055c4d..3a986cd7158 100644
--- a/src/mess/drivers/bullet.c
+++ b/src/mess/drivers/bullet.c
@@ -1069,8 +1069,10 @@ WRITE_LINE_MEMBER( bulletf_state::req_w )
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x06 ) // 9600
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x00 ) // 8N1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x03 ) // 8
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x00 ) // N
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/exp85.c b/src/mess/drivers/exp85.c
index bb134860a03..07b6351242b 100644
--- a/src/mess/drivers/exp85.c
+++ b/src/mess/drivers/exp85.c
@@ -176,8 +176,10 @@ WRITE_LINE_MEMBER( exp85_state::sod_w )
/* Terminal Interface */
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x06 ) // 9600
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x10 ) // 7E1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x02 ) // 7
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x02 ) // E
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
static const serial_terminal_interface terminal_intf =
diff --git a/src/mess/drivers/horizon.c b/src/mess/drivers/horizon.c
index 91e80cd5d48..cfc352b750b 100644
--- a/src/mess/drivers/horizon.c
+++ b/src/mess/drivers/horizon.c
@@ -130,8 +130,10 @@ static const i8251_interface usart_r_intf =
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x06 ) // 9600
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x00 ) // 8N1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x03 ) // 8
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x00 ) // N
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/isbc.c b/src/mess/drivers/isbc.c
index ba7bc80ef3b..c8e0a0e6a13 100644
--- a/src/mess/drivers/isbc.c
+++ b/src/mess/drivers/isbc.c
@@ -124,13 +124,17 @@ static INPUT_PORTS_START( isbc )
INPUT_PORTS_END
static DEVICE_INPUT_DEFAULTS_START( isbc86_terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x01 ) // 300
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x20 ) // 8N2
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x01 ) // 300
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x03 ) // 8
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x00 ) // N
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x02 ) // 2
DEVICE_INPUT_DEFAULTS_END
static DEVICE_INPUT_DEFAULTS_START( isbc286_terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x06 ) // 9600
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x10 ) // 7E1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x02 ) // 7
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x02 ) // E
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
static const serial_terminal_interface terminal_intf =
diff --git a/src/mess/drivers/pipbug.c b/src/mess/drivers/pipbug.c
index 83f0f066159..a80da377b02 100644
--- a/src/mess/drivers/pipbug.c
+++ b/src/mess/drivers/pipbug.c
@@ -91,8 +91,10 @@ static INPUT_PORTS_START( pipbug )
INPUT_PORTS_END
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x0d ) // 110
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x10 ) // 7E1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x0d ) // 110
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x02 ) // 7
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x02 ) // E
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
static const serial_terminal_interface terminal_intf =
diff --git a/src/mess/drivers/sage2.c b/src/mess/drivers/sage2.c
index 8998446af8e..c9657318bab 100644
--- a/src/mess/drivers/sage2.c
+++ b/src/mess/drivers/sage2.c
@@ -494,8 +494,10 @@ static const centronics_interface centronics_intf =
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x08 ) // 19200
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x10 ) // 7E1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x08 ) // 19200
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x02 ) // 7
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x02 ) // E
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/sdk86.c b/src/mess/drivers/sdk86.c
index 4d5983648da..73bb73858d4 100644
--- a/src/mess/drivers/sdk86.c
+++ b/src/mess/drivers/sdk86.c
@@ -159,8 +159,10 @@ static I8279_INTERFACE( sdk86_intf )
};
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x05 ) // 4800
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x20 ) // 8N2
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x05 ) // 4800
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x03 ) // 8
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x00 ) // N
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x02 ) // 2
DEVICE_INPUT_DEFAULTS_END
static MACHINE_CONFIG_START( sdk86, sdk86_state )
diff --git a/src/mess/drivers/softbox.c b/src/mess/drivers/softbox.c
index 3f41f3aa2f1..894c90481a7 100644
--- a/src/mess/drivers/softbox.c
+++ b/src/mess/drivers/softbox.c
@@ -335,8 +335,10 @@ static I8255A_INTERFACE( ppi1_intf )
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x06 ) // 9600
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x10 ) // 7E1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x02 ) // 7
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x02 ) // E
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/super6.c b/src/mess/drivers/super6.c
index c2ae9498494..3c7d299c2b9 100644
--- a/src/mess/drivers/super6.c
+++ b/src/mess/drivers/super6.c
@@ -497,8 +497,10 @@ static const z80_daisy_config super6_daisy_chain[] =
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x08 ) // 19200
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x00 ) // 8N1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x08 ) // 19200
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x03 ) // 8
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x00 ) // N
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/superslave.c b/src/mess/drivers/superslave.c
index 631ed7c3cd9..93cf6082605 100644
--- a/src/mess/drivers/superslave.c
+++ b/src/mess/drivers/superslave.c
@@ -341,8 +341,10 @@ static Z80PIO_INTERFACE( pio_intf )
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x06 ) // 9600
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x00 ) // 8N1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x03 ) // 8
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x00 ) // N
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/xor100.c b/src/mess/drivers/xor100.c
index c7d6aa7c9c2..ff4df5d7729 100644
--- a/src/mess/drivers/xor100.c
+++ b/src/mess/drivers/xor100.c
@@ -496,8 +496,10 @@ void xor100_state::fdc_drq_w(bool state)
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x0f, 0x06 ) // 9600
- DEVICE_INPUT_DEFAULTS( "TERM_FRAME", 0x30, 0x00 ) // 8N1
+ DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_DATABITS", 0xff, 0x03 ) // 8
+ DEVICE_INPUT_DEFAULTS( "TERM_PARITY", 0xff, 0x00 ) // N
+ DEVICE_INPUT_DEFAULTS( "TERM_STOPBITS", 0xff, 0x00 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/machine/terminal.c b/src/mess/machine/terminal.c
index bceb22f391b..4ffff91cf06 100644
--- a/src/mess/machine/terminal.c
+++ b/src/mess/machine/terminal.c
@@ -138,14 +138,12 @@ static const UINT8 terminal_font[256*16] =
generic_terminal_device::generic_terminal_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- m_io_term_frame(*this, "TERM_FRAME"),
m_io_term_conf(*this, "TERM_CONF")
{
}
generic_terminal_device::generic_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, GENERIC_TERMINAL, "Generic Terminal", tag, owner, clock, "generic_terminal", __FILE__),
- m_io_term_frame(*this, "TERM_FRAME"),
m_io_term_conf(*this, "TERM_CONF")
{
}
@@ -328,7 +326,6 @@ machine_config_constructor generic_terminal_device::device_mconfig_additions() c
void generic_terminal_device::device_start()
{
m_keyboard_func.resolve(m_keyboard_cb, *this);
- m_timer = timer_alloc();
}
void generic_terminal_device::device_config_complete()
@@ -416,8 +413,8 @@ const device_type GENERIC_TERMINAL = &device_creator<generic_terminal_device>;
static INPUT_PORTS_START(serial_terminal)
PORT_INCLUDE(generic_terminal)
- PORT_START("TERM_FRAME")
- PORT_CONFNAME(0x0f, 0x06, "Baud") PORT_CHANGED_MEMBER(DEVICE_SELF, serial_terminal_device, update_frame, 0)
+ PORT_START("TERM_BAUD")
+ PORT_CONFNAME(0xff, 0x06, "Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_terminal_device, update_serial)
PORT_CONFSETTING( 0x0d, "110")
PORT_CONFSETTING( 0x00, "150")
PORT_CONFSETTING( 0x01, "300")
@@ -432,11 +429,28 @@ static INPUT_PORTS_START(serial_terminal)
PORT_CONFSETTING( 0x0a, "38400")
PORT_CONFSETTING( 0x0b, "57600")
PORT_CONFSETTING( 0x0c, "115200")
- PORT_CONFNAME(0x30, 0x00, "Format") PORT_CHANGED_MEMBER(DEVICE_SELF, serial_terminal_device, update_frame, 0)
- PORT_CONFSETTING( 0x00, "8N1")
- PORT_CONFSETTING( 0x10, "7E1")
- PORT_CONFSETTING( 0x20, "8N2")
- PORT_CONFSETTING( 0x30, "8E1")
+
+ PORT_START("TERM_DATABITS")
+ PORT_CONFNAME(0xff, 0x03, "Data Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_terminal_device, update_serial)
+ PORT_CONFSETTING( 0x00, "5")
+ PORT_CONFSETTING( 0x01, "6")
+ PORT_CONFSETTING( 0x02, "7")
+ PORT_CONFSETTING( 0x03, "8")
+ PORT_CONFSETTING( 0x04, "9")
+
+ PORT_START("TERM_PARITY")
+ PORT_CONFNAME(0xff, 0x00, "Parity") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_terminal_device, update_serial)
+ PORT_CONFSETTING( 0x00, "None")
+ PORT_CONFSETTING( 0x01, "Odd")
+ PORT_CONFSETTING( 0x02, "Even")
+ PORT_CONFSETTING( 0x03, "Mark")
+ PORT_CONFSETTING( 0x04, "Space")
+
+ PORT_START("TERM_STOPBITS")
+ PORT_CONFNAME(0xff, 0x00, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_terminal_device, update_serial)
+ PORT_CONFSETTING( 0x00, "1")
+// PORT_CONFSETTING( 0x01, "1.5")
+ PORT_CONFSETTING( 0x02, "2")
INPUT_PORTS_END
ioport_constructor serial_terminal_device::device_input_ports() const
@@ -447,7 +461,11 @@ ioport_constructor serial_terminal_device::device_input_ports() const
serial_terminal_device::serial_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: generic_terminal_device(mconfig, SERIAL_TERMINAL, "Serial Terminal", tag, owner, clock, "serial_terminal", __FILE__),
device_serial_interface(mconfig, *this),
- device_serial_port_interface(mconfig, *this)
+ device_serial_port_interface(mconfig, *this),
+ m_io_term_baud(*this, "TERM_BAUD"),
+ m_io_term_databits(*this, "TERM_DATABITS"),
+ m_io_term_parity(*this, "TERM_PARITY"),
+ m_io_term_stopbits(*this, "TERM_STOPBITS")
{
}
@@ -464,55 +482,41 @@ void serial_terminal_device::device_config_complete()
}
}
-static int rates[] = {150, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 110};
-
void serial_terminal_device::device_start()
{
- int baud = clock();
- if(!baud) baud = 9600;
m_owner = dynamic_cast<serial_port_device *>(owner());
m_out_tx_func.resolve(m_out_tx_cb, *this);
m_slot = m_owner && 1;
- m_timer = timer_alloc();
- set_rcv_rate(baud);
- set_tra_rate(baud);
- set_data_frame(8, 1, PARITY_NONE, false);
}
-INPUT_CHANGED_MEMBER(serial_terminal_device::update_frame)
+static int m_baud[] = {150, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 110};
+static int m_databits[] = {5, 6, 7, 8, 9};
+static int m_parity[] = { device_serial_interface::PARITY_NONE, device_serial_interface::PARITY_ODD, device_serial_interface::PARITY_EVEN, device_serial_interface::PARITY_MARK, device_serial_interface::PARITY_SPACE };
+static int m_stopbits[] = {1, 2, 2}; // diserial doesn't support 1.5 bits
+
+WRITE_LINE_MEMBER(serial_terminal_device::update_serial)
{
- device_reset();
+ UINT8 baud = m_io_term_baud->read();
+ UINT8 databits = m_io_term_databits->read();
+ UINT8 parity = m_io_term_parity->read();
+ UINT8 stopbits = m_io_term_stopbits->read();
+
+ set_tra_rate(m_baud[baud]);
+ set_rcv_rate(m_baud[baud]);
+ set_data_frame(m_databits[databits], m_parity[parity], m_stopbits[stopbits], false);
}
void serial_terminal_device::device_reset()
{
generic_terminal_device::device_reset();
+
m_rbit = 1;
if(m_slot)
m_owner->out_rx(m_rbit);
else
m_out_tx_func(m_rbit);
- UINT8 val = m_io_term_frame->read();
- set_tra_rate(rates[val & 0x0f]);
- set_rcv_rate(rates[val & 0x0f]);
-
- switch(val & 0x30)
- {
- case 0x10:
- set_data_frame(7, 1, PARITY_EVEN, false);
- break;
- case 0x00:
- default:
- set_data_frame(8, 1, PARITY_NONE, false);
- break;
- case 0x20:
- set_data_frame(8, 2, PARITY_NONE, false);
- break;
- case 0x30:
- set_data_frame(8, 1, PARITY_EVEN, false);
- break;
- }
+ update_serial(0);
}
void serial_terminal_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
diff --git a/src/mess/machine/terminal.h b/src/mess/machine/terminal.h
index 43a3bf1a41f..1ebfda3a454 100644
--- a/src/mess/machine/terminal.h
+++ b/src/mess/machine/terminal.h
@@ -60,7 +60,6 @@ public:
virtual ioport_constructor device_input_ports() const;
virtual machine_config_constructor device_mconfig_additions() const;
protected:
- optional_ioport m_io_term_frame;
required_ioport m_io_term_conf;
virtual void term_write(UINT8 data);
@@ -70,7 +69,6 @@ protected:
virtual void send_key(UINT8 code) { m_keyboard_func(0, code); }
UINT8 m_buffer[TERMINAL_WIDTH*50]; // make big enough for teleprinter
UINT8 m_x_pos;
- emu_timer *m_timer;
private:
void scroll_line();
void write_char(UINT8 data);
@@ -98,7 +96,8 @@ public:
virtual void tx(UINT8 state) { rx_w(state); }
virtual ioport_constructor device_input_ports() const;
- DECLARE_INPUT_CHANGED_MEMBER(update_frame);
+ DECLARE_WRITE_LINE_MEMBER(update_serial);
+
protected:
virtual void device_start();
virtual void device_config_complete();
@@ -109,7 +108,13 @@ protected:
virtual void rcv_complete();
virtual void input_callback(UINT8 state) { m_input_state = state; }
virtual void send_key(UINT8 code);
+
private:
+ required_ioport m_io_term_baud;
+ required_ioport m_io_term_databits;
+ required_ioport m_io_term_parity;
+ required_ioport m_io_term_stopbits;
+
serial_port_device *m_owner;
bool m_slot;
UINT8 m_curr_key;