From 191947d23bd9f5c09e261573571775d31d40255f Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 21 Aug 2025 21:14:13 +0200 Subject: [PATCH 01/24] read int from p3 --- src/mame/adp/servicetastatur.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 327333f15029e..4de7c5798cad7 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -124,8 +124,8 @@ void servicet_state::servicet_io(address_map &map) static INPUT_PORTS_START( servicet ) PORT_START("IN0") // P1.0 - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("OK") PORT_CODE(KEYCODE_ENTER) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START) PORT_NAME("OK") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("F4") PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_4WAY PORT_START("IN1") // P1.1 @@ -134,9 +134,19 @@ static INPUT_PORTS_START( servicet ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_4WAY PORT_START("IN2") // P1.2 - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("F3") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("F1") + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("F2") + + PORT_START("P3") // P3 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1) PORT_NAME("INT0") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2) PORT_NAME("INT1") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END void servicet_state::machine_start() @@ -193,11 +203,12 @@ uint8_t servicet_state::port1_r() void servicet_state::port1_w(uint8_t data) { m_port1 = data; + popmessage("p3 %02X",data); } uint8_t servicet_state::port3_r() { - uint8_t data = m_port3; + uint8_t data = ioport("P3")->read(); uint8_t sda = m_i2cmem->read_sda(); From 5127fe1882f56cdce7e02451facc03a09439f4be Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 21 Aug 2025 23:52:46 +0200 Subject: [PATCH 02/24] switch case for u16 --- src/mame/adp/servicetastatur.cpp | 55 ++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 4de7c5798cad7..4efc5f2e3e369 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -203,7 +203,6 @@ uint8_t servicet_state::port1_r() void servicet_state::port1_w(uint8_t data) { m_port1 = data; - popmessage("p3 %02X",data); } uint8_t servicet_state::port3_r() @@ -230,8 +229,24 @@ uint8_t servicet_state::bus_r(offs_t offset) { uint8_t data = 0xff; - // LCD is mapped to addresses where A6:A4 = 111 (0x70-0x7f) - if ((offset & 0x70) == 0x70) + switch (offset & 0x70) + { + case 0x40: //Y4 U20 OE + { + popmessage("Read GSG"); + break; + } + case 0x50: //Y5 U19 OE + { + popmessage("Read scrambled GSG"); + break; + } + case 0x60: //Y6 U13 PL + { + popmessage("Read GSG out"); + break; + } + case 0x70: //Y7 LCD { // RS and RW are A1 and A0 bool rs = BIT(offset, 1); @@ -250,19 +265,36 @@ uint8_t servicet_state::bus_r(offs_t offset) { data = m_lcd_data; } + break; } - else + default: { - //LOG("Bus read: %02X to %04X\n", offset); + //LOG("Bus read: from %04X\n", offset); + } } - return data; } void servicet_state::bus_w(offs_t offset, uint8_t data) { - // LCD is mapped to addresses where A6:A4 = 111 (0x70-0x7f) - if ((offset & 0x70) == 0x70) + switch (offset & 0x70) + { + case 0x40: //Y4 U20 OE + { + popmessage("Write GSG in %02X",data); + break; + } + case 0x50: //Y5 U19 OE + { + popmessage("Write scrambled GSG in %02X",data); + break; + } + case 0x60: //Y6 U13 PL + { + popmessage("Write GSG out %02X",data); + break; + } + case 0x70: //Y7 LCD { // RS and RW are A1 and A0 bool rs = BIT(offset, 1); @@ -280,13 +312,10 @@ void servicet_state::bus_w(offs_t offset, uint8_t data) m_lcd->e_w(0); } } - else if (offset == 0x4000) + default: { - //LOG("GSG write: %02X \n", data, offset); + //popmessage("Bus write: %02X to %04X\n", data, offset); } - else - { - //LOG("Bus write: %02X to %04X\n", data, offset); } } From 0af9ec268f3728ebcdd280093ae21c5c498c81a8 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 21:39:57 +0200 Subject: [PATCH 03/24] simplify it a lot --- src/mame/adp/servicetastatur.cpp | 61 +++++++------------------------- 1 file changed, 12 insertions(+), 49 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 4efc5f2e3e369..8cb6708062b13 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -94,8 +94,9 @@ class servicet_state : public driver_device void port1_w(uint8_t data); uint8_t port3_r(); void port3_w(uint8_t data); - uint8_t bus_r(offs_t offset); - void bus_w(offs_t offset, uint8_t data); + + uint8_t gsg_r(offs_t offset); + void gsg_w(offs_t offset, uint8_t data); void servicet_io(address_map &map) ATTR_COLD; void servicet_map(address_map &map) ATTR_COLD; @@ -119,7 +120,12 @@ void servicet_state::servicet_map(address_map &map) void servicet_state::servicet_io(address_map &map) { - map(0x0000, 0xffff).rw(FUNC(servicet_state::bus_r), FUNC(servicet_state::bus_w)); + map(0x0070, 0x0070).w(m_lcd, FUNC(hd44780_device::control_w)); + map(0x0071, 0x0071).r(m_lcd, FUNC(hd44780_device::control_r)); + map(0x0072, 0x0072).w(m_lcd, FUNC(hd44780_device::data_w)); + map(0x0073, 0x0073).r(m_lcd, FUNC(hd44780_device::data_r)); + + map(0x4000, 0x4000).w(FUNC(servicet_state::gsg_w)); } static INPUT_PORTS_START( servicet ) @@ -142,7 +148,7 @@ static INPUT_PORTS_START( servicet ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1) PORT_NAME("INT0") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2) PORT_NAME("INT1") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE2) PORT_NAME("INT1") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) @@ -225,7 +231,7 @@ void servicet_state::port3_w(uint8_t data) m_i2cmem->write_scl(BIT(data, PORT_3_SCL)); } -uint8_t servicet_state::bus_r(offs_t offset) +uint8_t servicet_state::gsg_r(offs_t offset) { uint8_t data = 0xff; @@ -246,36 +252,11 @@ uint8_t servicet_state::bus_r(offs_t offset) popmessage("Read GSG out"); break; } - case 0x70: //Y7 LCD - { - // RS and RW are A1 and A0 - bool rs = BIT(offset, 1); - bool rw = BIT(offset, 0); - if (rw) - { - m_lcd->rs_w(rs); - m_lcd->rw_w(1); - - m_lcd->e_w(1); - data = m_lcd->db_r(); - m_lcd->e_w(0); - } - else - { - data = m_lcd_data; - } - break; - } - default: - { - //LOG("Bus read: from %04X\n", offset); - } - } return data; } -void servicet_state::bus_w(offs_t offset, uint8_t data) +void servicet_state::gsg_w(offs_t offset, uint8_t data) { switch (offset & 0x70) { @@ -294,24 +275,6 @@ void servicet_state::bus_w(offs_t offset, uint8_t data) popmessage("Write GSG out %02X",data); break; } - case 0x70: //Y7 LCD - { - // RS and RW are A1 and A0 - bool rs = BIT(offset, 1); - bool rw = BIT(offset, 0); - - if (!rw) - { - m_lcd_data = data; - - m_lcd->rs_w(rs); - m_lcd->rw_w(0); - m_lcd->db_w(data); - - m_lcd->e_w(1); - m_lcd->e_w(0); - } - } default: { //popmessage("Bus write: %02X to %04X\n", data, offset); From 4f2eb749926070119be8fcea28645a624177ee06 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 21:44:56 +0200 Subject: [PATCH 04/24] map gsg --- src/mame/adp/servicetastatur.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 8cb6708062b13..f9274847d33c8 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -125,6 +125,9 @@ void servicet_state::servicet_io(address_map &map) map(0x0072, 0x0072).w(m_lcd, FUNC(hd44780_device::data_w)); map(0x0073, 0x0073).r(m_lcd, FUNC(hd44780_device::data_r)); + map(0x0010, 0x0030).w(FUNC(servicet_state::gsg_w)); + map(0x0040, 0x0050).r(FUNC(servicet_state::gsg_r)); + map(0x0060, 0x0060).w(FUNC(servicet_state::gsg_w)); map(0x4000, 0x4000).w(FUNC(servicet_state::gsg_w)); } @@ -148,7 +151,7 @@ static INPUT_PORTS_START( servicet ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1) PORT_NAME("INT0") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE2) PORT_NAME("INT1") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("INT1") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) @@ -252,7 +255,7 @@ uint8_t servicet_state::gsg_r(offs_t offset) popmessage("Read GSG out"); break; } - + } return data; } From 7ed45bd0aacde6728ab4d37b5990d7cbe3cefa19 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 21:52:58 +0200 Subject: [PATCH 05/24] add "scrambling" --- src/mame/adp/servicetastatur.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index f9274847d33c8..e5e80080e1899 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -95,6 +95,8 @@ class servicet_state : public driver_device uint8_t port3_r(); void port3_w(uint8_t data); + uint8_t gsg_scramble(uint8_t data); + uint8_t gsg_r(offs_t offset); void gsg_w(offs_t offset, uint8_t data); @@ -234,6 +236,21 @@ void servicet_state::port3_w(uint8_t data) m_i2cmem->write_scl(BIT(data, PORT_3_SCL)); } +uint8_t servicet_state::gsg_scramble(uint8_t data) +{ + bool d1 = BIT(data,1) + bool d2 = BIT(data,2) + bool d3 = BIT(data,3) + + // zero d1-d3 + data &= ~(0b1110); + + // d1 and d3 are swapped + data |= (d3 << 1) | (d2 << 2) | (d1 << 3); + + return data; +} + uint8_t servicet_state::gsg_r(offs_t offset) { uint8_t data = 0xff; @@ -248,6 +265,7 @@ uint8_t servicet_state::gsg_r(offs_t offset) case 0x50: //Y5 U19 OE { popmessage("Read scrambled GSG"); + data = gsg_scramble(data); break; } case 0x60: //Y6 U13 PL @@ -271,6 +289,7 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) case 0x50: //Y5 U19 OE { popmessage("Write scrambled GSG in %02X",data); + data = gsg_scramble(data); break; } case 0x60: //Y6 U13 PL From 32478e6fc33405233f2e4ab745f5c900c86b46e3 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 22:25:26 +0200 Subject: [PATCH 06/24] massive blunder --- src/mame/adp/servicetastatur.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index e5e80080e1899..83182bf8c46ef 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -238,9 +238,9 @@ void servicet_state::port3_w(uint8_t data) uint8_t servicet_state::gsg_scramble(uint8_t data) { - bool d1 = BIT(data,1) - bool d2 = BIT(data,2) - bool d3 = BIT(data,3) + bool d1 = BIT(data,1); + bool d2 = BIT(data,2); + bool d3 = BIT(data,3); // zero d1-d3 data &= ~(0b1110); From 27da7dd790978e00454a0859f9af87af1097e915 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Wed, 3 Sep 2025 23:55:54 +0200 Subject: [PATCH 07/24] redo keyboard --- src/mame/adp/servicetastatur.cpp | 90 ++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 38 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 83182bf8c46ef..f7f5590c579a8 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -85,6 +85,8 @@ class servicet_state : public driver_device void servicet(machine_config &config); + DECLARE_INPUT_CHANGED_MEMBER(en_w); + protected: virtual void machine_start() override ATTR_COLD; virtual void machine_reset() override ATTR_COLD; @@ -92,6 +94,7 @@ class servicet_state : public driver_device private: uint8_t port1_r(); void port1_w(uint8_t data); + uint8_t port3_r(); void port3_w(uint8_t data); @@ -135,26 +138,26 @@ void servicet_state::servicet_io(address_map &map) static INPUT_PORTS_START( servicet ) PORT_START("IN0") // P1.0 - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START) PORT_NAME("OK") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("F4") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START) PORT_NAME("OK") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("F4") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY PORT_START("IN1") // P1.1 - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_4WAY - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_4WAY - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_4WAY PORT_START("IN2") // P1.2 - PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("F3") - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("F1") - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("F2") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("F3") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("F1") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("F2") PORT_START("P3") // P3 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1) PORT_NAME("INT0") - PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("INT1") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1) PORT_NAME("INT0") PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(servicet_state::en_w), 0) //MCS51_INT0_LINE + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("INT1") PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(servicet_state::en_w), 0) //MCS51_INT1_LINE + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_CUSTOM) PORT_READ_LINE_DEVICE_MEMBER("eeprom", FUNC(i2cmem_device::read_sda)) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) @@ -176,46 +179,57 @@ void servicet_state::machine_reset() uint8_t servicet_state::port1_r() { - uint8_t data = m_port1; // Start with what was written to port1 - - // key matrix scanning seems to be bidirectional - // CPU drives each line HIGH and checks if connected lines are also HIGH = button pressed + /* + * the keypad scan works by writing 0xfb,0xfd,0xfe (pulling rows low) to port 1 + * send seeing which bits end up low instead of high + */ + uint8_t data = m_port1; - // Column-to-Row scanning: When columns (P1.0-P1.2) are driven HIGH - for (int col = 0; col < 3; col++) + switch (m_port1) + { + case 0xfb: + { + uint8_t keys = m_io_keys[2]->read(); // F3, F1, F2 + data &= ~(keys & 0x70); + break; + } + case 0xfd: { - if (m_port1 & (1 << col)) // Column is driven HIGH - { - uint8_t keys = m_io_keys[col]->read(); - data |= (keys & 0x70); // Mask to only row bits (4,5,6) - } + uint8_t keys = m_io_keys[1]->read(); // Right, Left, Down + data &= ~(keys & 0x70); + break; } - - // Row-to-Column scanning: When rows (P1.4-P1.6) are driven HIGH - for (int row = 0; row < 3; row++) + case 0xfe: + { + uint8_t keys = m_io_keys[0]->read(); // OK, F4, Up + data &= ~(keys & 0x70); + break; + } + case 0xff: { - if (m_port1 & (1 << (row + 4))) // Row is driven HIGH (bits 4,5,6) - { - // Check all columns for this row - for (int col = 0; col < 3; col++) - { - uint8_t keys = m_io_keys[col]->read(); - if (keys & (1 << (row + 4))) // Key pressed in this row - { - data |= (1 << col); // Set corresponding column bit HIGH - } - } - } + // 0xff default + break; + } + default: + logerror("Invalid write to P1 %02d",data); + break; } return data; } + void servicet_state::port1_w(uint8_t data) { m_port1 = data; } +INPUT_CHANGED_MEMBER(servicet_state::en_w) +{ + m_maincpu->set_input_line(MCS51_INT0_LINE, newval ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(MCS51_INT1_LINE, newval ? CLEAR_LINE : ASSERT_LINE); +} + uint8_t servicet_state::port3_r() { uint8_t data = ioport("P3")->read(); From 62d0db6c3632b9b04fbcc1a80158959f6d8331b8 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 4 Sep 2025 09:46:06 +0200 Subject: [PATCH 08/24] clk in and chips --- src/mame/adp/servicetastatur.cpp | 41 +++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index f7f5590c579a8..0b1f1899a5267 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -115,7 +115,10 @@ class servicet_state : public driver_device uint8_t m_port1 = 0xff; uint8_t m_port3 = 0xff; - uint8_t m_lcd_data = 0; + + uint8_t m_u13 = 0xff; + uint8_t m_u19 = 0xff; + uint8_t m_u20 = 0xff; }; void servicet_state::servicet_map(address_map &map) @@ -167,14 +170,20 @@ void servicet_state::machine_start() { save_item(NAME(m_port1)); save_item(NAME(m_port3)); - save_item(NAME(m_lcd_data)); + + save_item(NAME(m_u13)); + save_item(NAME(m_u19)); + save_item(NAME(m_u20)); } void servicet_state::machine_reset() { m_port1 = 0xff; m_port3 = 0xff; - m_lcd_data = 0; + + m_u13 = 0xff; + m_u19 = 0xff; + m_u20 = 0xff; } uint8_t servicet_state::port1_r() @@ -226,8 +235,8 @@ void servicet_state::port1_w(uint8_t data) INPUT_CHANGED_MEMBER(servicet_state::en_w) { - m_maincpu->set_input_line(MCS51_INT0_LINE, newval ? ASSERT_LINE : CLEAR_LINE); - m_maincpu->set_input_line(MCS51_INT1_LINE, newval ? CLEAR_LINE : ASSERT_LINE); + m_maincpu->set_input_line(MCS51_INT1_LINE, newval ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(MCS51_INT0_LINE, newval ? CLEAR_LINE : ASSERT_LINE); } uint8_t servicet_state::port3_r() @@ -267,24 +276,26 @@ uint8_t servicet_state::gsg_scramble(uint8_t data) uint8_t servicet_state::gsg_r(offs_t offset) { - uint8_t data = 0xff; + uint8_t data = 0x00; switch (offset & 0x70) { case 0x40: //Y4 U20 OE { popmessage("Read GSG"); + data = m_u20; break; } case 0x50: //Y5 U19 OE { popmessage("Read scrambled GSG"); - data = gsg_scramble(data); + data = gsg_scramble(m_u19); break; } case 0x60: //Y6 U13 PL { popmessage("Read GSG out"); + data = m_u13; break; } } @@ -297,18 +308,17 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) { case 0x40: //Y4 U20 OE { - popmessage("Write GSG in %02X",data); + m_u20 = data; break; } case 0x50: //Y5 U19 OE { - popmessage("Write scrambled GSG in %02X",data); - data = gsg_scramble(data); + m_u13 = gsg_scramble(data); break; } case 0x60: //Y6 U13 PL { - popmessage("Write GSG out %02X",data); + m_u13 = data; break; } default: @@ -318,6 +328,15 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) } } +void clk_in(bool newval) +{ + m_u13 = 0xff; + m_u19 = 0xff; + m_u20 = 0xff; + + +} + void servicet_state::servicet(machine_config &config) { I80C31(config, m_maincpu, 11.0592_MHz_XTAL); From e7b73651bef9e8b19cc948ced5bb042bd0c06969 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 4 Sep 2025 11:19:18 +0200 Subject: [PATCH 09/24] clk --- src/mame/adp/servicetastatur.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 0b1f1899a5267..d835b01ddc416 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -103,6 +103,8 @@ class servicet_state : public driver_device uint8_t gsg_r(offs_t offset); void gsg_w(offs_t offset, uint8_t data); + void clk_in(bool newval); + void servicet_io(address_map &map) ATTR_COLD; void servicet_map(address_map &map) ATTR_COLD; @@ -328,13 +330,11 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) } } -void clk_in(bool newval) +void servicet_state::clk_in(bool newval) { m_u13 = 0xff; m_u19 = 0xff; m_u20 = 0xff; - - } void servicet_state::servicet(machine_config &config) From c40c697281bab0edce24127e3fedc239f28324f8 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 4 Sep 2025 22:51:56 +0200 Subject: [PATCH 10/24] the keypad is much simpler than i thought --- src/mame/adp/servicetastatur.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index d835b01ddc416..9649a2cb2ac97 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -143,19 +143,34 @@ void servicet_state::servicet_io(address_map &map) static INPUT_PORTS_START( servicet ) PORT_START("IN0") // P1.0 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START) PORT_NAME("OK") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("F4") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("IN1") // P1.1 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_4WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_4WAY PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_4WAY + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("IN2") // P1.2 + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("F3") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("F1") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("F2") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("P3") // P3 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) @@ -200,20 +215,17 @@ uint8_t servicet_state::port1_r() { case 0xfb: { - uint8_t keys = m_io_keys[2]->read(); // F3, F1, F2 - data &= ~(keys & 0x70); + data = ioport("IN2")->read(); // F3, F1, F2 break; } case 0xfd: { - uint8_t keys = m_io_keys[1]->read(); // Right, Left, Down - data &= ~(keys & 0x70); + data = ioport("IN1")->read(); // Right, Left, Down break; } case 0xfe: { - uint8_t keys = m_io_keys[0]->read(); // OK, F4, Up - data &= ~(keys & 0x70); + data = ioport("IN0")->read(); // OK, F4, Up break; } case 0xff: @@ -223,6 +235,7 @@ uint8_t servicet_state::port1_r() } default: logerror("Invalid write to P1 %02d",data); + clk_in(true); //warning go away break; } From 11be5e71a0ee1ae6f350b3ca21145f91e70a6efd Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 4 Sep 2025 23:30:46 +0200 Subject: [PATCH 11/24] some serial notes --- src/mame/adp/servicetastatur.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 9649a2cb2ac97..6c41119e91b30 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -40,6 +40,7 @@ ___| XTAL 80C31 +KEYPAD+ |__ */ #include "emu.h" +#include "bus/rs232/rs232.h" #include "cpu/mcs51/mcs51.h" #include "machine/i2cmem.h" #include "video/hd44780.h" @@ -103,7 +104,8 @@ class servicet_state : public driver_device uint8_t gsg_r(offs_t offset); void gsg_w(offs_t offset, uint8_t data); - void clk_in(bool newval); + void enable_in(int state); + void data_in(int state); void servicet_io(address_map &map) ATTR_COLD; void servicet_map(address_map &map) ATTR_COLD; @@ -235,7 +237,6 @@ uint8_t servicet_state::port1_r() } default: logerror("Invalid write to P1 %02d",data); - clk_in(true); //warning go away break; } @@ -252,6 +253,7 @@ INPUT_CHANGED_MEMBER(servicet_state::en_w) { m_maincpu->set_input_line(MCS51_INT1_LINE, newval ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(MCS51_INT0_LINE, newval ? CLEAR_LINE : ASSERT_LINE); + enable_in(1); } uint8_t servicet_state::port3_r() @@ -334,6 +336,7 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) case 0x60: //Y6 U13 PL { m_u13 = data; + popmessage("Send to machine: %02X", data); break; } default: @@ -343,11 +346,14 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) } } -void servicet_state::clk_in(bool newval) +void servicet_state::data_in(int state) { - m_u13 = 0xff; - m_u19 = 0xff; - m_u20 = 0xff; + m_u20 = (m_u20 >> 1) | (0xFE & state); +} + +void servicet_state::enable_in(int state) +{ + //strobe u19 and u20 } void servicet_state::servicet(machine_config &config) @@ -364,6 +370,11 @@ void servicet_state::servicet(machine_config &config) // I2C EEPROM: 24C16 (2KB) - connected to P3.4 (SDA) and P3.5 (SCL) I2C_24C16(config, "eeprom"); + // SERIAL: WE ARE THE DCE + rs232_port_device &dte(RS232_PORT(config, "dte", default_rs232_devices, nullptr)); + dte.dcd_handler().set(FUNC(servicet_state::enable_in)); + dte.rxd_handler().set(FUNC(servicet_state::data_in)); + // LCD4002A screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); screen.set_color(rgb_t(6, 120, 245)); From 21f13e3d6a4a7533ca9d795791ecc72a25c8d47f Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sat, 6 Sep 2025 10:58:52 +0200 Subject: [PATCH 12/24] add serial --- src/mame/adp/servicetastatur.cpp | 48 +++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 6c41119e91b30..7aad9bc9cbf1f 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -81,7 +81,9 @@ class servicet_state : public driver_device m_maincpu(*this, "maincpu"), m_i2cmem(*this, "eeprom"), m_lcd(*this, "hd44780"), + m_dte(*this, "dte"), m_io_keys(*this, "IN%u", 0U) + { } void servicet(machine_config &config); @@ -105,6 +107,7 @@ class servicet_state : public driver_device void gsg_w(offs_t offset, uint8_t data); void enable_in(int state); + void clock_in(int state); void data_in(int state); void servicet_io(address_map &map) ATTR_COLD; @@ -115,8 +118,11 @@ class servicet_state : public driver_device required_device m_maincpu; required_device m_i2cmem; required_device m_lcd; + required_device m_dte; required_ioport_array<3> m_io_keys; + bool m_datain = 0; + uint8_t m_port1 = 0xff; uint8_t m_port3 = 0xff; @@ -251,9 +257,7 @@ void servicet_state::port1_w(uint8_t data) INPUT_CHANGED_MEMBER(servicet_state::en_w) { - m_maincpu->set_input_line(MCS51_INT1_LINE, newval ? ASSERT_LINE : CLEAR_LINE); - m_maincpu->set_input_line(MCS51_INT0_LINE, newval ? CLEAR_LINE : ASSERT_LINE); - enable_in(1); + enable_in(newval); } uint8_t servicet_state::port3_r() @@ -293,7 +297,7 @@ uint8_t servicet_state::gsg_scramble(uint8_t data) uint8_t servicet_state::gsg_r(offs_t offset) { - uint8_t data = 0x00; + uint8_t data = std::rand(); switch (offset & 0x70) { @@ -315,6 +319,8 @@ uint8_t servicet_state::gsg_r(offs_t offset) data = m_u13; break; } + default: + popmessage("Read jack shit %02X", offset); } return data; } @@ -326,11 +332,13 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) case 0x40: //Y4 U20 OE { m_u20 = data; + popmessage("Wrote U20: %02X", data); break; } case 0x50: //Y5 U19 OE { m_u13 = gsg_scramble(data); + popmessage("Wrote U13: %02X", data); break; } case 0x60: //Y6 U13 PL @@ -341,19 +349,38 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) } default: { - //popmessage("Bus write: %02X to %04X\n", data, offset); + popmessage("Garbage write: %02X to %04X\n", data, offset); } } } void servicet_state::data_in(int state) { - m_u20 = (m_u20 >> 1) | (0xFE & state); + m_datain = state; } -void servicet_state::enable_in(int state) +void servicet_state::clock_in(int state) +{ + if (state) + { + // --- INPUT SHIFT CHAIN (U20 + U19, 74HC4094) --- + uint16_t chain = (m_u19 << 8) | m_u20; + chain = ((chain << 1) | m_datain) & 0xFFFF; + m_u20 = chain & 0xFF; + m_u19 = (chain >> 8) & 0xFF; + + // --- OUTPUT SHIFT REGISTER (U13, 74HC165) --- + int q7 = (m_u13 >> 7) & 1; + m_dte->write_txd(q7); + m_u13 = (m_u13 << 1) & 0xFF; + } +} + +void servicet_state::enable_in(int newval) { //strobe u19 and u20 + m_maincpu->set_input_line(MCS51_INT1_LINE, newval ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(MCS51_INT0_LINE, newval ? CLEAR_LINE : ASSERT_LINE); } void servicet_state::servicet(machine_config &config) @@ -371,9 +398,10 @@ void servicet_state::servicet(machine_config &config) I2C_24C16(config, "eeprom"); // SERIAL: WE ARE THE DCE - rs232_port_device &dte(RS232_PORT(config, "dte", default_rs232_devices, nullptr)); - dte.dcd_handler().set(FUNC(servicet_state::enable_in)); - dte.rxd_handler().set(FUNC(servicet_state::data_in)); + RS232_PORT(config, m_dte, default_rs232_devices, nullptr); + m_dte->dcd_handler().set(FUNC(servicet_state::enable_in)); + m_dte->rxd_handler().set(FUNC(servicet_state::data_in)); + m_dte->cts_handler().set(FUNC(servicet_state::clock_in)); // LCD4002A screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); From 650c69d63e4f35216ed9f150f6c0d657156e3f50 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sat, 6 Sep 2025 11:04:58 +0200 Subject: [PATCH 13/24] proper palette --- src/mame/adp/servicetastatur.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 7aad9bc9cbf1f..8379eb0aa0589 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -113,6 +113,8 @@ class servicet_state : public driver_device void servicet_io(address_map &map) ATTR_COLD; void servicet_map(address_map &map) ATTR_COLD; + void palette_init(palette_device &palette); + HD44780_PIXEL_UPDATE(servicet_pixel_update); required_device m_maincpu; @@ -383,6 +385,12 @@ void servicet_state::enable_in(int newval) m_maincpu->set_input_line(MCS51_INT0_LINE, newval ? CLEAR_LINE : ASSERT_LINE); } +void servicet_state::palette_init(palette_device &palette) +{ + palette.set_pen_color(0, rgb_t(65, 165, 115)); + palette.set_pen_color(1, rgb_t(0, 50, 25)); +} + void servicet_state::servicet(machine_config &config) { I80C31(config, m_maincpu, 11.0592_MHz_XTAL); @@ -413,7 +421,7 @@ void servicet_state::servicet(machine_config &config) screen.set_screen_update("hd44780", FUNC(hd44780_device::screen_update)); screen.set_palette("palette"); - PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED); + PALETTE(config, "palette", FUNC(servicet_state::palette_init), 2); HD44780(config, m_lcd, 270'000); m_lcd->set_lcd_size(2, 40); // 2 lines, 40 characters From f160135324916c9a359ba13b9b4ef5675be28bda Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sat, 6 Sep 2025 11:14:02 +0200 Subject: [PATCH 14/24] prep serial --- src/mame/adp/stellafr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mame/adp/stellafr.cpp b/src/mame/adp/stellafr.cpp index 5a96275ce225b..f77db32ce7de0 100644 --- a/src/mame/adp/stellafr.cpp +++ b/src/mame/adp/stellafr.cpp @@ -90,6 +90,7 @@ Sound and I/O board: #include "emu.h" +#include "bus/rs232/rs232.h" #include "cpu/m68000/m68000.h" #include "machine/mc68681.h" #include "machine/nvram.h" @@ -197,6 +198,7 @@ class stellafr_state : public driver_device m_duart(*this, "duart"), m_nvram(*this, "nvram"), m_dac(*this, "dac"), + m_st(*this, "st"), m_digits(*this, "digit%u", 0U), m_lamps(*this, "lamp%u", 0U), m_leds(*this, "led%u", 0U), @@ -214,6 +216,7 @@ class stellafr_state : public driver_device required_device m_duart; required_device m_nvram; required_device m_dac; + required_device m_st; output_finder<8> m_digits; output_finder<128> m_lamps; output_finder<2> m_leds; @@ -391,6 +394,9 @@ void stellafr_state::stellafr(machine_config &config) NVRAM(config, m_nvram, nvram_device::DEFAULT_NONE); AD7224(config, m_dac, 0); + + RS232_PORT(config, m_st, default_rs232_devices, nullptr); + //m_st->rxd_handler().set(FUNC(stellafr_state::st_in)); SPEAKER(config, "mono").front_center(); ay8910_device &aysnd(AY8910(config, "aysnd", 1000000)); From e3ea705ed53ed70189210f70ca8c3b061d1065c7 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sat, 6 Sep 2025 11:20:43 +0200 Subject: [PATCH 15/24] receive service tastatur --- src/mame/adp/stellafr.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mame/adp/stellafr.cpp b/src/mame/adp/stellafr.cpp index f77db32ce7de0..90e67e46c8ea3 100644 --- a/src/mame/adp/stellafr.cpp +++ b/src/mame/adp/stellafr.cpp @@ -231,6 +231,8 @@ class stellafr_state : public driver_device uint8_t m_anz2; uint8_t m_mux2; + bool m_outst; + uint8_t mux_r(); void mux_w(uint8_t data); void mux2_w(uint8_t data); @@ -238,6 +240,8 @@ class stellafr_state : public driver_device void ay8910_portb_w(uint8_t data); void lamps_w(uint8_t row, uint16_t data); + void st_in(uint8_t data); + void mem_map(address_map &map) ATTR_COLD; void fc7_map(address_map &map) ATTR_COLD; @@ -249,7 +253,6 @@ uint8_t stellafr_state::mux_r() bool li = false; bool emp = false; bool ma = false; - bool st = false; bool t = false; // main buttons in bool t2 = false; bool emp2 = false; @@ -260,7 +263,7 @@ uint8_t stellafr_state::mux_r() if (li) data |= (1 << U10_OUTLI); if (emp) data |= (1 << U10_OUTEMP); if (ma) data |= (1 << U10_OUTMA); - if (st) data |= (1 << U10_OUTST); + if (m_outst) data |= (1 << U10_OUTST); if (t) data |= (1 << U10_OUTT); if (t2) data |= (1 << U10_OUTT2); if (emp2) data |= (1 << U10_EMP2); @@ -280,6 +283,11 @@ void stellafr_state::lamps_w(uint8_t row, uint16_t data) } } +void stellafr_state::st_in(uint8_t data) +{ + m_outst = data; +} + void stellafr_state::mux_w(uint8_t data) { bool enma1 = BIT(data,U5_EN1MA); @@ -394,9 +402,9 @@ void stellafr_state::stellafr(machine_config &config) NVRAM(config, m_nvram, nvram_device::DEFAULT_NONE); AD7224(config, m_dac, 0); - + RS232_PORT(config, m_st, default_rs232_devices, nullptr); - //m_st->rxd_handler().set(FUNC(stellafr_state::st_in)); + m_st->rxd_handler().set(FUNC(stellafr_state::st_in)); SPEAKER(config, "mono").front_center(); ay8910_device &aysnd(AY8910(config, "aysnd", 1000000)); From 0faacb719a98eb36995b1aa3b1b54c61f205db0f Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sat, 6 Sep 2025 11:28:01 +0200 Subject: [PATCH 16/24] write to st --- src/mame/adp/servicetastatur.cpp | 2 +- src/mame/adp/stellafr.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 8379eb0aa0589..4da72d6d3279e 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -407,7 +407,7 @@ void servicet_state::servicet(machine_config &config) // SERIAL: WE ARE THE DCE RS232_PORT(config, m_dte, default_rs232_devices, nullptr); - m_dte->dcd_handler().set(FUNC(servicet_state::enable_in)); + m_dte->dsr_handler().set(FUNC(servicet_state::enable_in)); m_dte->rxd_handler().set(FUNC(servicet_state::data_in)); m_dte->cts_handler().set(FUNC(servicet_state::clock_in)); diff --git a/src/mame/adp/stellafr.cpp b/src/mame/adp/stellafr.cpp index 90e67e46c8ea3..de91b994a68bf 100644 --- a/src/mame/adp/stellafr.cpp +++ b/src/mame/adp/stellafr.cpp @@ -319,6 +319,12 @@ void stellafr_state::mux_w(uint8_t data) ; if (aw2) ; + + m_st->write_rts(1); + m_st->write_dtr(enanz1); + m_st->write_rts(0); + + } void stellafr_state::mux2_w(uint8_t data) @@ -333,6 +339,10 @@ void stellafr_state::mux2_w(uint8_t data) m_mux1 = (m_mux1 << 1) | BIT(data,U1_MUX1); m_anz2 = (m_anz2 << 1) | BIT(data,U1_ANZ2); m_mux2 = (m_mux2 << 1) | BIT(data,U1_MUX2); + + m_st->write_rts(1); + m_st->write_txd(m_ma1); + m_st->write_rts(0); } void stellafr_state::duart_output_w(uint8_t data) From 52b62caae90990e405f94406622a05e311d93e17 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sun, 7 Sep 2025 19:23:18 +0200 Subject: [PATCH 17/24] add clickable layout --- src/mame/adp/servicetastatur.cpp | 4 +- src/mame/layout/servicet.lay | 133 +++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 src/mame/layout/servicet.lay diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 4da72d6d3279e..61d1121c7aa83 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -47,6 +47,8 @@ ___| XTAL 80C31 +KEYPAD+ |__ #include "emupal.h" #include "screen.h" +#include "servicet.lh" + namespace { enum @@ -436,4 +438,4 @@ ROM_END } // anonymous namespace -GAME( 1992, servicet, 0, servicet, servicet, servicet_state, empty_init, ROT0, "ADP", u8"Merkur Service Testgerät", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) +GAMEL( 1992, servicet, 0, servicet, servicet, servicet_state, empty_init, ROT0, "ADP", u8"Merkur Service Testgerät", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW, layout_servicet ) diff --git a/src/mame/layout/servicet.lay b/src/mame/layout/servicet.lay new file mode 100644 index 0000000000000..0fd6b3e2d47c7 --- /dev/null +++ b/src/mame/layout/servicet.lay @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From e0d064d203664cce8d97fd4e3dffb84b10cd92a7 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 4 Nov 2025 22:23:05 +0100 Subject: [PATCH 18/24] no rand --- src/mame/adp/servicetastatur.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index d1ef8f242f791..a3c3895d39dba 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -301,7 +301,7 @@ uint8_t servicet_state::gsg_scramble(uint8_t data) uint8_t servicet_state::gsg_r(offs_t offset) { - uint8_t data = std::rand(); + uint8_t data = 0xff; switch (offset & 0x70) { From 516a9e888a2112c114343a35b76f6788616620ed Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 4 Nov 2025 22:24:26 +0100 Subject: [PATCH 19/24] srcclean --- src/mame/adp/servicetastatur.cpp | 46 ++++---- src/mame/adp/stellafr.cpp | 2 +- src/mame/layout/servicet.lay | 188 +++++++++++++++---------------- 3 files changed, 118 insertions(+), 118 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index a3c3895d39dba..db7401483aa9f 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -85,7 +85,7 @@ class servicet_state : public driver_device m_lcd(*this, "hd44780"), m_dte(*this, "dte"), m_io_keys(*this, "IN%u", 0U) - + { } void servicet(machine_config &config) ATTR_COLD; @@ -286,17 +286,17 @@ void servicet_state::port3_w(uint8_t data) uint8_t servicet_state::gsg_scramble(uint8_t data) { - bool d1 = BIT(data,1); - bool d2 = BIT(data,2); - bool d3 = BIT(data,3); + bool d1 = BIT(data,1); + bool d2 = BIT(data,2); + bool d3 = BIT(data,3); - // zero d1-d3 - data &= ~(0b1110); + // zero d1-d3 + data &= ~(0b1110); - // d1 and d3 are swapped - data |= (d3 << 1) | (d2 << 2) | (d1 << 3); + // d1 and d3 are swapped + data |= (d3 << 1) | (d2 << 2) | (d1 << 3); - return data; + return data; } uint8_t servicet_state::gsg_r(offs_t offset) @@ -360,24 +360,24 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) void servicet_state::data_in(int state) { - m_datain = state; + m_datain = state; } void servicet_state::clock_in(int state) { - if (state) - { - // --- INPUT SHIFT CHAIN (U20 + U19, 74HC4094) --- - uint16_t chain = (m_u19 << 8) | m_u20; - chain = ((chain << 1) | m_datain) & 0xFFFF; - m_u20 = chain & 0xFF; - m_u19 = (chain >> 8) & 0xFF; - - // --- OUTPUT SHIFT REGISTER (U13, 74HC165) --- - int q7 = (m_u13 >> 7) & 1; - m_dte->write_txd(q7); - m_u13 = (m_u13 << 1) & 0xFF; - } + if (state) + { + // --- INPUT SHIFT CHAIN (U20 + U19, 74HC4094) --- + uint16_t chain = (m_u19 << 8) | m_u20; + chain = ((chain << 1) | m_datain) & 0xFFFF; + m_u20 = chain & 0xFF; + m_u19 = (chain >> 8) & 0xFF; + + // --- OUTPUT SHIFT REGISTER (U13, 74HC165) --- + int q7 = (m_u13 >> 7) & 1; + m_dte->write_txd(q7); + m_u13 = (m_u13 << 1) & 0xFF; + } } void servicet_state::enable_in(int newval) diff --git a/src/mame/adp/stellafr.cpp b/src/mame/adp/stellafr.cpp index de91b994a68bf..23f9fbaf4659e 100644 --- a/src/mame/adp/stellafr.cpp +++ b/src/mame/adp/stellafr.cpp @@ -324,7 +324,7 @@ void stellafr_state::mux_w(uint8_t data) m_st->write_dtr(enanz1); m_st->write_rts(0); - + } void stellafr_state::mux2_w(uint8_t data) diff --git a/src/mame/layout/servicet.lay b/src/mame/layout/servicet.lay index 0fd6b3e2d47c7..e7971b608f9fd 100644 --- a/src/mame/layout/servicet.lay +++ b/src/mame/layout/servicet.lay @@ -3,131 +3,131 @@ license:CC0-1.0 --> - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - - \ No newline at end of file + + From 049cdd956d9d29f16154cb281d791be0e41c7dd2 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 4 Nov 2025 22:45:48 +0100 Subject: [PATCH 20/24] cpu type --- src/mame/adp/servicetastatur.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index db7401483aa9f..79b726bd781c6 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -41,7 +41,7 @@ ___| XTAL 80C31 +KEYPAD+ |__ #include "emu.h" #include "bus/rs232/rs232.h" -#include "cpu/mcs51/mcs51.h" +#include "cpu/mcs51/i80c51.h" #include "machine/i2cmem.h" #include "video/hd44780.h" #include "emupal.h" From a7dbd230b76d9d09d483adc67f0c3ca60cb38e37 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 6 Nov 2025 18:26:35 +0100 Subject: [PATCH 21/24] cleanup --- src/mame/adp/servicetastatur.cpp | 16 +++++++++------- src/mame/adp/stellafr.cpp | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 79b726bd781c6..a78972530084d 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -40,10 +40,12 @@ ___| XTAL 80C31 +KEYPAD+ |__ */ #include "emu.h" + #include "bus/rs232/rs232.h" #include "cpu/mcs51/i80c51.h" #include "machine/i2cmem.h" #include "video/hd44780.h" + #include "emupal.h" #include "screen.h" @@ -268,10 +270,10 @@ uint8_t servicet_state::port3_r() { uint8_t data = ioport("P3")->read(); - uint8_t const sda = m_i2cmem->read_sda(); + uint8_t const SDA = m_i2cmem->read_sda(); // Clear bit 4 (SDA) and insert actual value from EEPROM - data = (data & ~(1 << PORT_3_SDA)) | (sda ? (1 << PORT_3_SDA) : 0); + data = (data & ~(1 << PORT_3_SDA)) | (SDA ? (1 << PORT_3_SDA) : 0); return data; } @@ -353,7 +355,7 @@ void servicet_state::gsg_w(offs_t offset, uint8_t data) } default: { - popmessage("Garbage write: %02X to %04X\n", data, offset); + popmessage("Unknown write: %02X to %04X\n", data, offset); } } } @@ -369,14 +371,14 @@ void servicet_state::clock_in(int state) { // --- INPUT SHIFT CHAIN (U20 + U19, 74HC4094) --- uint16_t chain = (m_u19 << 8) | m_u20; - chain = ((chain << 1) | m_datain) & 0xFFFF; - m_u20 = chain & 0xFF; - m_u19 = (chain >> 8) & 0xFF; + chain = ((chain << 1) | m_datain) & 0xffff; + m_u20 = chain & 0xff; + m_u19 = (chain >> 8) & 0xff; // --- OUTPUT SHIFT REGISTER (U13, 74HC165) --- int q7 = (m_u13 >> 7) & 1; m_dte->write_txd(q7); - m_u13 = (m_u13 << 1) & 0xFF; + m_u13 = (m_u13 << 1) & 0xff; } } diff --git a/src/mame/adp/stellafr.cpp b/src/mame/adp/stellafr.cpp index 23f9fbaf4659e..6093de0733496 100644 --- a/src/mame/adp/stellafr.cpp +++ b/src/mame/adp/stellafr.cpp @@ -90,19 +90,21 @@ Sound and I/O board: #include "emu.h" + #include "bus/rs232/rs232.h" #include "cpu/m68000/m68000.h" #include "machine/mc68681.h" #include "machine/nvram.h" #include "sound/ay8910.h" #include "sound/dac.h" + #include "speaker.h" +#include "stellafr.lh" + //#define VERBOSE 1 #include "logmacro.h" -#include "stellafr.lh" - namespace { enum From fbc6186e4f454e5ba679dbedf1cd6bbef7ebcc0a Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 6 Nov 2025 19:40:05 +0100 Subject: [PATCH 22/24] use m_io_keys --- src/mame/adp/servicetastatur.cpp | 39 +++++++------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index a78972530084d..8caed7e55e239 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -161,9 +161,9 @@ static INPUT_PORTS_START( servicet ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START) PORT_NAME("OK") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("F4") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START) PORT_NAME("OK") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("F4") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("IN1") // P1.1 @@ -225,32 +225,9 @@ uint8_t servicet_state::port1_r() */ uint8_t data = m_port1; - switch (m_port1) - { - case 0xfb: - { - data = ioport("IN2")->read(); // F3, F1, F2 - break; - } - case 0xfd: - { - data = ioport("IN1")->read(); // Right, Left, Down - break; - } - case 0xfe: - { - data = ioport("IN0")->read(); // OK, F4, Up - break; - } - case 0xff: - { - // 0xff default - break; - } - default: - logerror("Invalid write to P1 %02d",data); - break; - } + if (BIT(m_port1, 0)==0) data &= m_io_keys[0]->read(); + if (BIT(m_port1, 1)==0) data &= m_io_keys[1]->read(); + if (BIT(m_port1, 2)==0) data &= m_io_keys[2]->read(); return data; } @@ -268,7 +245,7 @@ INPUT_CHANGED_MEMBER(servicet_state::en_w) uint8_t servicet_state::port3_r() { - uint8_t data = ioport("P3")->read(); + uint8_t data = m_io_keys[3]->read(); uint8_t const SDA = m_i2cmem->read_sda(); @@ -326,7 +303,7 @@ uint8_t servicet_state::gsg_r(offs_t offset) break; } default: - popmessage("Read jack shit %02X", offset); + popmessage("Read unknown %02X", offset); } return data; } From 35a57eb75372ec7e7d512090ad5305f2077a240e Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Thu, 6 Nov 2025 19:43:50 +0100 Subject: [PATCH 23/24] remove rts "clock" --- src/mame/adp/stellafr.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/mame/adp/stellafr.cpp b/src/mame/adp/stellafr.cpp index 6093de0733496..ef16f2fbc973c 100644 --- a/src/mame/adp/stellafr.cpp +++ b/src/mame/adp/stellafr.cpp @@ -322,11 +322,7 @@ void stellafr_state::mux_w(uint8_t data) if (aw2) ; - m_st->write_rts(1); m_st->write_dtr(enanz1); - m_st->write_rts(0); - - } void stellafr_state::mux2_w(uint8_t data) @@ -342,9 +338,7 @@ void stellafr_state::mux2_w(uint8_t data) m_anz2 = (m_anz2 << 1) | BIT(data,U1_ANZ2); m_mux2 = (m_mux2 << 1) | BIT(data,U1_MUX2); - m_st->write_rts(1); m_st->write_txd(m_ma1); - m_st->write_rts(0); } void stellafr_state::duart_output_w(uint8_t data) From fdae5f4f673efafcf3c5e63897aeadc8db4a3d08 Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Fri, 7 Nov 2025 10:04:21 +0100 Subject: [PATCH 24/24] let the & handle the rows --- src/mame/adp/servicetastatur.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/mame/adp/servicetastatur.cpp b/src/mame/adp/servicetastatur.cpp index 8caed7e55e239..d5ab00f4f97ae 100644 --- a/src/mame/adp/servicetastatur.cpp +++ b/src/mame/adp/servicetastatur.cpp @@ -157,30 +157,21 @@ void servicet_state::servicet_data(address_map &map) static INPUT_PORTS_START( servicet ) PORT_START("IN0") // P1.0 - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START) PORT_NAME("OK") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4) PORT_NAME("F4") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_4WAY PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("IN1") // P1.1 - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_4WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_4WAY PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_4WAY PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("IN2") // P1.2 - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_NAME("F3") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_NAME("F1") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_NAME("F2")