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 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 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