mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
8042kbdc: Unbundle keyboard from device and make it optional
This commit is contained in:
parent
b2a85bcd6f
commit
8c5829061b
@ -35,7 +35,7 @@ DEFINE_DEVICE_TYPE(KBDC8042, kbdc8042_device, "kbdc8042", "8042 Keyboard/Mouse C
|
||||
|
||||
kbdc8042_device::kbdc8042_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, KBDC8042, tag, owner, clock)
|
||||
, m_keyboard_dev(*this, "at_keyboard")
|
||||
, m_keyboard_dev(*this, finder_base::DUMMY_TAG)
|
||||
, m_mousex_port(*this, "MOUSEX")
|
||||
, m_mousey_port(*this, "MOUSEY")
|
||||
, m_mousebtn_port(*this, "MOUSEBTN")
|
||||
@ -50,12 +50,6 @@ kbdc8042_device::kbdc8042_device(const machine_config &mconfig, const char *tag,
|
||||
m_interrupttype = KBDC8042_SINGLE;
|
||||
}
|
||||
|
||||
void kbdc8042_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
AT_KEYB(config, m_keyboard_dev, pc_keyboard_device::KEYBOARD_TYPE::AT, 1);
|
||||
m_keyboard_dev->keypress().set(FUNC(kbdc8042_device::keyboard_w));
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
device_start - device-specific startup
|
||||
@ -144,7 +138,7 @@ void kbdc8042_device::at_8042_receive(uint8_t data, bool mouse)
|
||||
|
||||
void kbdc8042_device::at_8042_check_keyboard()
|
||||
{
|
||||
if (!m_keyboard.received && !m_mouse.received)
|
||||
if (!m_keyboard.received && !m_mouse.received && m_keyboard_dev.found())
|
||||
{
|
||||
int data = m_keyboard_dev->read();
|
||||
if (data)
|
||||
@ -340,7 +334,8 @@ void kbdc8042_device::data_w(offs_t offset, uint8_t data)
|
||||
case 0:
|
||||
m_data = data;
|
||||
m_sending = 1;
|
||||
m_keyboard_dev->write(data);
|
||||
if (m_keyboard_dev.found())
|
||||
m_keyboard_dev->write(data);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
// construction/destruction
|
||||
kbdc8042_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
template <typename T> void set_keyboard_tag(T &&tag) { m_keyboard_dev.set_tag(std::forward<T>(tag)); }
|
||||
|
||||
void set_keyboard_type(kbdc8042_type_t keybtype) { m_keybtype = keybtype; }
|
||||
void set_interrupt_type(kbdc8042_interrupt_type_t interrupttype) { m_interrupttype = interrupttype; }
|
||||
auto system_reset_callback() { return m_system_reset_cb.bind(); }
|
||||
@ -59,11 +61,12 @@ public:
|
||||
void at_8042_check_mouse();
|
||||
void at_8042_clear_keyboard_received();
|
||||
|
||||
void keyboard_w(int state);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update_timer);
|
||||
@ -107,7 +110,7 @@ private:
|
||||
|
||||
int m_poll_delay;
|
||||
|
||||
required_device<at_keyboard_device> m_keyboard_dev;
|
||||
optional_device<at_keyboard_device> m_keyboard_dev;
|
||||
optional_ioport m_mousex_port;
|
||||
optional_ioport m_mousey_port;
|
||||
optional_ioport m_mousebtn_port;
|
||||
@ -128,8 +131,6 @@ private:
|
||||
uint8_t m_mouse_btn;
|
||||
|
||||
emu_timer * m_update_timer;
|
||||
|
||||
void keyboard_w(int state);
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -11,6 +11,8 @@ SMSC FDC37C93x Plug and Play Compatible Ultra I/O Controller
|
||||
#include "emu.h"
|
||||
#include "machine/fdc37c93x.h"
|
||||
|
||||
#include "machine/pckeybrd.h"
|
||||
|
||||
#include "formats/naslite_dsk.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(FDC37C93X, fdc37c93x_device, "fdc37c93x", "SMSC FDC37C93X Super I/O")
|
||||
@ -287,6 +289,10 @@ void fdc37c93x_device::device_add_mconfig(machine_config &config)
|
||||
m_kbdc->input_buffer_full_mouse_callback().set(FUNC(fdc37c93x_device::irq_mouse_w));
|
||||
m_kbdc->system_reset_callback().set(FUNC(fdc37c93x_device::kbdp20_gp20_reset_w));
|
||||
m_kbdc->gate_a20_callback().set(FUNC(fdc37c93x_device::kbdp21_gp25_gatea20_w));
|
||||
m_kbdc->set_keyboard_tag("at_keyboard");
|
||||
|
||||
at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1));
|
||||
at_keyb.keypress().set(m_kbdc, FUNC(kbdc8042_device::keyboard_w));
|
||||
}
|
||||
|
||||
void fdc37c93x_device::irq_floppy_w(int state)
|
||||
|
@ -13,6 +13,7 @@ TODO:
|
||||
#include "bus/isa/isa.h"
|
||||
//#include "machine/ds128x.h"
|
||||
#include "machine/pc87306.h"
|
||||
#include "machine/pckeybrd.h"
|
||||
|
||||
#define LOG_WARN (1U << 1) // Show warnings
|
||||
|
||||
@ -84,6 +85,10 @@ void pc87306_device::device_add_mconfig(machine_config &config)
|
||||
m_kbdc->input_buffer_full_mouse_callback().set(FUNC(pc87306_device::irq_mouse_w));
|
||||
m_kbdc->system_reset_callback().set(FUNC(pc87306_device::kbdp20_gp20_reset_w));
|
||||
m_kbdc->gate_a20_callback().set(FUNC(pc87306_device::kbdp21_gp25_gatea20_w));
|
||||
m_kbdc->set_keyboard_tag("at_keyboard");
|
||||
|
||||
at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1));
|
||||
at_keyb.keypress().set(m_kbdc, FUNC(kbdc8042_device::keyboard_w));
|
||||
}
|
||||
|
||||
void pc87306_device::remap(int space_id, offs_t start, offs_t end)
|
||||
|
@ -29,7 +29,9 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "sis950_lpc.h"
|
||||
|
||||
#include "bus/pc_kbd/keyboards.h"
|
||||
#include "machine/pckeybrd.h"
|
||||
#include "speaker.h"
|
||||
|
||||
#define LOG_IO (1U << 1) // log PCI register accesses
|
||||
@ -164,6 +166,10 @@ void sis950_lpc_device::device_add_mconfig(machine_config &config)
|
||||
m_keybc->input_buffer_full_mouse_callback().set(m_pic_slave, FUNC(pic8259_device::ir4_w));
|
||||
m_keybc->system_reset_callback().set(FUNC(sis950_lpc_device::cpu_reset_w));
|
||||
m_keybc->gate_a20_callback().set(FUNC(sis950_lpc_device::cpu_a20_w));
|
||||
m_keybc->set_keyboard_tag("at_keyboard");
|
||||
|
||||
at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1));
|
||||
at_keyb.keypress().set(m_keybc, FUNC(kbdc8042_device::keyboard_w));
|
||||
|
||||
// TODO: unknown RTC type
|
||||
// Has external RTC bank select at $48, using this one as convenience
|
||||
|
@ -12,9 +12,11 @@ TODO:
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/w83977tf.h"
|
||||
|
||||
#include "bus/isa/isa.h"
|
||||
//#include "machine/ds128x.h"
|
||||
#include "machine/w83977tf.h"
|
||||
#include "machine/pckeybrd.h"
|
||||
|
||||
#define VERBOSE (LOG_GENERAL)
|
||||
//#define LOG_OUTPUT_FUNC osd_printf_info
|
||||
@ -84,6 +86,10 @@ void w83977tf_device::device_add_mconfig(machine_config &config)
|
||||
m_kbdc->gate_a20_callback().set(FUNC(w83977tf_device::kbdp21_gp25_gatea20_w));
|
||||
m_kbdc->input_buffer_full_callback().set(FUNC(w83977tf_device::irq_keyboard_w));
|
||||
m_kbdc->input_buffer_full_mouse_callback().set(FUNC(w83977tf_device::irq_mouse_w));
|
||||
m_kbdc->set_keyboard_tag("at_keyboard");
|
||||
|
||||
at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1));
|
||||
at_keyb.keypress().set(m_kbdc, FUNC(kbdc8042_device::keyboard_w));
|
||||
}
|
||||
|
||||
|
||||
|
@ -241,6 +241,10 @@ void bebox_state::bebox_peripherals(machine_config &config)
|
||||
kbdc.set_keyboard_type(kbdc8042_device::KBDC8042_STANDARD);
|
||||
kbdc.system_reset_callback().set_inputline(m_ppc[0], INPUT_LINE_RESET);
|
||||
kbdc.input_buffer_full_callback().set(FUNC(bebox_state::bebox_keyboard_interrupt));
|
||||
kbdc.set_keyboard_tag("at_keyboard");
|
||||
|
||||
at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1));
|
||||
at_keyb.keypress().set("kbdc", FUNC(kbdc8042_device::keyboard_w));
|
||||
|
||||
/* internal ram */
|
||||
RAM(config, m_ram);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "bus/rs232/terminal.h"
|
||||
#include "cpu/i386/athlon.h"
|
||||
#include "machine/pci-ide.h"
|
||||
#include "machine/pckeybrd.h"
|
||||
#include "bus/isa/isa.h"
|
||||
#include "video/virge_pci.h"
|
||||
|
||||
@ -459,6 +460,10 @@ void it8703f_device::device_add_mconfig(machine_config &config)
|
||||
m_kbdc->input_buffer_full_callback().set(FUNC(it8703f_device::irq_keyboard_w));
|
||||
m_kbdc->system_reset_callback().set(FUNC(it8703f_device::kbdp20_gp20_reset_w));
|
||||
m_kbdc->gate_a20_callback().set(FUNC(it8703f_device::kbdp21_gp25_gatea20_w));
|
||||
m_kbdc->set_keyboard_tag("at_keyboard");
|
||||
|
||||
at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1));
|
||||
at_keyb.keypress().set(m_kbdc, FUNC(kbdc8042_device::keyboard_w));
|
||||
}
|
||||
|
||||
uint8_t it8703f_device::read_it8703f(offs_t offset)
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "pcshare.h"
|
||||
|
||||
#include "cpu/i86/i286.h"
|
||||
#include "machine/pckeybrd.h"
|
||||
|
||||
/******************
|
||||
DMA8237 Controller
|
||||
@ -176,4 +177,8 @@ void pcat_base_state::pcat_common(machine_config &config)
|
||||
m_kbdc->system_reset_callback().set_inputline(m_maincpu, INPUT_LINE_RESET);
|
||||
m_kbdc->gate_a20_callback().set_inputline(m_maincpu, INPUT_LINE_A20);
|
||||
m_kbdc->input_buffer_full_callback().set(m_pic8259_1, FUNC(pic8259_device::ir1_w));
|
||||
m_kbdc->set_keyboard_tag("at_keyboard");
|
||||
|
||||
at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1));
|
||||
at_keyb.keypress().set(m_kbdc, FUNC(kbdc8042_device::keyboard_w));
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "machine/ins8250.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "machine/pc_lpt.h"
|
||||
#include "machine/pckeybrd.h"
|
||||
#include "sound/beep.h"
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
@ -417,6 +418,10 @@ void tv990_state::tv990(machine_config &config)
|
||||
KBDC8042(config, m_kbdc);
|
||||
m_kbdc->set_keyboard_type(kbdc8042_device::KBDC8042_STANDARD);
|
||||
m_kbdc->input_buffer_full_callback().set_inputline("maincpu", M68K_IRQ_2);
|
||||
m_kbdc->set_keyboard_tag("at_keyboard");
|
||||
|
||||
at_keyboard_device &at_keyb(AT_KEYB(config, "at_keyboard", pc_keyboard_device::KEYBOARD_TYPE::AT, 1));
|
||||
at_keyb.keypress().set(m_kbdc, FUNC(kbdc8042_device::keyboard_w));
|
||||
|
||||
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user