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]

This commit is contained in:
smf- 2014-01-13 11:20:45 +00:00
parent a1b3437fc4
commit 61424105fb
44 changed files with 408 additions and 258 deletions

View File

@ -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

View File

@ -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

View File

@ -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";
}
}

View File

@ -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 */

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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;
};

View File

@ -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_bits_t stop_bits;
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;
}
}
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)
{

View File

@ -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);
}
}

View File

@ -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 ) )

View File

@ -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)
{

View File

@ -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());
parity = PARITY_NONE;
}
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;
}
if (LOG) logerror("MC68901 '%s' Word Length : %u bits\n", tag(), data_bit_count);
if (LOG) logerror("MC68901 '%s' Word Length : %u bits\n", tag(), m_rxtx_word);
bool sync = false;
int start_bits;
stop_bits_t stop_bits;
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;
}

View File

@ -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 */

View File

@ -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();

View File

@ -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)
{

View File

@ -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)

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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 =

View File

@ -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

View File

@ -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 )

View File

@ -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 )

View File

@ -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

View File

@ -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

View File

@ -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 )

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 ------------ */

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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); }

View File

@ -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()

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}