summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author smf- <smf-@users.noreply.github.com>2014-01-13 11:20:45 +0000
committer smf- <smf-@users.noreply.github.com>2014-01-13 11:20:45 +0000
commit61424105fbd4e5f3604921edeacb588565c8a1e4 (patch)
tree74c927345759961ef88d76f77366d8cac6991a31
parenta1b3437fc42bd2260707f09813a8d788381ae702 (diff)
Changed parity & stop bits to an enum (you can now pass in 1.5). I've updated the uarts that were testing for 1.5 stop bits to pass that in, but there are probably others & 1.5 stop bits is converted to 2 by diserial. However the 68681 requires stop bits to be specified in clocks, so this will change in the future. Replaced synchronous flag with start bit count, as some uarts can use a start bit in synchronous mode & that whether there is a start bit is all the flag is currently controlling. Updated rs232 terminal to allow startbits, stop bits 1.5 to be specified (although that is currently not supported by diserial) and individual transmit and receive baud rates. [smf]
-rw-r--r--src/emu/bus/ieee488/softbox.c6
-rw-r--r--src/emu/bus/s100/wunderbus.c6
-rw-r--r--src/emu/diserial.c118
-rw-r--r--src/emu/diserial.h20
-rw-r--r--src/emu/imagedev/midiin.c2
-rw-r--r--src/emu/imagedev/midiout.c2
-rw-r--r--src/emu/imagedev/serial.c4
-rw-r--r--src/emu/imagedev/serial.h4
-rw-r--r--src/emu/machine/i8251.c75
-rw-r--r--src/emu/machine/im6402.c14
-rw-r--r--src/emu/machine/ins8250.c32
-rw-r--r--src/emu/machine/mc2661.c45
-rw-r--r--src/emu/machine/mc68901.c57
-rw-r--r--src/emu/machine/mc68901.h3
-rw-r--r--src/emu/machine/microtch.c2
-rw-r--r--src/emu/machine/mos6551.c18
-rw-r--r--src/emu/machine/n68681.c38
-rw-r--r--src/emu/machine/z80dart.c28
-rw-r--r--src/emu/machine/z80dart.h2
-rw-r--r--src/mame/machine/midikbd.c2
-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/mc1502.c2
-rw-r--r--src/mess/drivers/pipbug.c6
-rw-r--r--src/mess/drivers/pulsar.c6
-rw-r--r--src/mess/drivers/px4.c10
-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/thomson.c6
-rw-r--r--src/mess/drivers/xor100.c6
-rw-r--r--src/mess/machine/dec_lk201.c4
-rw-r--r--src/mess/machine/esqpanel.c2
-rw-r--r--src/mess/machine/isa_sblaster.c2
-rw-r--r--src/mess/machine/keyboard.c10
-rw-r--r--src/mess/machine/ser_mouse.h4
-rw-r--r--src/mess/machine/terminal.c62
-rw-r--r--src/mess/machine/terminal.h4
-rw-r--r--src/mess/machine/wangpckb.c2
-rw-r--r--src/mess/machine/zx8302.c2
44 files changed, 408 insertions, 258 deletions
diff --git a/src/emu/bus/ieee488/softbox.c b/src/emu/bus/ieee488/softbox.c
index 19e6b969075..475dba99d82 100644
--- a/src/emu/bus/ieee488/softbox.c
+++ b/src/emu/bus/ieee488/softbox.c
@@ -256,10 +256,12 @@ static I8255A_INTERFACE( ppi1_intf )
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/emu/bus/s100/wunderbus.c b/src/emu/bus/s100/wunderbus.c
index d16771d9d09..e28f87fbbed 100644
--- a/src/emu/bus/s100/wunderbus.c
+++ b/src/emu/bus/s100/wunderbus.c
@@ -106,10 +106,12 @@ static ins8250_interface ace3_intf =
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x0d ) // 110
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x0d ) // 110
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x0d ) // 110
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x03 ) // 2
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/emu/diserial.c b/src/emu/diserial.c
index 183e159689c..a2e32002ed5 100644
--- a/src/emu/diserial.c
+++ b/src/emu/diserial.c
@@ -21,7 +21,25 @@ start of start bit. This is used to synchronise with the data being transfered *
device_serial_interface::device_serial_interface(const machine_config &mconfig, device_t &device)
: device_interface(device),
- m_other_connection(NULL)
+ m_input_state(0),
+ m_connection_state(0),
+ m_start_bit_hack_for_external_clocks(false),
+ m_df_start_bit_count(0),
+ m_df_word_length(0),
+ m_df_parity(PARITY_NONE),
+ m_df_stop_bit_count(STOP_BITS_0),
+ m_rcv_register_data(0x8000),
+ m_rcv_flags(0),
+ m_rcv_bit_count(0),
+ m_tra_flags(TRANSMIT_REGISTER_EMPTY),
+ m_rcv_clock(NULL),
+ m_tra_clock(NULL),
+ m_rcv_rate(attotime::never),
+ m_tra_rate(attotime::never),
+ m_rcv_line(0),
+ m_tra_clock_state(false),
+ m_rcv_clock_state(false),
+ m_other_connection(NULL)
{
/* if sum of all bits in the byte is even, then the data
has even parity, otherwise it has odd parity */
@@ -38,21 +56,6 @@ device_serial_interface::device_serial_interface(const machine_config &mconfig,
m_serial_parity_table[i] = sum & 0x01;
}
- m_rcv_clock = NULL;
- m_tra_clock = NULL;
- m_rcv_clock_state = false;
- m_tra_clock_state = false;
- m_tra_rate = attotime::never;
- m_rcv_rate = attotime::never;
- m_tra_flags = TRANSMIT_REGISTER_EMPTY;
- m_rcv_register_data = 0x8000;
- m_rcv_bit_count = 0;
- m_connection_state = 0;
- m_rcv_flags = 0;
- m_input_state = 0;
- m_rcv_line = 0;
- m_start_bit_hack_for_external_clocks = false;
- m_synchronous = false;
}
device_serial_interface::~device_serial_interface()
@@ -139,12 +142,32 @@ void device_serial_interface::device_timer(emu_timer &timer, device_timer_id id,
}
-void device_serial_interface::set_data_frame(int num_data_bits, int stop_bit_count, int parity_code, bool synchronous)
+void device_serial_interface::set_data_frame(int start_bit_count, int data_bit_count, parity_t parity, stop_bits_t stop_bits)
{
- m_df_word_length = num_data_bits;
- m_df_stop_bit_count = stop_bit_count;
- m_df_parity = parity_code;
- m_synchronous = synchronous;
+ m_df_word_length = data_bit_count;
+
+ switch (stop_bits)
+ {
+ case STOP_BITS_0:
+ default:
+ m_df_stop_bit_count = 0;
+ break;
+
+ case STOP_BITS_1:
+ m_df_stop_bit_count = 1;
+ break;
+
+ case STOP_BITS_1_5:
+ m_df_stop_bit_count = 2; // TODO: support 1.5 stop bits
+ break;
+
+ case STOP_BITS_2:
+ m_df_stop_bit_count = 2;
+ break;
+ }
+
+ m_df_parity = parity;
+ m_df_start_bit_count = start_bit_count;
m_rcv_bit_count = m_df_word_length + m_df_stop_bit_count;
@@ -158,7 +181,7 @@ void device_serial_interface::receive_register_reset()
{
m_rcv_bit_count_received = 0;
m_rcv_flags &=~RECEIVE_REGISTER_FULL;
- if (m_synchronous)
+ if (m_df_start_bit_count == 0)
{
m_rcv_flags |= RECEIVE_REGISTER_SYNCHRONISED;
m_rcv_flags &=~RECEIVE_REGISTER_WAITING_FOR_START_BIT;
@@ -331,9 +354,11 @@ void device_serial_interface::transmit_register_setup(UINT8 data_byte)
m_tra_bit_count = 0;
m_tra_flags &=~TRANSMIT_REGISTER_EMPTY;
- if (!m_synchronous)
- /* start bit */
+ /* start bit */
+ for (i=0; i<m_df_start_bit_count; i++)
+ {
transmit_register_add_bit(0);
+ }
/* data bits */
transmit_data = data_byte;
@@ -481,3 +506,48 @@ void device_serial_interface::connect(device_serial_interface *other_connection)
/* let a know the state of b */
other_connection->serial_connection_out();
}
+
+const char *device_serial_interface::parity_tostring(parity_t parity)
+{
+ switch (parity)
+ {
+ case PARITY_NONE:
+ return "NONE";
+
+ case PARITY_ODD:
+ return "ODD";
+
+ case PARITY_EVEN:
+ return "EVEN";
+
+ case PARITY_MARK:
+ return "MARK";
+
+ case PARITY_SPACE:
+ return "SPACE";
+
+ default:
+ return "UNKNOWN";
+ }
+}
+
+const char *device_serial_interface::stop_bits_tostring(stop_bits_t stop_bits)
+{
+ switch (stop_bits)
+ {
+ case STOP_BITS_0:
+ return "0";
+
+ case STOP_BITS_1:
+ return "1";
+
+ case STOP_BITS_1_5:
+ return "1.5";
+
+ case STOP_BITS_2:
+ return "2";
+
+ default:
+ return "UNKNOWN";
+ }
+}
diff --git a/src/emu/diserial.h b/src/emu/diserial.h
index 6fbaf73d808..0633091ac5e 100644
--- a/src/emu/diserial.h
+++ b/src/emu/diserial.h
@@ -23,7 +23,8 @@ public:
even -> parity is even
odd -> parity is odd
*/
- enum
+
+ enum parity_t
{
PARITY_NONE, /* no parity. a parity bit will not be in the transmitted/received data */
PARITY_ODD, /* odd parity */
@@ -32,6 +33,14 @@ public:
PARITY_SPACE /* zero parity */
};
+ enum stop_bits_t
+ {
+ STOP_BITS_0,
+ STOP_BITS_1 = 1,
+ STOP_BITS_1_5 = 2,
+ STOP_BITS_2 = 3
+ };
+
/* Communication lines. Beware, everything is active high */
enum
{
@@ -55,7 +64,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(clock_w);
protected:
- void set_data_frame(int num_data_bits, int stop_bit_count, int parity_code, bool synchronous);
+ void set_data_frame(int start_bit_count, int data_bit_count, parity_t parity, stop_bits_t stop_bits);
void receive_register_reset();
void receive_register_update_bit(int bit);
@@ -108,20 +117,23 @@ protected:
bool m_start_bit_hack_for_external_clocks;
+ const char *parity_tostring(parity_t stop_bits);
+ const char *stop_bits_tostring(stop_bits_t stop_bits);
+
private:
enum { TRA_TIMER_ID = 10000, RCV_TIMER_ID };
UINT8 m_serial_parity_table[256];
// Data frame
+ // number of start bits
+ int m_df_start_bit_count;
// length of word in bits
UINT8 m_df_word_length;
// parity state
UINT8 m_df_parity;
// number of stop bits
UINT8 m_df_stop_bit_count;
- // synchronous or not
- bool m_synchronous;
// Receive register
/* data */
diff --git a/src/emu/imagedev/midiin.c b/src/emu/imagedev/midiin.c
index e32a580bc30..9d1868f9a1b 100644
--- a/src/emu/imagedev/midiin.c
+++ b/src/emu/imagedev/midiin.c
@@ -44,7 +44,7 @@ void midiin_device::device_reset()
m_xmit_read = m_xmit_write = 0;
// we don't Rx, we Tx at 31250 8-N-1
- set_data_frame(8, 1, PARITY_NONE, false);
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
set_rcv_rate(0);
set_tra_rate(31250);
}
diff --git a/src/emu/imagedev/midiout.c b/src/emu/imagedev/midiout.c
index b28e7702efa..e83ae8a356a 100644
--- a/src/emu/imagedev/midiout.c
+++ b/src/emu/imagedev/midiout.c
@@ -38,7 +38,7 @@ void midiout_device::device_start()
void midiout_device::device_reset()
{
// we don't Tx, we Rx at 31250 8-N-1
- set_data_frame(8, 1, PARITY_NONE, false);
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
set_rcv_rate(31250);
set_tra_rate(0);
}
diff --git a/src/emu/imagedev/serial.c b/src/emu/imagedev/serial.c
index d3a63c75c97..9c8f01f566d 100644
--- a/src/emu/imagedev/serial.c
+++ b/src/emu/imagedev/serial.c
@@ -50,8 +50,8 @@ void serial_image_device::device_config_complete()
{
m_baud_rate = 2400;
m_data_bits = 8;
- m_stop_bits = 2;
m_parity = PARITY_NONE;
+ m_stop_bits = STOP_BITS_2;
m_transmit_on_start = FALSE;
m_tag_connected = NULL;
}
@@ -80,7 +80,7 @@ void serial_image_device::input_callback(UINT8 state)
void serial_image_device::device_start()
{
- set_data_frame(m_data_bits, m_stop_bits, m_parity, false);
+ set_data_frame(1, m_data_bits, m_parity, m_stop_bits);
m_timer = machine().scheduler().timer_alloc(FUNC(serial_device_baud_rate_callback), this);
diff --git a/src/emu/imagedev/serial.h b/src/emu/imagedev/serial.h
index eb7b133a789..0e7daeb73c3 100644
--- a/src/emu/imagedev/serial.h
+++ b/src/emu/imagedev/serial.h
@@ -34,8 +34,8 @@ struct serial_image_interface
{
int m_baud_rate;
int m_data_bits;
- int m_stop_bits;
- int m_parity;
+ device_serial_interface::stop_bits_t m_stop_bits;
+ device_serial_interface::parity_t m_parity;
bool m_transmit_on_start;
const char *m_tag_connected;
};
diff --git a/src/emu/machine/i8251.c b/src/emu/machine/i8251.c
index 8e8edc39164..2311ce3037b 100644
--- a/src/emu/machine/i8251.c
+++ b/src/emu/machine/i8251.c
@@ -414,7 +414,7 @@ WRITE8_MEMBER(i8251_device::control_w)
LOG(("Character length: %d\n", (((data>>2) & 0x03)+5)));
- int parity = PARITY_NONE;
+ parity_t parity;
if (data & (1<<4))
{
@@ -434,59 +434,38 @@ WRITE8_MEMBER(i8251_device::control_w)
else
{
LOG(("parity check disabled\n"));
+ parity = PARITY_NONE;
}
- {
- UINT8 stop_bit_length;
-
- stop_bit_length = (data>>6) & 0x03;
-
- switch (stop_bit_length)
- {
- case 0:
- {
- /* inhibit */
- LOG(("stop bit: inhibit\n"));
- }
- break;
-
- case 1:
- {
- /* 1 */
- LOG(("stop bit: 1 bit\n"));
- }
- break;
-
- case 2:
- {
- /* 1.5 */
- LOG(("stop bit: 1.5 bits\n"));
- }
- break;
-
- case 3:
- {
- /* 2 */
- LOG(("stop bit: 2 bits\n"));
- }
- break;
- }
- }
+ stop_bits_t stop_bits;
- int word_length = ((data>>2) & 0x03)+5;
- int stop_bit_count = 1;
switch ((data>>6) & 0x03)
{
- case 0:
- case 1:
- stop_bit_count = 1;
- break;
- case 2:
- case 3:
- stop_bit_count = 2;
- break;
+ case 0:
+ default:
+ stop_bits = STOP_BITS_0;
+ LOG(("stop bit: inhibit\n"));
+ break;
+
+ case 1:
+ stop_bits = STOP_BITS_1;
+ LOG(("stop bit: 1 bit\n"));
+ break;
+
+ case 2:
+ stop_bits = STOP_BITS_1_5;
+ LOG(("stop bit: 1.5 bits\n"));
+ break;
+
+ case 3:
+ stop_bits = STOP_BITS_2;
+ LOG(("stop bit: 2 bits\n"));
+ break;
}
- set_data_frame(word_length,stop_bit_count,parity,false);
+
+ int data_bits_count = ((data>>2) & 0x03)+5;
+
+ set_data_frame(1, data_bits_count, parity, stop_bits);
switch (data & 0x03)
{
diff --git a/src/emu/machine/im6402.c b/src/emu/machine/im6402.c
index 4235413e055..d1870a76c3c 100644
--- a/src/emu/machine/im6402.c
+++ b/src/emu/machine/im6402.c
@@ -367,15 +367,15 @@ WRITE_LINE_MEMBER( im6402_device::crl_w )
{
if (LOG) logerror("IM6402 '%s' Control Register Load\n", tag());
- int word_length = 5 + ((m_cls2 << 1) | m_cls1);
- float stop_bits = 1 + (m_sbs ? ((word_length == 5) ? 0.5 : 1) : 0);
- int parity_code;
+ int data_bit_count = 5 + ((m_cls2 << 1) | m_cls1);
+ stop_bits_t stop_bits = (m_sbs ? ((data_bit_count == 5) ? STOP_BITS_1_5 : STOP_BITS_2) : STOP_BITS_1);
+ parity_t parity;
- if (m_pi) parity_code = PARITY_NONE;
- else if (m_epe) parity_code = PARITY_EVEN;
- else parity_code = PARITY_ODD;
+ if (m_pi) parity = PARITY_NONE;
+ else if (m_epe) parity = PARITY_EVEN;
+ else parity = PARITY_ODD;
- set_data_frame(word_length, stop_bits, parity_code, false);
+ set_data_frame(1, data_bit_count, parity, stop_bits);
}
}
diff --git a/src/emu/machine/ins8250.c b/src/emu/machine/ins8250.c
index 93856cf3daa..b84f3e63aa5 100644
--- a/src/emu/machine/ins8250.c
+++ b/src/emu/machine/ins8250.c
@@ -239,26 +239,44 @@ WRITE8_MEMBER( ins8250_uart_device::ins8250_w )
break;
case 3:
m_regs.lcr = data;
+
+ {
+ int data_bit_count = (m_regs.lcr & 3) + 5;
+ parity_t parity;
+ stop_bits_t stop_bits;
+
switch ((m_regs.lcr>>3) & 7)
{
case 1:
- tmp = PARITY_ODD;
+ parity = PARITY_ODD;
break;
+
case 3:
- tmp = PARITY_EVEN;
+ parity = PARITY_EVEN;
break;
+
case 5:
- tmp = PARITY_MARK;
+ parity = PARITY_MARK;
break;
+
case 7:
- tmp = PARITY_SPACE;
+ parity = PARITY_SPACE;
break;
+
default:
- tmp = PARITY_NONE;
+ parity = PARITY_NONE;
break;
}
- // if 5 data bits and stb = 1, stop bits is supposed to be 1.5
- set_data_frame((m_regs.lcr & 3) + 5, (m_regs.lcr & 4)?2:1, tmp, false);
+
+ if (!(m_regs.lcr & 4))
+ stop_bits = STOP_BITS_1;
+ else if (data_bit_count == 5)
+ stop_bits = STOP_BITS_1_5;
+ else
+ stop_bits = STOP_BITS_2;
+
+ set_data_frame(1, data_bit_count, parity, stop_bits);
+ }
break;
case 4:
if ( ( m_regs.mcr & 0x1f ) != ( data & 0x1f ) )
diff --git a/src/emu/machine/mc2661.c b/src/emu/machine/mc2661.c
index 8232fc9fbe2..b633af40c89 100644
--- a/src/emu/machine/mc2661.c
+++ b/src/emu/machine/mc2661.c
@@ -52,15 +52,6 @@ enum
#define MODE_STOP_BITS ((m_mr[0] >> 6) & 0x03)
-enum
-{
- STOP_BITS_INVALID = 0,
- STOP_BITS_1,
- STOP_BITS_1_5,
- STOP_BITS_2
-};
-
-
#define SYN1 m_sync[0]
#define SYN2 m_sync[1]
#define DLE m_sync[2]
@@ -347,22 +338,36 @@ WRITE8_MEMBER( mc2661_device::write )
if (m_mode_index == 0)
{
- int word_length = 5 + MODE_CHARACTER;
- float stop_bits = 0;
- int parity_code;
+ int data_bit_count = 5 + MODE_CHARACTER;
+ parity_t parity;
+
+ if (!MODE_PARITY) parity = PARITY_NONE;
+ else if (MODE_PARITY_EVEN) parity = PARITY_EVEN;
+ else parity = PARITY_ODD;
+
+ stop_bits_t stop_bits;
switch (MODE_STOP_BITS)
{
- case STOP_BITS_1: stop_bits = 1; break;
- case STOP_BITS_1_5: stop_bits = 1.5; break;
- case STOP_BITS_2: stop_bits = 2; break;
+ case 0:
+ default:
+ stop_bits = STOP_BITS_0;
+ break;
+
+ case 1:
+ stop_bits = STOP_BITS_1;
+ break;
+
+ case 2:
+ stop_bits = STOP_BITS_1_5;
+ break;
+
+ case 3:
+ stop_bits = STOP_BITS_2;
+ break;
}
- if (!MODE_PARITY) parity_code = PARITY_NONE;
- else if (MODE_PARITY_EVEN) parity_code = PARITY_EVEN;
- else parity_code = PARITY_ODD;
-
- set_data_frame(word_length, stop_bits, parity_code, false);
+ set_data_frame(1, data_bit_count, parity, stop_bits);
}
if(m_mode_index == 1)
{
diff --git a/src/emu/machine/mc68901.c b/src/emu/machine/mc68901.c
index f597150d50c..e65ffdd0d07 100644
--- a/src/emu/machine/mc68901.c
+++ b/src/emu/machine/mc68901.c
@@ -424,9 +424,6 @@ void mc68901_device::device_start()
save_item(NAME(m_receive_pending));
save_item(NAME(m_gpio_input));
save_item(NAME(m_gpio_output));
- save_item(NAME(m_rxtx_word));
- save_item(NAME(m_rxtx_start));
- save_item(NAME(m_rxtx_stop));
save_item(NAME(m_rsr_read));
save_item(NAME(m_next_rsr));
}
@@ -913,7 +910,17 @@ void mc68901_device::register_w(offs_t offset, UINT8 data)
case REGISTER_UCR:
{
- int parity_code = PARITY_NONE;
+ int data_bit_count;
+
+ switch (data & 0x60)
+ {
+ case UCR_WORD_LENGTH_8: default: data_bit_count = 8; break;
+ case UCR_WORD_LENGTH_7: data_bit_count = 7; break;
+ case UCR_WORD_LENGTH_6: data_bit_count = 6; break;
+ case UCR_WORD_LENGTH_5: data_bit_count = 5; break;
+ }
+
+ parity_t parity;
if (data & UCR_PARITY_ENABLED)
{
@@ -921,52 +928,52 @@ void mc68901_device::register_w(offs_t offset, UINT8 data)
{
if (LOG) logerror("MC68901 '%s' Parity : Even\n", tag());
- parity_code = PARITY_EVEN;
+ parity = PARITY_EVEN;
}
else
{
if (LOG) logerror("MC68901 '%s' Parity : Odd\n", tag());
- parity_code = PARITY_ODD;
+ parity = PARITY_ODD;
}
}
else
{
if (LOG) logerror("MC68901 '%s' Parity : Disabled\n", tag());
- }
- switch (data & 0x60)
- {
- case UCR_WORD_LENGTH_8: m_rxtx_word = 8; break;
- case UCR_WORD_LENGTH_7: m_rxtx_word = 7; break;
- case UCR_WORD_LENGTH_6: m_rxtx_word = 6; break;
- case UCR_WORD_LENGTH_5: m_rxtx_word = 5; break;
+ parity = PARITY_NONE;
}
- if (LOG) logerror("MC68901 '%s' Word Length : %u bits\n", tag(), m_rxtx_word);
+ if (LOG) logerror("MC68901 '%s' Word Length : %u bits\n", tag(), data_bit_count);
+
+
+ int start_bits;
+ stop_bits_t stop_bits;
- bool sync = false;
switch (data & 0x18)
{
case UCR_START_STOP_0_0:
- m_rxtx_start = 0;
- m_rxtx_stop = 0;
- sync = true;
+ default:
+ start_bits = 0;
+ stop_bits = STOP_BITS_0;
if (LOG) logerror("MC68901 '%s' Start Bits : 0, Stop Bits : 0, Format : synchronous\n", tag());
break;
+
case UCR_START_STOP_1_1:
- m_rxtx_start = 1;
- m_rxtx_stop = 1;
+ start_bits = 1;
+ stop_bits = STOP_BITS_1;
if (LOG) logerror("MC68901 '%s' Start Bits : 1, Stop Bits : 1, Format : asynchronous\n", tag());
break;
+
case UCR_START_STOP_1_15:
- m_rxtx_start = 1;
- m_rxtx_stop = 1;
+ start_bits = 1;
+ stop_bits = STOP_BITS_1_5;
if (LOG) logerror("MC68901 '%s' Start Bits : 1, Stop Bits : 1.5, Format : asynchronous\n", tag());
break;
+
case UCR_START_STOP_1_2:
- m_rxtx_start = 1;
- m_rxtx_stop = 2;
+ start_bits = 1;
+ stop_bits = STOP_BITS_2;
if (LOG) logerror("MC68901 '%s' Start Bits : 1, Stop Bits : 2, Format : asynchronous\n", tag());
break;
}
@@ -980,7 +987,7 @@ void mc68901_device::register_w(offs_t offset, UINT8 data)
if (LOG) logerror("MC68901 '%s' Rx/Tx Clock Divisor : 1\n", tag());
}
- set_data_frame(m_rxtx_word, m_rxtx_stop, parity_code, sync);
+ set_data_frame(start_bits, data_bit_count, parity, stop_bits);
m_ucr = data;
}
diff --git a/src/emu/machine/mc68901.h b/src/emu/machine/mc68901.h
index 80ba5f90c9e..dfa47e76b6a 100644
--- a/src/emu/machine/mc68901.h
+++ b/src/emu/machine/mc68901.h
@@ -285,9 +285,6 @@ private:
/* serial state */
UINT8 m_next_rsr; /* receiver status register latch */
int m_rsr_read; /* receiver status register read flag */
- int m_rxtx_word; /* word length */
- int m_rxtx_start; /* start bits */
- int m_rxtx_stop; /* stop bits */
// timers
emu_timer *m_timer[4]; /* counter timers */
diff --git a/src/emu/machine/microtch.c b/src/emu/machine/microtch.c
index 21bb0b34f3d..4f7db4c38b5 100644
--- a/src/emu/machine/microtch.c
+++ b/src/emu/machine/microtch.c
@@ -292,7 +292,7 @@ microtouch_serial_device::microtouch_serial_device(const machine_config &mconfig
void microtouch_serial_device::device_start()
{
microtouch_device::device_start();
- set_data_frame(8, 1, PARITY_NONE, false); //8N1?
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); //8N1?
set_tra_rate(clock());
set_rcv_rate(clock());
m_out_stx_func.resolve_safe();
diff --git a/src/emu/machine/mos6551.c b/src/emu/machine/mos6551.c
index e50cf53c420..2aa08bab002 100644
--- a/src/emu/machine/mos6551.c
+++ b/src/emu/machine/mos6551.c
@@ -202,19 +202,19 @@ void mos6551_device::update_serial()
{
int brg = m_ctrl & CTRL_BRG_MASK;
- int num_data_bits = 8;
- int stop_bit_count = 1;
- int parity_code = PARITY_NONE;
-
+ int data_bits_count;
switch (m_ctrl & CTRL_WL_MASK)
{
- case CTRL_WL_8: num_data_bits = 8; break;
- case CTRL_WL_7: num_data_bits = 7; break;
- case CTRL_WL_6: num_data_bits = 6; break;
- case CTRL_WL_5: num_data_bits = 5; break;
+ case CTRL_WL_8: default: data_bits_count = 8; break;
+ case CTRL_WL_7: data_bits_count = 7; break;
+ case CTRL_WL_6: data_bits_count = 6; break;
+ case CTRL_WL_5: data_bits_count = 5; break;
}
- set_data_frame(num_data_bits, stop_bit_count, parity_code, false);
+ parity_t parity = PARITY_NONE;
+ stop_bits_t stop_bits = STOP_BITS_1;
+
+ set_data_frame(1, data_bits_count, parity, stop_bits);
if (brg == CTRL_BRG_16X_EXTCLK)
{
diff --git a/src/emu/machine/n68681.c b/src/emu/machine/n68681.c
index 1a1f61b1474..279f10f6f8e 100644
--- a/src/emu/machine/n68681.c
+++ b/src/emu/machine/n68681.c
@@ -786,24 +786,7 @@ void duart68681_channel::write_MR(UINT8 data)
void duart68681_channel::recalc_framing()
{
- int parity = 0, stopbits = 0;
-
- switch ((MR2 >> 2) & 3)
- {
- case 0:
- case 1:
- stopbits = 1;
- break;
-
- case 2: // "1.5 async, 2 sync"
- stopbits = 2;
- break;
-
- case 3:
- stopbits = 2;
- break;
- }
-
+ parity_t parity = PARITY_NONE;
switch ((MR1>>3) & 3)
{
case 0: // with parity
@@ -837,9 +820,26 @@ void duart68681_channel::recalc_framing()
break;
}
+ stop_bits_t stopbits = STOP_BITS_0;
+ switch ((MR2 >> 2) & 3)
+ {
+ case 0:
+ case 1:
+ stopbits = STOP_BITS_1;
+ break;
+
+ case 2: // "1.5 async, 2 sync"
+ stopbits = STOP_BITS_1_5;
+ break;
+
+ case 3:
+ stopbits = STOP_BITS_2;
+ break;
+ }
+
//printf("ch %d MR1 %02x MR2 %02x => %d bits / char, %d stop bits, parity %d\n", m_ch, MR1, MR2, (MR1 & 3)+5, stopbits, parity);
- set_data_frame((MR1 & 3)+5, stopbits, parity, false);
+ set_data_frame(1, (MR1 & 3)+5, parity, stopbits);
}
void duart68681_channel::write_CR(UINT8 data)
diff --git a/src/emu/machine/z80dart.c b/src/emu/machine/z80dart.c
index 4dcd79289e3..66d43f5480d 100644
--- a/src/emu/machine/z80dart.c
+++ b/src/emu/machine/z80dart.c
@@ -748,18 +748,16 @@ int z80dart_channel::get_clock_mode()
// get_stop_bits - get number of stop bits
//-------------------------------------------------
-float z80dart_channel::get_stop_bits()
+device_serial_interface::stop_bits_t z80dart_channel::get_stop_bits()
{
- float bits = 1;
-
switch (m_wr[4] & WR4_STOP_BITS_MASK)
{
- case WR4_STOP_BITS_1: bits = 1; break;
- case WR4_STOP_BITS_1_5: bits = 1.5; break;
- case WR4_STOP_BITS_2: bits = 2; break;
+ case WR4_STOP_BITS_1: return STOP_BITS_1;
+ case WR4_STOP_BITS_1_5: return STOP_BITS_1_5;
+ case WR4_STOP_BITS_2: return STOP_BITS_2;
}
- return bits;
+ return STOP_BITS_0;
}
@@ -967,7 +965,7 @@ void z80dart_channel::control_write(UINT8 data)
case 4:
LOG(("Z80DART \"%s\" Channel %c : Parity Enable %u\n", m_owner->tag(), 'A' + m_index, (data & WR4_PARITY_ENABLE) ? 1 : 0));
LOG(("Z80DART \"%s\" Channel %c : Parity %s\n", m_owner->tag(), 'A' + m_index, (data & WR4_PARITY_EVEN) ? "Even" : "Odd"));
- LOG(("Z80DART \"%s\" Channel %c : Stop Bits %f\n", m_owner->tag(), 'A' + m_index, get_stop_bits()));
+ LOG(("Z80DART \"%s\" Channel %c : Stop Bits %s\n", m_owner->tag(), 'A' + m_index, stop_bits_tostring(get_stop_bits())));
LOG(("Z80DART \"%s\" Channel %c : Clock Mode %uX\n", m_owner->tag(), 'A' + m_index, get_clock_mode()));
update_serial();
@@ -1303,19 +1301,21 @@ WRITE_LINE_MEMBER( z80dart_channel::txc_w )
void z80dart_channel::update_serial()
{
- int num_data_bits = get_rx_word_length();
- int stop_bit_count = get_stop_bits();
- int parity_code = PARITY_NONE;
+ int data_bit_count = get_rx_word_length();
+ stop_bits_t stop_bits = get_stop_bits();
+ parity_t parity;
if (m_wr[4] & WR4_PARITY_ENABLE)
{
if (m_wr[4] & WR4_PARITY_EVEN)
- parity_code = PARITY_EVEN;
+ parity = PARITY_EVEN;
else
- parity_code = PARITY_ODD;
+ parity = PARITY_ODD;
}
+ else
+ parity = PARITY_NONE;
- set_data_frame(num_data_bits, stop_bit_count, parity_code, false);
+ set_data_frame(1, data_bit_count, parity, stop_bits);
int clocks = get_clock_mode();
diff --git a/src/emu/machine/z80dart.h b/src/emu/machine/z80dart.h
index d0549917ac8..55069dece22 100644
--- a/src/emu/machine/z80dart.h
+++ b/src/emu/machine/z80dart.h
@@ -431,7 +431,7 @@ protected:
void set_rts(int state);
int get_clock_mode();
- float get_stop_bits();
+ stop_bits_t get_stop_bits();
int get_rx_word_length();
int get_tx_word_length();
diff --git a/src/mame/machine/midikbd.c b/src/mame/machine/midikbd.c
index 967f4e4ffa3..070511fc2a8 100644
--- a/src/mame/machine/midikbd.c
+++ b/src/mame/machine/midikbd.c
@@ -76,7 +76,7 @@ void midi_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, in
void midi_keyboard_device::device_start()
{
- set_data_frame(8, 1, PARITY_NONE, false); //8N1?
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); //8N1?
set_tra_rate(clock());
m_out_tx_func.resolve_safe();
m_head = m_tail = 0;
diff --git a/src/mess/drivers/bullet.c b/src/mess/drivers/bullet.c
index 3a986cd7158..d8cfc16943f 100644
--- a/src/mess/drivers/bullet.c
+++ b/src/mess/drivers/bullet.c
@@ -1069,10 +1069,12 @@ WRITE_LINE_MEMBER( bulletf_state::req_w )
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/exp85.c b/src/mess/drivers/exp85.c
index 0bc2359fcdb..f010121474d 100644
--- a/src/mess/drivers/exp85.c
+++ b/src/mess/drivers/exp85.c
@@ -172,10 +172,12 @@ WRITE_LINE_MEMBER( exp85_state::sod_w )
/* Terminal Interface */
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
/* Machine Initialization */
diff --git a/src/mess/drivers/horizon.c b/src/mess/drivers/horizon.c
index cfc352b750b..e8ecef6669a 100644
--- a/src/mess/drivers/horizon.c
+++ b/src/mess/drivers/horizon.c
@@ -130,10 +130,12 @@ static const i8251_interface usart_r_intf =
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/isbc.c b/src/mess/drivers/isbc.c
index f95ed8a12ef..3618880e4ac 100644
--- a/src/mess/drivers/isbc.c
+++ b/src/mess/drivers/isbc.c
@@ -122,10 +122,12 @@ static INPUT_PORTS_START( isbc )
INPUT_PORTS_END
static DEVICE_INPUT_DEFAULTS_START( isbc86_terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x01 ) // 300
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x01 ) // 300
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x01 ) // 300
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x03 ) // 2
DEVICE_INPUT_DEFAULTS_END
static DEVICE_INPUT_DEFAULTS_START( rpc86_terminal )
@@ -133,10 +135,12 @@ static DEVICE_INPUT_DEFAULTS_START( rpc86_terminal )
DEVICE_INPUT_DEFAULTS_END
static DEVICE_INPUT_DEFAULTS_START( isbc286_terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
static const struct pit8253_interface isbc86_pit_config =
diff --git a/src/mess/drivers/mc1502.c b/src/mess/drivers/mc1502.c
index 01d53ad44d2..fb476c7a5a2 100644
--- a/src/mess/drivers/mc1502.c
+++ b/src/mess/drivers/mc1502.c
@@ -44,7 +44,7 @@ static const cassette_interface mc1502_cassette_interface =
static const serial_image_interface mc1502_serial =
{
- 9600, 8, 1, device_serial_interface::PARITY_NONE, 1, "upd8251"
+ 9600, 8, device_serial_interface::STOP_BITS_1, device_serial_interface::PARITY_NONE, 1, "upd8251"
};
// Timer
diff --git a/src/mess/drivers/pipbug.c b/src/mess/drivers/pipbug.c
index 74abae52785..9705c693348 100644
--- a/src/mess/drivers/pipbug.c
+++ b/src/mess/drivers/pipbug.c
@@ -81,10 +81,12 @@ static INPUT_PORTS_START( pipbug )
INPUT_PORTS_END
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x0d ) // 110
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x0d ) // 110
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x0d ) // 110
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
QUICKLOAD_LOAD_MEMBER( pipbug_state, pipbug )
diff --git a/src/mess/drivers/pulsar.c b/src/mess/drivers/pulsar.c
index 9704e842b26..3ca81f00ba7 100644
--- a/src/mess/drivers/pulsar.c
+++ b/src/mess/drivers/pulsar.c
@@ -186,10 +186,12 @@ static I8255_INTERFACE( ppi_intf )
};
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
static Z80DART_INTERFACE( dart_intf )
diff --git a/src/mess/drivers/px4.c b/src/mess/drivers/px4.c
index e1f44167b02..2baaf27950d 100644
--- a/src/mess/drivers/px4.c
+++ b/src/mess/drivers/px4.c
@@ -862,14 +862,14 @@ READ8_MEMBER( px4_state::px4_artsr_r )
// art mode register
WRITE8_MEMBER( px4_state::px4_artmr_w )
{
- int data_bits = BIT(data, 2) ? 8 : 7;
- int parity = BIT(data, 4) ? (BIT(data, 5) ? PARITY_EVEN : PARITY_ODD) : PARITY_NONE;
- int stop_bits = BIT(data, 7) ? 2 : 1;
+ int data_bit_count = BIT(data, 2) ? 8 : 7;
+ parity_t parity = BIT(data, 4) ? (BIT(data, 5) ? PARITY_EVEN : PARITY_ODD) : PARITY_NONE;
+ stop_bits_t stop_bits = BIT(data, 7) ? STOP_BITS_2 : STOP_BITS_1;
if (VERBOSE)
- logerror("%s: serial frame setup: %d-%d-%d\n", tag(), data_bits, stop_bits, parity);
+ logerror("%s: serial frame setup: %d-%s-%d\n", tag(), data_bit_count, device_serial_interface::parity_tostring(parity), stop_bits);
- set_data_frame(data_bits, stop_bits, parity, false);
+ set_data_frame(1, data_bit_count, parity, stop_bits);
}
// io status register
diff --git a/src/mess/drivers/sage2.c b/src/mess/drivers/sage2.c
index c9657318bab..6c565a12dc3 100644
--- a/src/mess/drivers/sage2.c
+++ b/src/mess/drivers/sage2.c
@@ -494,10 +494,12 @@ static const centronics_interface centronics_intf =
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x08 ) // 19200
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x08 ) // 19200
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x08 ) // 19200
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/sdk86.c b/src/mess/drivers/sdk86.c
index 73bb73858d4..e64a364a983 100644
--- a/src/mess/drivers/sdk86.c
+++ b/src/mess/drivers/sdk86.c
@@ -159,10 +159,12 @@ static I8279_INTERFACE( sdk86_intf )
};
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x05 ) // 4800
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x05 ) // 4800
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x05 ) // 4800
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x03 ) // 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 55d76d2ae43..38a9942df66 100644
--- a/src/mess/drivers/softbox.c
+++ b/src/mess/drivers/softbox.c
@@ -335,10 +335,12 @@ static I8255A_INTERFACE( ppi1_intf )
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/super6.c b/src/mess/drivers/super6.c
index 3c7d299c2b9..bf3d3e5deb0 100644
--- a/src/mess/drivers/super6.c
+++ b/src/mess/drivers/super6.c
@@ -497,10 +497,12 @@ static const z80_daisy_config super6_daisy_chain[] =
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x08 ) // 19200
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x08 ) // 19200
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x08 ) // 19200
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/superslave.c b/src/mess/drivers/superslave.c
index 93cf6082605..d378d146e57 100644
--- a/src/mess/drivers/superslave.c
+++ b/src/mess/drivers/superslave.c
@@ -341,10 +341,12 @@ static Z80PIO_INTERFACE( pio_intf )
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/drivers/thomson.c b/src/mess/drivers/thomson.c
index 4b818a50fde..bbced9b841f 100644
--- a/src/mess/drivers/thomson.c
+++ b/src/mess/drivers/thomson.c
@@ -604,17 +604,17 @@ const cassette_interface mo5_cassette_interface =
const serial_image_interface to7_cc90232_config =
{
- 2400, 7, 2, device_serial_interface::PARITY_NONE, 1, "to7_io"
+ 2400, 7, device_serial_interface::STOP_BITS_2, device_serial_interface::PARITY_NONE, 1, "to7_io"
};
const serial_image_interface to7_rf57932_config =
{
- 2400, 7, 2, device_serial_interface::PARITY_NONE, 1, "acia"
+ 2400, 7, device_serial_interface::STOP_BITS_2, device_serial_interface::PARITY_NONE, 1, "acia"
};
const serial_image_interface to7_modem_config =
{
- 2400, 7, 2, device_serial_interface::PARITY_NONE, 1, NULL
+ 2400, 7, device_serial_interface::STOP_BITS_2, device_serial_interface::PARITY_NONE, 1, NULL
};
/* ------------ driver ------------ */
diff --git a/src/mess/drivers/xor100.c b/src/mess/drivers/xor100.c
index ff4df5d7729..ff21b2db850 100644
--- a/src/mess/drivers/xor100.c
+++ b/src/mess/drivers/xor100.c
@@ -496,10 +496,12 @@ void xor100_state::fdc_drq_w(bool state)
static DEVICE_INPUT_DEFAULTS_START( terminal )
- DEVICE_INPUT_DEFAULTS( "TERM_BAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600
+ DEVICE_INPUT_DEFAULTS( "TERM_STARTBITS", 0xff, 0x01 ) // 1
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( "TERM_STOPBITS", 0xff, 0x01 ) // 1
DEVICE_INPUT_DEFAULTS_END
diff --git a/src/mess/machine/dec_lk201.c b/src/mess/machine/dec_lk201.c
index f8a7977847d..336c4774a04 100644
--- a/src/mess/machine/dec_lk201.c
+++ b/src/mess/machine/dec_lk201.c
@@ -469,8 +469,8 @@ void lk201_device::device_start()
void lk201_device::device_reset()
{
- set_data_frame(8, 1, PARITY_NONE, false);
- set_rate(4800);
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
+ set_rate(4800);
sci_status = (SCSR_TC | SCSR_TDRE);
diff --git a/src/mess/machine/esqpanel.c b/src/mess/machine/esqpanel.c
index 34bbd3c6293..ab0f942f9e9 100644
--- a/src/mess/machine/esqpanel.c
+++ b/src/mess/machine/esqpanel.c
@@ -64,7 +64,7 @@ void esqpanel_device::device_start()
void esqpanel_device::device_reset()
{
// panel comms is at 62500 baud (double the MIDI rate), 8N2
- set_data_frame(8, 2, PARITY_NONE, false);
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2);
set_rcv_rate(62500);
set_tra_rate(62500);
diff --git a/src/mess/machine/isa_sblaster.c b/src/mess/machine/isa_sblaster.c
index 95f1d5a8fce..09185546ff6 100644
--- a/src/mess/machine/isa_sblaster.c
+++ b/src/mess/machine/isa_sblaster.c
@@ -1280,8 +1280,8 @@ void sb_device::device_reset()
m_rx_waiting = m_tx_waiting = 0;
// MIDI is 31250 baud, 8-N-1
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
set_rate(31250);
- set_data_frame(8, 1, PARITY_NONE, false);
}
UINT8 sb_device::dack_r(int line)
diff --git a/src/mess/machine/keyboard.c b/src/mess/machine/keyboard.c
index d1c777e5b19..d96c746b360 100644
--- a/src/mess/machine/keyboard.c
+++ b/src/mess/machine/keyboard.c
@@ -435,8 +435,8 @@ void serial_keyboard_device::device_start()
m_out_tx_func.resolve(m_out_tx_cb, *this);
m_slot = m_owner && 1;
m_timer = timer_alloc();
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
set_tra_rate(baud);
- set_data_frame(8, 1, PARITY_NONE, false);
}
INPUT_CHANGED_MEMBER(serial_keyboard_device::update_frame)
@@ -459,17 +459,17 @@ void serial_keyboard_device::device_reset()
switch(val & 0x30)
{
case 0x10:
- set_data_frame(7, 1, PARITY_EVEN, false);
+ set_data_frame(1, 7, PARITY_EVEN, STOP_BITS_1);
break;
case 0x00:
default:
- set_data_frame(8, 1, PARITY_NONE, false);
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
break;
case 0x20:
- set_data_frame(8, 2, PARITY_NONE, false);
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2);
break;
case 0x30:
- set_data_frame(8, 1, PARITY_EVEN, false);
+ set_data_frame(1, 8, PARITY_EVEN, STOP_BITS_1);
break;
}
}
diff --git a/src/mess/machine/ser_mouse.h b/src/mess/machine/ser_mouse.h
index 9bda1cc1d1c..4aaff2bdd6e 100644
--- a/src/mess/machine/ser_mouse.h
+++ b/src/mess/machine/ser_mouse.h
@@ -52,7 +52,7 @@ public:
virtual void dtr_w(UINT8 state) { m_dtr = state; check_state(); }
virtual void rts_w(UINT8 state) { m_rts = state; check_state(); m_old_rts = state; }
protected:
- virtual void set_frame() { set_data_frame(7, 2, PARITY_NONE, false); }
+ virtual void set_frame() { set_data_frame(1, 7, PARITY_NONE, STOP_BITS_2); }
virtual void mouse_trans(int dx, int dy, int nb, int mbc);
virtual void device_reset() {m_old_rts = 0; serial_mouse_device::device_reset();}
private:
@@ -68,7 +68,7 @@ public:
virtual void dtr_w(UINT8 state) { m_dtr = state; check_state(); }
virtual void rts_w(UINT8 state) { m_rts = state; check_state(); }
protected:
- virtual void set_frame() { set_data_frame(8, 2, PARITY_NONE, false); }
+ virtual void set_frame() { set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2); }
virtual void mouse_trans(int dx, int dy, int nb, int mbc);
private:
void check_state() { set_mouse_enable((m_dtr && m_rts)?true:false); }
diff --git a/src/mess/machine/terminal.c b/src/mess/machine/terminal.c
index cd8fdeb1cf1..c9a743a7d92 100644
--- a/src/mess/machine/terminal.c
+++ b/src/mess/machine/terminal.c
@@ -413,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_BAUD")
- PORT_CONFNAME(0xff, 0x06, "Baud") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_terminal_device, update_serial)
+ PORT_START("TERM_TXBAUD")
+ PORT_CONFNAME(0xff, 0x06, "TX 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")
@@ -430,6 +430,28 @@ static INPUT_PORTS_START(serial_terminal)
PORT_CONFSETTING( 0x0b, "57600")
PORT_CONFSETTING( 0x0c, "115200")
+ PORT_START("TERM_RXBAUD")
+ PORT_CONFNAME(0xff, 0x06, "RX 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")
+ PORT_CONFSETTING( 0x02, "600")
+ PORT_CONFSETTING( 0x03, "1200")
+ PORT_CONFSETTING( 0x04, "2400")
+ PORT_CONFSETTING( 0x05, "4800")
+ PORT_CONFSETTING( 0x06, "9600")
+ PORT_CONFSETTING( 0x07, "14400")
+ PORT_CONFSETTING( 0x08, "19200")
+ PORT_CONFSETTING( 0x09, "28800")
+ PORT_CONFSETTING( 0x0a, "38400")
+ PORT_CONFSETTING( 0x0b, "57600")
+ PORT_CONFSETTING( 0x0c, "115200")
+
+ PORT_START("TERM_STARTBITS")
+ PORT_CONFNAME(0xff, 0x01, "Start Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_terminal_device, update_serial)
+ PORT_CONFSETTING( 0x00, "0")
+ PORT_CONFSETTING( 0x01, "1")
+
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")
@@ -447,10 +469,11 @@ static INPUT_PORTS_START(serial_terminal)
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")
+ PORT_CONFNAME(0xff, 0x01, "Stop Bits") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, serial_terminal_device, update_serial)
+ PORT_CONFSETTING( 0x00, "0")
+ PORT_CONFSETTING( 0x01, "1")
+ PORT_CONFSETTING( 0x02, "1.5")
+ PORT_CONFSETTING( 0x03, "2")
INPUT_PORTS_END
ioport_constructor serial_terminal_device::device_input_ports() const
@@ -462,7 +485,9 @@ serial_terminal_device::serial_terminal_device(const machine_config &mconfig, co
: 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),
- m_io_term_baud(*this, "TERM_BAUD"),
+ m_io_term_txbaud(*this, "TERM_TXBAUD"),
+ m_io_term_rxbaud(*this, "TERM_RXBAUD"),
+ m_io_term_startbits(*this, "TERM_STARTBITS"),
m_io_term_databits(*this, "TERM_DATABITS"),
m_io_term_parity(*this, "TERM_PARITY"),
m_io_term_stopbits(*this, "TERM_STOPBITS")
@@ -489,21 +514,26 @@ void serial_terminal_device::device_start()
m_slot = m_owner && 1;
}
-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)
{
- UINT8 baud = m_io_term_baud->read();
+ static const int m_baud[] = {150, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 110};
+ static const int m_startbits[] = {0, 1};
+ static const int m_databits[] = {5, 6, 7, 8, 9};
+ static const parity_t m_parity[] = {PARITY_NONE, PARITY_ODD, PARITY_EVEN, PARITY_MARK, PARITY_SPACE};
+ static const stop_bits_t m_stopbits[] = {STOP_BITS_0, STOP_BITS_1, STOP_BITS_1_5, STOP_BITS_2};
+
+ UINT8 startbits = m_io_term_startbits->read();
UINT8 databits = m_io_term_databits->read();
UINT8 parity = m_io_term_parity->read();
UINT8 stopbits = m_io_term_stopbits->read();
- set_data_frame(m_databits[databits], m_stopbits[stopbits], m_parity[parity], false);
- set_tra_rate(m_baud[baud]);
- set_rcv_rate(m_baud[baud]);
+ set_data_frame(m_startbits[startbits], m_databits[databits], m_parity[parity], m_stopbits[stopbits]);
+
+ UINT8 txbaud = m_io_term_txbaud->read();
+ set_tra_rate(m_baud[txbaud]);
+
+ UINT8 rxbaud = m_io_term_rxbaud->read();
+ set_rcv_rate(m_baud[rxbaud]);
}
void serial_terminal_device::device_reset()
diff --git a/src/mess/machine/terminal.h b/src/mess/machine/terminal.h
index 1ebfda3a454..3b9ca41be67 100644
--- a/src/mess/machine/terminal.h
+++ b/src/mess/machine/terminal.h
@@ -110,7 +110,9 @@ protected:
virtual void send_key(UINT8 code);
private:
- required_ioport m_io_term_baud;
+ required_ioport m_io_term_txbaud;
+ required_ioport m_io_term_rxbaud;
+ required_ioport m_io_term_startbits;
required_ioport m_io_term_databits;
required_ioport m_io_term_parity;
required_ioport m_io_term_stopbits;
diff --git a/src/mess/machine/wangpckb.c b/src/mess/machine/wangpckb.c
index 6b9d8a1dddc..180fdeb88a3 100644
--- a/src/mess/machine/wangpckb.c
+++ b/src/mess/machine/wangpckb.c
@@ -417,7 +417,7 @@ void wangpc_keyboard_device::device_start()
// set serial callbacks
m_maincpu->i8051_set_serial_tx_callback(WRITE8_DELEGATE(wangpc_keyboard_device, mcs51_tx_callback));
m_maincpu->i8051_set_serial_rx_callback(READ8_DELEGATE(wangpc_keyboard_device, mcs51_rx_callback));
- set_data_frame(8, 2, PARITY_NONE, false);
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2);
}
diff --git a/src/mess/machine/zx8302.c b/src/mess/machine/zx8302.c
index dbca89dfc23..ce56bf31b98 100644
--- a/src/mess/machine/zx8302.c
+++ b/src/mess/machine/zx8302.c
@@ -404,7 +404,7 @@ WRITE8_MEMBER( zx8302_device::control_w )
m_baudx4_timer->adjust(attotime::zero, 0, attotime::from_hz(baudx4));
set_tra_rate(baud);
- set_data_frame(8, 2, PARITY_NONE, false);
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_2);
}