From 5387f91f9de26a838c35e23038336d396904665e Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sat, 4 Nov 2017 01:09:00 +1100 Subject: (nw) sys9002 : added devices --- src/mame/drivers/lilith.cpp | 4 +- src/mame/drivers/sys9002.cpp | 115 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 116 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/lilith.cpp b/src/mame/drivers/lilith.cpp index 6d2ffd9e92e..a88a3e898ef 100644 --- a/src/mame/drivers/lilith.cpp +++ b/src/mame/drivers/lilith.cpp @@ -16,11 +16,11 @@ class lilith_state : public driver_device public: lilith_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) -// , maincpu(*this, "maincpu") +// , m_maincpu(*this, "maincpu") { } protected: -// required_device maincpu; +// required_device m_maincpu; }; static INPUT_PORTS_START( lilith ) diff --git a/src/mame/drivers/sys9002.cpp b/src/mame/drivers/sys9002.cpp index 8b7ae48e825..bab16aa5c48 100644 --- a/src/mame/drivers/sys9002.cpp +++ b/src/mame/drivers/sys9002.cpp @@ -12,10 +12,19 @@ NEC D4016C-3 * 4 + 2 ST M2764A-4F1 * 4 HD6845P + +Seems a chargen is missing. +If write to the 6845 is enabled, MAME freezes after 1 or 2 seconds. + ****************************************************************************/ #include "emu.h" #include "cpu/i8085/i8085.h" +#include "video/mc6845.h" +#include "screen.h" +#include "machine/clock.h" +#include "machine/i8251.h" +#include "bus/rs232/rs232.h" class sys9002_state : public driver_device { @@ -23,10 +32,16 @@ public: sys9002_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_p_videoram(*this, "videoram") + , m_palette(*this, "palette") { } + MC6845_UPDATE_ROW(crtc_update_row); + private: required_device m_maincpu; + required_shared_ptr m_p_videoram; + required_device m_palette; }; @@ -34,23 +49,121 @@ static ADDRESS_MAP_START(sys9002_mem, AS_PROGRAM, 8, sys9002_state) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x7fff) AM_ROM // 4 * 4K ROM AM_RANGE(0x8000, 0x9fff) AM_RAM // 4 * 2k RAM - AM_RANGE(0xa000, 0xa7ff) AM_RAM // 2k RAM + AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE("videoram") // 2k RAM + AM_RANGE(0xc000, 0xc07f) AM_RAM // ?? ADDRESS_MAP_END static ADDRESS_MAP_START(sys9002_io, AS_IO, 8, sys9002_state) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) + //AM_RANGE(0x04, 0x04) AM_DEVREADWRITE("crtc", mc6845_device, status_r, address_w) // left commented out as mame freezes after about 2 seconds + //AM_RANGE(0x05, 0x05) AM_DEVREADWRITE("crtc", mc6845_device, register_r, register_w) + AM_RANGE(0x08, 0x08) AM_DEVREADWRITE("uart1", i8251_device, data_r, data_w) + AM_RANGE(0x09, 0x09) AM_DEVREADWRITE("uart1", i8251_device, status_r, control_w) // 7 bits even parity, x64 + AM_RANGE(0x11, 0x11) AM_READNOP // continuous read + AM_RANGE(0x1c, 0x1c) AM_DEVREADWRITE("uart2", i8251_device, data_r, data_w) + AM_RANGE(0x1d, 0x1d) AM_DEVREADWRITE("uart2", i8251_device, status_r, control_w) // enabled for transmit only, 8 bits odd parity, x64 ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START( sys9002 ) INPUT_PORTS_END +MC6845_UPDATE_ROW( sys9002_state::crtc_update_row ) +{ + const rgb_t *pens = m_palette->palette()->entry_list_raw(); + uint8_t chr,gfx; + uint16_t mem,x; + uint32_t *p = &bitmap.pix32(y); + + for (x = 0; x < x_count; x++) + { + mem = (ma + x) & 0x7ff; + chr = m_p_videoram[mem]; + + /* get pattern of pixels for that character scanline */ + gfx = chr; //gfx = m_p_chargen[(chr<<4) | ra] ^ ((x == cursor_x) ? 0xff : 0); + + /* Display a scanline of a character (8 pixels) */ + *p++ = pens[BIT(gfx, 7)]; + *p++ = pens[BIT(gfx, 6)]; + *p++ = pens[BIT(gfx, 5)]; + *p++ = pens[BIT(gfx, 4)]; + *p++ = pens[BIT(gfx, 3)]; + *p++ = pens[BIT(gfx, 2)]; + *p++ = pens[BIT(gfx, 1)]; + *p++ = pens[BIT(gfx, 0)]; + } +} + + +static DEVICE_INPUT_DEFAULTS_START( uart1 ) + 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_ODD ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + +static DEVICE_INPUT_DEFAULTS_START( uart2 ) + 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_8 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + static MACHINE_CONFIG_START( sys9002 ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu",I8085A, XTAL_2MHz) // XTAL not visible on images MCFG_CPU_PROGRAM_MAP(sys9002_mem) MCFG_CPU_IO_MAP(sys9002_io) + + /* video hardware */ + MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green()) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) // not correct + MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update) + MCFG_SCREEN_SIZE(32*8, 32*8) + MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + //MCFG_GFXDECODE_ADD("gfxdecode", "palette", mx2178) + MCFG_PALETTE_ADD_MONOCHROME("palette") + + /* Devices */ + MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_2MHz) // clk unknown + MCFG_MC6845_SHOW_BORDER_AREA(false) + MCFG_MC6845_CHAR_WIDTH(8) + MCFG_MC6845_UPDATE_ROW_CB(sys9002_state, crtc_update_row) + + MCFG_DEVICE_ADD("uart_clock", CLOCK, 614400) + MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("uart1", i8251_device, write_txc)) + MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("uart1", i8251_device, write_rxc)) + MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("uart2", i8251_device, write_txc)) + MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("uart2", i8251_device, write_rxc)) + + MCFG_DEVICE_ADD("uart1", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232a", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232a", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232a", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232a", default_rs232_devices, nullptr) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart1", i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart1", i8251_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart1", i8251_device, write_cts)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", uart1) + + MCFG_DEVICE_ADD("uart2", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232b", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232b", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232b", rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart2", i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart2", i8251_device, write_dsr)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart2", i8251_device, write_cts)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("terminal", uart2) MACHINE_CONFIG_END /* ROM definition */ -- cgit v1.2.3