i8251: Implemented 16X/64X clock modes. [Curt Coder]

(MESS) xor100: Refactored to use serial terminal. [Curt Coder]
This commit is contained in:
Curt Coder 2013-05-17 20:45:06 +00:00
parent 84805f91f1
commit f97d8c4837
6 changed files with 42 additions and 36 deletions

View File

@ -139,6 +139,13 @@ void i8251_device::update_rx_ready()
void i8251_device::receive_clock()
{
m_rxc++;
if (m_rxc == m_br_factor)
m_rxc = 0;
else
return;
/* receive enable? */
if (m_command & (1<<2))
{
@ -165,6 +172,13 @@ void i8251_device::receive_clock()
void i8251_device::transmit_clock()
{
m_txc++;
if (m_txc == m_br_factor)
m_txc = 0;
else
return;
/* transmit enable? */
if (m_command & (1<<0))
{
@ -316,6 +330,8 @@ void i8251_device::device_reset()
m_mode_byte = 0;
m_command = 0;
m_data = 0;
m_rxc = m_txc = 0;
m_br_factor = 1;
/* update tx empty pin output */
update_tx_empty();
@ -464,6 +480,15 @@ WRITE8_MEMBER(i8251_device::control_w)
}
set_data_frame(word_length,stop_bit_count,parity);
switch (data & 0x03)
{
case 1: m_br_factor = 1; break;
case 2: m_br_factor = 16; break;
case 3: m_br_factor = 64; break;
}
m_rxc = m_txc = 0;
#if 0
/* data bits */
m_receive_char_length = (((data>>2) & 0x03)+5);

View File

@ -119,6 +119,10 @@ private:
/* mode byte - bit definitions depend on mode - e.g. synchronous, asynchronous */
UINT8 m_mode_byte;
int m_rxc;
int m_txc;
int m_br_factor;
/* data being received */
UINT8 m_data;
};

View File

@ -246,24 +246,12 @@ static I8255A_INTERFACE( ppi1_intf )
WRITE_LINE_MEMBER( softbox_state::fr_w )
{
m_rx_clock++;
if (m_rx_clock & 0x10)
{
m_rx_clock = 0;
m_usart->receive_clock();
}
m_usart->receive_clock();
}
WRITE_LINE_MEMBER( softbox_state::ft_w )
{
m_tx_clock++;
if (m_tx_clock & 0x10)
{
m_tx_clock = 0;
m_usart->transmit_clock();
}
m_usart->transmit_clock();
}
static COM8116_INTERFACE( dbrg_intf )

View File

@ -153,12 +153,6 @@ WRITE8_MEMBER( xor100_state::baud_w )
m_dbrg->stt_w(data >> 4);
}
WRITE8_MEMBER( xor100_state::i8251_b_data_w )
{
m_uart_b->data_w(space, 0, data);
m_terminal->write(space, 0, data);
}
READ8_MEMBER( xor100_state::fdc_r )
{
return m_fdc->gen_r(offset) ^ 0xff;
@ -265,7 +259,7 @@ static ADDRESS_MAP_START( xor100_io, AS_IO, 8, xor100_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x00, 0x00) AM_DEVREADWRITE(I8251_A_TAG, i8251_device, data_r, data_w)
AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(I8251_A_TAG, i8251_device, status_r, control_w)
AM_RANGE(0x02, 0x02) AM_DEVREAD(I8251_B_TAG, i8251_device, data_r) AM_WRITE(i8251_b_data_w)
AM_RANGE(0x02, 0x02) AM_DEVREADWRITE(I8251_B_TAG, i8251_device, data_r, data_w)
AM_RANGE(0x03, 0x03) AM_DEVREADWRITE(I8251_B_TAG, i8251_device, status_r, control_w)
AM_RANGE(0x04, 0x07) AM_DEVREADWRITE(I8255A_TAG, i8255_device, read, write)
AM_RANGE(0x08, 0x08) AM_WRITE(mmu_w)
@ -401,8 +395,8 @@ static const i8251_interface printer_8251_intf =
static const i8251_interface terminal_8251_intf =
{
DEVCB_NULL,
DEVCB_NULL,
DEVCB_DEVICE_LINE_MEMBER(TERMINAL_TAG, serial_terminal_device, tx_r),
DEVCB_DEVICE_LINE_MEMBER(TERMINAL_TAG, serial_terminal_device, rx_w),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
@ -512,14 +506,14 @@ void xor100_state::fdc_drq_w(bool state)
/* Terminal Interface */
WRITE8_MEMBER( xor100_state::xor100_kbd_put )
{
m_uart_b->receive_character(data);
}
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_END
static GENERIC_TERMINAL_INTERFACE( xor100_terminal_intf )
{
DEVCB_DRIVER_MEMBER(xor100_state, xor100_kbd_put)
DEVCB_NULL
};
static S100_INTERFACE( s100_intf )
@ -598,7 +592,8 @@ static MACHINE_CONFIG_START( xor100, xor100_state )
MCFG_FLOPPY_DRIVE_ADD(WD1795_TAG":3", xor100_floppies, NULL, NULL, floppy_image_device::default_floppy_formats)
MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, xor100_centronics_intf)
MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, xor100_terminal_intf)
MCFG_SERIAL_TERMINAL_ADD(TERMINAL_TAG, xor100_terminal_intf, 9600)
MCFG_DEVICE_INPUT_DEFAULTS(terminal)
// S-100
MCFG_S100_BUS_ADD(Z80_TAG, s100_intf)

View File

@ -26,9 +26,7 @@ public:
m_maincpu(*this, Z80_TAG),
m_usart(*this, I8251_TAG),
m_dbrg(*this, COM8116_TAG),
m_ieee(*this, IEEE488_TAG),
m_rx_clock(0),
m_tx_clock(0)
m_ieee(*this, IEEE488_TAG)
{ }
required_device<cpu_device> m_maincpu;
@ -53,9 +51,6 @@ public:
LED_B,
LED_READY
};
int m_rx_clock;
int m_tx_clock;
};
#endif

View File

@ -70,7 +70,6 @@ public:
DECLARE_WRITE8_MEMBER( prom_toggle_w );
DECLARE_READ8_MEMBER( prom_disable_r );
DECLARE_WRITE8_MEMBER( baud_w );
DECLARE_WRITE8_MEMBER( i8251_b_data_w );
DECLARE_READ8_MEMBER( fdc_r );
DECLARE_WRITE8_MEMBER( fdc_w );
DECLARE_READ8_MEMBER( fdc_wait_r );