From 91b47b5fe171ecee9d12a996cce4e2349f73f486 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Wed, 15 Jul 2020 14:53:19 +1000 Subject: [PATCH] busicom,sdk86,pcm: small cleanup --- src/mame/drivers/busicom.cpp | 84 ++++++++++++--------- src/mame/drivers/pcm.cpp | 8 +- src/mame/drivers/sdk86.cpp | 140 +++++++++++++++++++++-------------- src/mame/includes/busicom.h | 1 - src/mame/video/busicom.cpp | 24 ++---- 5 files changed, 146 insertions(+), 111 deletions(-) diff --git a/src/mame/drivers/busicom.cpp b/src/mame/drivers/busicom.cpp index 4d008f8c7e7..1c591b1b20c 100644 --- a/src/mame/drivers/busicom.cpp +++ b/src/mame/drivers/busicom.cpp @@ -16,10 +16,10 @@ uint8_t busicom_state::get_bit_selected(uint32_t val,int num) { - int i; - for(i=0;iread() & 1 ? 8 : 0; return retVal; } @@ -40,11 +41,14 @@ uint8_t busicom_state::printer_r() void busicom_state::shifter_w(uint8_t data) { // FIXME: detect edges, maybe make 4003 shifter a device - if (BIT(data,0)) { + if (BIT(data,0)) + { m_keyboard_shifter <<= 1; m_keyboard_shifter |= BIT(data,1); } - if (BIT(data,2)) { + + if (BIT(data,2)) + { m_printer_shifter <<= 1; m_printer_shifter |= BIT(data,1); } @@ -52,37 +56,41 @@ void busicom_state::shifter_w(uint8_t data) void busicom_state::printer_w(uint8_t data) { - int i,j; - if (BIT(data,0)) { + u8 i,j; + if (BIT(data,0)) + { logerror("color : %02x %02x %d\n",BIT(data,0),data,m_drum_index); m_printer_line_color[10] = 1; + } - } - if (BIT(data,1)) { - for(i=3;i<18;i++) { - if(BIT(m_printer_shifter,i)) { + if (BIT(data,1)) + { + for(i=3;i<18;i++) + if(BIT(m_printer_shifter,i)) m_printer_line[10][i-3] = m_drum_index + 1; - } - } - if(BIT(m_printer_shifter,0)) { + + if(BIT(m_printer_shifter,0)) m_printer_line[10][15] = m_drum_index + 13 + 1; - } - if(BIT(m_printer_shifter,1)) { + + if(BIT(m_printer_shifter,1)) m_printer_line[10][16] = m_drum_index + 26 + 1; - } } - if (BIT(data,3)) { - for(j=0;j<10;j++) { - for(i=0;i<17;i++) { + + if (BIT(data,3)) + { + for(j=0;j<10;j++) + { + for(i=0;i<17;i++) + { m_printer_line[j][i] = m_printer_line[j+1][i]; m_printer_line_color[j] = m_printer_line_color[j+1]; } } - for(i=0;i<17;i++) { - m_printer_line[10][i] = 0; - } - m_printer_line_color[10] = 0; + for(i=0;i<17;i++) + m_printer_line[10][i] = 0; + + m_printer_line_color[10] = 0; } } void busicom_state::status_w(uint8_t data) @@ -197,13 +205,21 @@ INPUT_PORTS_END TIMER_DEVICE_CALLBACK_MEMBER(busicom_state::timer_callback) { m_timer ^= 1; - if (m_timer == 1) m_drum_index++; - if (m_drum_index == 13) m_drum_index = 0; + if (m_timer == 1) + m_drum_index++; + if (m_drum_index == 13) + m_drum_index = 0; m_maincpu->set_input_line(I4004_TEST_LINE, m_timer); } void busicom_state::machine_start() { + save_item(NAME(m_drum_index)); + save_item(NAME(m_keyboard_shifter)); + save_item(NAME(m_printer_shifter)); + save_item(NAME(m_timer)); + save_item(NAME(m_printer_line)); + save_item(NAME(m_printer_line_color)); } void busicom_state::machine_reset() @@ -213,8 +229,10 @@ void busicom_state::machine_reset() m_keyboard_shifter = 0; m_printer_shifter = 0; - for(i=0;i<17;i++) { - for(j=0;j<11;j++) { + for(i=0;i<17;i++) + { + for(j=0;j<11;j++) + { m_printer_line[j][i] = 0; m_printer_line_color[j] = 0; } @@ -222,8 +240,6 @@ void busicom_state::machine_reset() } -//static const char layout_busicom [] = "busicom"; - void busicom_state::busicom(machine_config &config) { /* basic machine hardware */ @@ -250,7 +266,7 @@ void busicom_state::busicom(machine_config &config) /* ROM definition */ ROM_START( busicom ) - ROM_REGION( 0x1000, "maincpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x0500, "maincpu", 0 ) ROM_LOAD( "busicom.l01", 0x0000, 0x0100, CRC(51ae2513) SHA1(5cb4097a3945db35af4ed64b629b20b08fc9824f)) ROM_LOAD( "busicom.l02", 0x0100, 0x0100, CRC(a05411ad) SHA1(81503a99a0d34fa29bf1245de0a44af2f174abdd)) ROM_LOAD( "busicom.l05", 0x0200, 0x0100, CRC(6120addf) SHA1(4b7ec183613630120b3c313c782122713d4327c5)) @@ -261,4 +277,4 @@ ROM_END /* Driver */ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1974, busicom, 0, 0, busicom, busicom, busicom_state, empty_init, "Business Computer Corporation", "Busicom 141-PF", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 1974, busicom, 0, 0, busicom, busicom, busicom_state, empty_init, "Business Computer Corporation", "Busicom 141-PF", MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/pcm.cpp b/src/mame/drivers/pcm.cpp index ff0ee1915eb..db992da93bf 100644 --- a/src/mame/drivers/pcm.cpp +++ b/src/mame/drivers/pcm.cpp @@ -46,8 +46,10 @@ tape. ToDo: - Add NMI generator - Find out if there really is any floppy-disk feature - the schematic - has no mention of it. + has no mention of it. (it might be the ram drives) - Add the 6 LEDs. +- Need software +- MNW until we can be sure it works as intended. ****************************************************************************/ @@ -207,7 +209,7 @@ void pcm_state::io_map(address_map &map) map(0x90, 0x93).rw(m_pio_u, FUNC(z80pio_device::read), FUNC(z80pio_device::write)); // user PIO map(0x94, 0x97).w(FUNC(pcm_state::port94_w)); //map(0x98, 0x9B) // NMI generator for debugging - //map(0x9C, 0x9F) // io ports available to the user + map(0x9C, 0x9F); // io ports available to the user // disk controller? } @@ -379,4 +381,4 @@ ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1988, pcm, 0, 0, pcm, pcm, pcm_state, empty_init, "Mugler/Mathes", "PC/M", MACHINE_SUPPORTS_SAVE ) +COMP( 1988, pcm, 0, 0, pcm, pcm, pcm_state, empty_init, "Mugler/Mathes", "PC/M", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/sdk86.cpp b/src/mame/drivers/sdk86.cpp index 70a487d3905..57fc3891182 100644 --- a/src/mame/drivers/sdk86.cpp +++ b/src/mame/drivers/sdk86.cpp @@ -2,17 +2,7 @@ // copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu /*************************************************************************** - Intel MCS-86 System Design Kit (SDK-86) - - 12/05/2009 Skeleton driver by Micko - 29/11/2009 Some fleshing out by Lord Nightmare - 22/06/2011 Working [Robbbert] - - TODO: - Add optional 2x 8255A port read/write logging - - - +Intel MCS-86 System Design Kit (SDK-86) This is an evaluation kit for the 8086 cpu. There is no speaker or storage facility in the standard kit. @@ -20,9 +10,12 @@ There is no speaker or storage facility in the standard kit. Download the User Manual to get the operating procedures. The user manual is available from: http://www.bitsavers.org/pdf/intel/8086/9800698A_SDK-86_Users_Man_Apr79.pdf +2009-05-12 Skeleton driver by Micko +2009-11-29 Some fleshing out by Lord Nightmare +2011-06-22 Working [Robbbert] + ToDo: -- Artwork -- Add INTR and RESET keys +- Add optional 2x 8255A port read/write logging ****************************************************************************/ @@ -35,50 +28,56 @@ ToDo: #include "machine/i8279.h" #include "sdk86.lh" -#define I8251_TAG "i8251" -#define RS232_TAG "rs232" - - class sdk86_state : public driver_device { public: sdk86_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") - , m_kbdrow(*this, "X%X", 0U) + , m_uart(*this, "uart") + , m_kdc(*this, "i8279") + , m_ppi1(*this, "ppi1") + , m_ppi2(*this, "ppi2") + , m_io_keyboard(*this, "X%u", 0U) , m_digits(*this, "digit%u", 0U) { } void sdk86(machine_config &config); + DECLARE_INPUT_CHANGED_MEMBER(nmi_button); + DECLARE_INPUT_CHANGED_MEMBER(reset_button); private: - void scanlines_w(uint8_t data); - void digit_w(uint8_t data); - uint8_t kbd_r(); + void scanlines_w(u8 data); + void digit_w(u8 data); + u8 kbd_r(); - void sdk86_io(address_map &map); - void sdk86_mem(address_map &map); + void io_map(address_map &map); + void mem_map(address_map &map); - uint8_t m_digit; - virtual void machine_start() override { m_digits.resolve(); } + u8 m_digit; + void machine_start() override; required_device m_maincpu; - required_ioport_array<3> m_kbdrow; + required_device m_uart; + required_device m_kdc; + required_device m_ppi1; + required_device m_ppi2; + required_ioport_array<3> m_io_keyboard; output_finder<8> m_digits; }; -void sdk86_state::sdk86_mem(address_map &map) +void sdk86_state::mem_map(address_map &map) { map(0x00000, 0x00fff).ram(); //2K standard, or 4k (board fully populated) map(0xfe000, 0xfffff).rom().region("maincpu", 0); } -void sdk86_state::sdk86_io(address_map &map) +void sdk86_state::io_map(address_map &map) { map.unmap_value_high(); - map(0xfff0, 0xfff3).mirror(4).rw(I8251_TAG, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); - map(0xffe8, 0xffeb).mirror(4).rw("i8279", FUNC(i8279_device::read), FUNC(i8279_device::write)).umask16(0x00ff); - map(0xfff8, 0xffff).rw("port1", FUNC(i8255_device::read), FUNC(i8255_device::write)).umask16(0xff00); - map(0xfff8, 0xffff).rw("port2", FUNC(i8255_device::read), FUNC(i8255_device::write)).umask16(0x00ff); + map(0xfff0, 0xfff3).mirror(4).rw(m_uart, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff); + map(0xffe8, 0xffeb).mirror(4).rw(m_kdc, FUNC(i8279_device::read), FUNC(i8279_device::write)).umask16(0x00ff); + map(0xfff8, 0xffff).rw(m_ppi1, FUNC(i8255_device::read), FUNC(i8255_device::write)).umask16(0xff00); + map(0xfff8, 0xffff).rw(m_ppi2, FUNC(i8255_device::read), FUNC(i8255_device::write)).umask16(0x00ff); } /* Input ports */ @@ -111,30 +110,57 @@ static INPUT_PORTS_START( sdk86 ) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(":") PORT_CODE(KEYCODE_COLON) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("REG") PORT_CODE(KEYCODE_R) PORT_BIT(0xC0, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("X3") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("INTR") PORT_CODE(KEYCODE_ESC) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, nmi_button, 0) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Systm Reset") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, sdk86_state, reset_button, 0) INPUT_PORTS_END +INPUT_CHANGED_MEMBER(sdk86_state::nmi_button) +{ + m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); +} -void sdk86_state::scanlines_w(uint8_t data) +// Reset button connects to i8284, output of this resets all major chips +INPUT_CHANGED_MEMBER(sdk86_state::reset_button) +{ + if (newval) + { + m_ppi1->reset(); + m_ppi2->reset(); + m_uart->reset(); + m_kdc->reset(); + m_maincpu->reset(); + } +} + +void sdk86_state::scanlines_w(u8 data) { m_digit = data; } -void sdk86_state::digit_w(uint8_t data) +void sdk86_state::digit_w(u8 data) { if (m_digit < 8) m_digits[m_digit] = data; } -uint8_t sdk86_state::kbd_r() +u8 sdk86_state::kbd_r() { - uint8_t data = 0xff; + u8 data = 0xff; if ((m_digit & 7) < 3) - data = m_kbdrow[m_digit & 7]->read(); + data = m_io_keyboard[m_digit & 7]->read(); return data; } +void sdk86_state::machine_start() +{ + m_digits.resolve(); + save_item(NAME(m_digit)); +} + static DEVICE_INPUT_DEFAULTS_START( terminal ) DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_4800 ) DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_4800 ) @@ -148,36 +174,36 @@ void sdk86_state::sdk86(machine_config &config) { /* basic machine hardware */ I8086(config, m_maincpu, XTAL(14'745'600)/3); /* divided down by i8284 clock generator; jumper selection allows it to be slowed to 2.5MHz, hence changing divider from 3 to 6 */ - m_maincpu->set_addrmap(AS_PROGRAM, &sdk86_state::sdk86_mem); - m_maincpu->set_addrmap(AS_IO, &sdk86_state::sdk86_io); + m_maincpu->set_addrmap(AS_PROGRAM, &sdk86_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &sdk86_state::io_map); /* video hardware */ config.set_default_layout(layout_sdk86); /* Devices */ - i8251_device &i8251(I8251(config, I8251_TAG, 0)); - i8251.txd_handler().set(RS232_TAG, FUNC(rs232_port_device::write_txd)); - i8251.dtr_handler().set(RS232_TAG, FUNC(rs232_port_device::write_dtr)); - i8251.rts_handler().set(I8251_TAG, FUNC(i8251_device::write_cts)); + I8251(config, m_uart, 0); + m_uart->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + m_uart->dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); + m_uart->rts_handler().set(m_uart, FUNC(i8251_device::write_cts)); - rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, "terminal")); - rs232.rxd_handler().set(I8251_TAG, FUNC(i8251_device::write_rxd)); - rs232.dsr_handler().set(I8251_TAG, FUNC(i8251_device::write_dsr)); + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set(m_uart, FUNC(i8251_device::write_rxd)); + rs232.dsr_handler().set(m_uart, FUNC(i8251_device::write_dsr)); rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal)); clock_device &usart_clock(CLOCK(config, "usart_clock", XTAL(14'745'600)/3/16)); - usart_clock.signal_handler().set(I8251_TAG, FUNC(i8251_device::write_txc)); - usart_clock.signal_handler().append(I8251_TAG, FUNC(i8251_device::write_rxc)); + usart_clock.signal_handler().set(m_uart, FUNC(i8251_device::write_txc)); + usart_clock.signal_handler().append(m_uart, FUNC(i8251_device::write_rxc)); - i8279_device &kbdc(I8279(config, "i8279", 2500000)); // based on divider - kbdc.out_sl_callback().set(FUNC(sdk86_state::scanlines_w)); // scan SL lines - kbdc.out_disp_callback().set(FUNC(sdk86_state::digit_w)); // display A&B - kbdc.in_rl_callback().set(FUNC(sdk86_state::kbd_r)); // kbd RL lines - kbdc.in_shift_callback().set_constant(0); // Shift key - kbdc.in_ctrl_callback().set_constant(0); + I8279(config, m_kdc, 2500000); // based on divider + m_kdc->out_sl_callback().set(FUNC(sdk86_state::scanlines_w)); // scan SL lines + m_kdc->out_disp_callback().set(FUNC(sdk86_state::digit_w)); // display A&B + m_kdc->in_rl_callback().set(FUNC(sdk86_state::kbd_r)); // kbd RL lines + m_kdc->in_shift_callback().set_constant(0); // Shift key + m_kdc->in_ctrl_callback().set_constant(0); - I8255A(config, "port1"); - I8255A(config, "port2"); + I8255A(config, m_ppi1); + I8255A(config, m_ppi2); } /* ROM definition */ @@ -221,4 +247,4 @@ ROM_END /* Driver */ /* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ -COMP( 1979, sdk86, 0, 0, sdk86, sdk86, sdk86_state, empty_init, "Intel", "MCS-86 System Design Kit", MACHINE_NO_SOUND_HW) +COMP( 1979, sdk86, 0, 0, sdk86, sdk86, sdk86_state, empty_init, "Intel", "MCS-86 System Design Kit", MACHINE_NO_SOUND_HW | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/busicom.h b/src/mame/includes/busicom.h index 5b999e7e838..17472c538e9 100644 --- a/src/mame/includes/busicom.h +++ b/src/mame/includes/busicom.h @@ -31,7 +31,6 @@ public: protected: virtual void machine_start() override; virtual void machine_reset() override; - virtual void video_start() override; private: uint8_t keyboard_r(); diff --git a/src/mame/video/busicom.cpp b/src/mame/video/busicom.cpp index e2d109e6b45..81c0c715f9a 100644 --- a/src/mame/video/busicom.cpp +++ b/src/mame/video/busicom.cpp @@ -1814,37 +1814,29 @@ static const uint8_t printer_font[]= { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; -void busicom_state::video_start() -{ -} - uint32_t busicom_state::screen_update_busicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int y, x, b, j; //34x44 - for (y = 0; y < 11; y++) + for (u8 y = 0; y < 11; y++) { uint8_t col = 8 * m_printer_line_color[y]; - for (x = 0; x < 17; x++) + for (u8 x = 0; x < 17; x++) { uint8_t chr = m_printer_line[y][x]; - for (j = 0; j < 44; j++) { - for (b = 0; b < 34; b++) - { + for (u8 j = 0; j < 44; j++) + { + for (u8 b = 0; b < 34; b++) bitmap.pix16((y*44)+j, x*40+b) = printer_font[44*34 * chr + j*34 + b] + col ; - } - for (b = 34; b < 40; b++) - { - bitmap.pix16((y*44)+j, x*40+b) = 0; - } + for (u8 b = 34; b < 40; b++) + bitmap.pix16((y*44)+j, x*40+b) = 0; } } } return 0; } -static constexpr uint8_t color[] = { 0xFF,0xDB,0xB7,0x92,0x6E,0x49,0x25,0x00 }; +static constexpr uint8_t color[] = { 0xFF,0xDB,0xB7,0x92,0x6E,0x49,0x25,0x00 }; static constexpr uint8_t color_red[] = { 0xb0,0xb5,0xc0,0xc5,0xd0,0xd5,0xdf }; void busicom_state::busicom_palette(palette_device &palette) const