summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Joakim Larsson Edström <joakimlarsson42@gmail.com>2019-10-30 22:49:24 +0100
committer ajrhacker <ajrhacker@users.noreply.github.com>2019-10-30 17:49:24 -0400
commit9582866bbf8c5c59e4c925b9b74cd6af1dc45eb1 (patch)
tree688f987d1dbb57570c4038406fc6c3c01648b889
parentfe1612aa8120d3c3e4fcb97ac070b44360db3a7d (diff)
EPC: Keyboard working, added leds and removed imperfect feature (#5832)
* i8251.cpp: required initial state to enable receiver of a 8251a and also to avoid sending start bit to diserial on reset and get framing error * eispc_kb.cpp: removed need for scheduler abuse as problem is fixed by correcting the init of the i8251 USART on host side instead * eispc.cpp: removed an obsolete TODO * eispc_kb.h: removed imperfect_features marking * epc: Added keyboard LEDs, Caps and Num lock works with current keyboard rom, scroll lock led needs a dump from a newer keyboard
-rw-r--r--src/mame/drivers/eispc.cpp13
-rw-r--r--src/mame/layout/epc.lay34
-rw-r--r--src/mame/machine/eispc_kb.cpp15
-rw-r--r--src/mame/machine/eispc_kb.h8
4 files changed, 66 insertions, 4 deletions
diff --git a/src/mame/drivers/eispc.cpp b/src/mame/drivers/eispc.cpp
index 73ac0c415f2..4536ab11ddf 100644
--- a/src/mame/drivers/eispc.cpp
+++ b/src/mame/drivers/eispc.cpp
@@ -43,6 +43,7 @@
#include "emu.h"
#include "machine/eispc_kb.h"
+#include "epc.lh"
// Devices
#include "cpu/i86/i86.h"
@@ -113,6 +114,7 @@ public:
, m_lpt(*this, "lpt")
, m_kbd8251(*this, "kbd8251")
, m_keyboard(*this, "keyboard")
+ , m_leds(*this, "kbled%u")
, m_pic8259(*this, "pic8259")
, m_pit8253(*this, "pit8253")
, m_speaker(*this, "speaker")
@@ -170,6 +172,7 @@ private:
emu_timer *m_kbdclk_timer;
TIMER_CALLBACK_MEMBER(rxtxclk_w);
int m_rxtx_clk_state;
+ output_finder<3> m_leds;
// Interrupt Controller
required_device<pic8259_device> m_pic8259;
@@ -475,6 +478,8 @@ void epc_state::machine_start()
save_item(NAME(m_drq));
save_item(NAME(m_fdc_irq));
save_item(NAME(m_fdc_drq));
+
+ m_leds.resolve();
}
void epc_state::machine_reset()
@@ -738,6 +743,8 @@ static void epc_sd_floppies(device_slot_interface &device)
void epc_state::epc(machine_config &config)
{
+ config.set_default_layout(layout_epc);
+
I8088(config, m_maincpu, XTAL(14'318'181) / 3.0); // TWE crystal marked X1 verified divided through a 82874
m_maincpu->set_addrmap(AS_PROGRAM, &epc_state::epc_map);
m_maincpu->set_addrmap(AS_IO, &epc_state::epc_io);
@@ -762,11 +769,15 @@ void epc_state::epc(machine_config &config)
m_dma8237a->out_dack_callback<3>().set(FUNC(epc_state::epc_dack_w<3>));
// TTL-level serial keyboard callback
- EISPC_KB(config, "keyboard").txd_cb().set([this](bool state)
+ EISPC_KB(config, m_keyboard);
+ m_keyboard->txd_cb().set([this](bool state)
{
LOGBITS("KBD->EPC: %d\n", state);
m_kbd8251->write_rxd(state);
});
+ m_keyboard->caps_cb().set( [this](bool state){ m_leds[0] = state; });
+ m_keyboard->num_cb().set( [this](bool state){ m_leds[1] = state; });
+ m_keyboard->scroll_cb().set([this](bool state){ m_leds[2] = state; });
// Keyboard USART
I8251( config, m_kbd8251, XTAL(14'318'181) / 6.0 ); // TWE crystal marked X1 verified divided through a 82874
diff --git a/src/mame/layout/epc.lay b/src/mame/layout/epc.lay
new file mode 100644
index 00000000000..f775109be10
--- /dev/null
+++ b/src/mame/layout/epc.lay
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!--
+license:CC0
+copyright-holders:Joakim Larsson Edstrom
+LEDs for the Ericsson PC keyboard
+-->
+<mamelayout version="2">
+ <element name="text_caps"><text string="Caps Lock"><color red="0.7" green="0.7" blue="0.7" /></text></element>
+ <element name="text_num"><text string="Num Lock"><color red="0.7" green="0.7" blue="0.7" /></text></element>
+ <element name="text_scroll"><text string="Scroll Lock"><color red="0.7" green="0.7" blue="0.7" /></text></element>
+ <element name="led" defstate="0"><disk><color red="0.85" green="0.18" blue="0.16" /></disk></element>
+
+ <group name="caps">
+ <bezel element="led" name="kbled0"><bounds x="0" y="0" width="100" height="100" /></bezel>
+ <bezel element="text_caps"><bounds x="120" y="0" width="900" height="100" /></bezel>
+ </group>
+
+ <group name="num">
+ <bezel element="led" name="kbled1"><bounds x="0" y="0" width="100" height="100" /></bezel>
+ <bezel element="text_num"><bounds x="120" y="0" width="800" height="100" /></bezel>
+ </group>
+
+ <group name="scroll">
+ <bezel element="led" name="kbled2"><bounds x="0" y="0" width="100" height="100" /></bezel>
+ <bezel element="text_scroll"><bounds x="120" y="0" width="1000" height="100" /></bezel>
+ </group>
+
+ <view name="Default Layout">
+ <screen index="0"><bounds left="0" top="150" right="1000" bottom="900" /></screen>
+ <group ref="caps"> <bounds x="0" y="0" width="90" height="10" /></group>
+ <group ref="num"> <bounds x="110" y="0" width="80" height="10" /></group>
+ <group ref="scroll"><bounds x="210" y="0" width="100" height="10" /></group>
+ </view>
+</mamelayout>
diff --git a/src/mame/machine/eispc_kb.cpp b/src/mame/machine/eispc_kb.cpp
index 1befb833bc7..2494102a0ab 100644
--- a/src/mame/machine/eispc_kb.cpp
+++ b/src/mame/machine/eispc_kb.cpp
@@ -85,8 +85,9 @@
#define LOG_RESET (1U << 2)
#define LOG_BITS (1U << 3)
#define LOG_UI (1U << 4)
+#define LOG_LEDS (1U << 5)
-//#define VERBOSE (LOG_UI)
+//#define VERBOSE (LOG_LEDS)
//#define LOG_OUTPUT_STREAM std::cout
#include "logmacro.h"
@@ -95,6 +96,7 @@
#define LOGRST(...) LOGMASKED(LOG_RESET, __VA_ARGS__)
#define LOGBITS(...) LOGMASKED(LOG_BITS, __VA_ARGS__)
#define LOGUI(...) LOGMASKED(LOG_UI, __VA_ARGS__)
+#define LOGLEDS(...) LOGMASKED(LOG_LEDS, __VA_ARGS__)
//**************************************************************************
// MACROS / CONSTANTS
@@ -249,6 +251,9 @@ eispc_keyboard_device::eispc_keyboard_device(
, m_mcu(*this, M6801_TAG)
, m_rows(*this, "P1%u", 0)
, m_txd_cb(*this)
+ , m_led_caps_cb(*this)
+ , m_led_num_cb(*this)
+ , m_led_scroll_cb(*this)
, m_rxd_high(true)
, m_txd_high(true)
, m_hold(true)
@@ -288,6 +293,9 @@ WRITE_LINE_MEMBER(eispc_keyboard_device::rst_line_w)
void eispc_keyboard_device::device_start()
{
m_txd_cb.resolve_safe();
+ m_led_caps_cb.resolve_safe();
+ m_led_num_cb.resolve_safe();
+ m_led_scroll_cb.resolve_safe();
save_item(NAME(m_rxd_high));
save_item(NAME(m_txd_high));
@@ -330,6 +338,8 @@ void eispc_keyboard_device::device_add_mconfig(machine_config &config)
m_mcu->out_p1_cb().set([this](uint8_t data)
{
LOGPORTS("Writing %02x PORT 1\n", data);
+ LOGLEDS("Num: %d\n", BIT(data, 7));
+ m_led_num_cb(BIT(data, 7) ? 1 : 0);
});
m_mcu->in_p2_cb().set([this]
@@ -343,6 +353,9 @@ void eispc_keyboard_device::device_add_mconfig(machine_config &config)
m_mcu->out_p2_cb().set([this](uint8_t data)
{
LOGPORTS("Writing port 2: %02x\n", data);
+ LOGLEDS("Caps: %d Scroll: %d\n", BIT(data, 0), BIT(data, 2));
+ m_led_caps_cb(BIT(data, 0) ? 1 : 0);
+ m_led_scroll_cb(BIT(data, 2) ? 1 : 0); // Only working with "Roger Moore" roms
LOGBITS("KBD: writing bit: %02x\n", BIT(data, 4));
});
diff --git a/src/mame/machine/eispc_kb.h b/src/mame/machine/eispc_kb.h
index 8c659e44b64..19b627c8d40 100644
--- a/src/mame/machine/eispc_kb.h
+++ b/src/mame/machine/eispc_kb.h
@@ -13,11 +13,12 @@ class eispc_keyboard_device : public device_t
{
public:
auto txd_cb() { return m_txd_cb.bind(); }
+ auto caps_cb() { return m_led_caps_cb.bind(); }
+ auto num_cb() { return m_led_num_cb.bind(); }
+ auto scroll_cb() { return m_led_scroll_cb.bind(); }
eispc_keyboard_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
- static constexpr feature_type imperfect_features() { return feature::KEYBOARD; }
-
DECLARE_INPUT_CHANGED_MEMBER(key);
DECLARE_WRITE_LINE_MEMBER(rxd_w);
DECLARE_WRITE_LINE_MEMBER(hold_w);
@@ -32,6 +33,9 @@ protected:
required_device<m6801_cpu_device> m_mcu;
required_ioport_array<6> m_rows;
devcb_write_line m_txd_cb; // Callback for KBD-> EPC
+ devcb_write_line m_led_caps_cb; // Callback for Caps led -> layout
+ devcb_write_line m_led_num_cb; // Callback for Num led -> layout
+ devcb_write_line m_led_scroll_cb; // Callback for Scroll led -> layout
bool m_rxd_high; // state of Rx input line
bool m_txd_high; // state of Tx output line