From 61424105fbd4e5f3604921edeacb588565c8a1e4 Mon Sep 17 00:00:00 2001 From: smf- Date: Mon, 13 Jan 2014 11:20:45 +0000 Subject: 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] --- src/emu/machine/mc68901.c | 57 ++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 25 deletions(-) (limited to 'src/emu/machine/mc68901.c') 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; } -- cgit v1.2.3-70-g09d2