diff options
Diffstat (limited to 'src/mame/drivers/seattlecmp.cpp')
-rw-r--r-- | src/mame/drivers/seattlecmp.cpp | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/src/mame/drivers/seattlecmp.cpp b/src/mame/drivers/seattlecmp.cpp index 559e2d52eaa..911d8e0b545 100644 --- a/src/mame/drivers/seattlecmp.cpp +++ b/src/mame/drivers/seattlecmp.cpp @@ -31,30 +31,26 @@ There is a 4MHz crystal connected to the 9513. #include "emu.h" #include "cpu/i86/i86.h" -#include "machine/terminal.h" +#include "machine/clock.h" +#include "machine/i8251.h" +#include "bus/rs232/rs232.h" -#define TERMINAL_TAG "terminal" class seattle_comp_state : public driver_device { public: seattle_comp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_terminal(*this, TERMINAL_TAG) - { - } + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_uart(*this, "uart") + { } - DECLARE_READ16_MEMBER(read); - DECLARE_WRITE16_MEMBER(write); - void kbd_put(u8 data); + DECLARE_WRITE_LINE_MEMBER(clock_tick); private: virtual void machine_reset() override; required_device<cpu_device> m_maincpu; - required_device<generic_terminal_device> m_terminal; - uint8_t m_term_data; - bool m_key_available; + required_device<i8251_device> m_uart; }; @@ -67,7 +63,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START(seattle_io, AS_IO, 16, seattle_comp_state) //ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0xf6,0xf7) AM_READWRITE(read, write) + AM_RANGE(0xf6, 0xf7) AM_DEVREADWRITE8("uart", i8251_device, data_r, data_w, 0x00ff) + AM_RANGE(0xf6, 0xf7) AM_DEVREADWRITE8("uart", i8251_device, status_r, control_w, 0xff00) //AM_RANGE(0xf0, 0xf1) 8259_0 //AM_RANGE(0xf2, 0xf3) 8259_1 //AM_RANGE(0xf4, 0xf5) AM9513 @@ -76,18 +73,6 @@ static ADDRESS_MAP_START(seattle_io, AS_IO, 16, seattle_comp_state) //AM_RANGE(0xfe, 0xff) Eprom disable bit, read sense switches (bank of 8 dipswitches) ADDRESS_MAP_END -READ16_MEMBER( seattle_comp_state::read ) -{ - uint16_t status = (m_key_available) ? 0x300 : 0x100; - m_key_available = 0; - return m_term_data | status; -} - -WRITE16_MEMBER( seattle_comp_state::write ) -{ - m_terminal->write(space, 0, data&0x7f); -} - /* Input ports */ static INPUT_PORTS_START( seattle ) INPUT_PORTS_END @@ -95,16 +80,25 @@ INPUT_PORTS_END void seattle_comp_state::machine_reset() { - m_key_available = 0; - m_term_data = 0; } -void seattle_comp_state::kbd_put(u8 data) +// source of baud frequency is not documented, so we invent a clock +WRITE_LINE_MEMBER( seattle_comp_state::clock_tick ) { - m_term_data = data; - m_key_available = 1; + m_uart->write_txc(state); + m_uart->write_rxc(state); } +// bit 7 needs to be stripped off, we do this by choosing 7 bits and even parity +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) +DEVICE_INPUT_DEFAULTS_END + static MACHINE_CONFIG_START( seattle ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", I8086, 4000000) // no idea @@ -112,8 +106,19 @@ static MACHINE_CONFIG_START( seattle ) MCFG_CPU_IO_MAP(seattle_io) /* video hardware */ - MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0) - MCFG_GENERIC_TERMINAL_KEYBOARD_CB(PUT(seattle_comp_state, kbd_put)) + MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) + MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(seattle_comp_state, clock_tick)) + + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart", i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart", i8251_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart", i8251_device, write_cts)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", terminal) // must be exactly here MACHINE_CONFIG_END /* ROM definition */ @@ -124,5 +129,5 @@ ROM_END /* Driver */ -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS COMP( 1986, seattle, 0, 0, seattle, seattle, seattle_comp_state, 0, "Seattle Computer", "SCP-300F", MACHINE_NO_SOUND_HW ) |