diff --git a/.gitattributes b/.gitattributes index 61a254848b6..85999b1754c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7193,6 +7193,8 @@ src/mess/machine/pc9801_86.c svneol=native#text/plain src/mess/machine/pc9801_86.h svneol=native#text/plain src/mess/machine/pc9801_cbus.c svneol=native#text/plain src/mess/machine/pc9801_cbus.h svneol=native#text/plain +src/mess/machine/pc9801_kbd.c svneol=native#text/plain +src/mess/machine/pc9801_kbd.h svneol=native#text/plain src/mess/machine/pc_fdc.c svneol=native#text/plain src/mess/machine/pc_fdc.h svneol=native#text/plain src/mess/machine/pc_joy.c svneol=native#text/plain diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c index 194c701a568..4703cfde04f 100644 --- a/src/mess/drivers/pc9801.c +++ b/src/mess/drivers/pc9801.c @@ -78,7 +78,6 @@ - Arquephos: needs extra sound board(s)? - Asoko no Koufuku: black screen with BGM, waits at 0x225f6; - Aura Battler Dumbine: upd7220: unimplemented FIGD, has layer clearance bugs on gameplay; - - Bakasuka Wars: drawing seems busted (either mouse or upd7220) - Band-Kun: (how to run this without installing?) - Battle Chess: wants some dip-switches to be on in DSW4, too slow during IA thinking? - Bishoujo Audition: Moans with a "(program) ended. remove the floppy disk and turn off the power." @@ -86,13 +85,12 @@ - Bishoujo Shanshinkan: has white rectangles all over the place; - Bishoujo Tsuushin: hangs with a beep while writing some intro text; - - Dragon Buster: slight issue with window masking; + - Dragon Buster: slight issue with window masking, that translates to abuse of the uPD7220 (sets resolution differently for each GDC); - Far Side Moon: doesn't detect sound board (tied to 0x00ec ports) - Jan Borg Suzume: gets stuck at a pic8259 read; - - Jump Hero: right status display isn't shown during gameplay (changes the mode dynamically?) - Lovely Horror: Doesn't show kanji, tries to read it thru the 0xa9 port; - Quarth: should do a split screen effect, it doesn't hence there are broken gfxs - - Quarth: uploads a PCG charset + - Quarth: PCG charset is wrong with normal display - Runner's High: wrong double height on the title screen; - Sorcerian, Twilight Zone 3: Fails initial booting, issue with 2dd irq? - Uchiyama Aki no Chou Bangai: keyboard irq is fussy (sometimes it doesn't register a key press); @@ -343,6 +341,7 @@ #include "machine/pc9801_86.h" #include "machine/pc9801_118.h" #include "machine/pc9801_cbus.h" +#include "machine/pc9801_kbd.h" #define UPD1990A_TAG "upd1990a" @@ -481,6 +480,7 @@ public: inline UINT8 m_pc9801rs_grcg_r(UINT32 offset,int vbank); inline void m_pc9801rs_grcg_w(UINT32 offset,int vbank,UINT8 data); DECLARE_CUSTOM_INPUT_MEMBER(system_type_r); + DECLARE_WRITE_LINE_MEMBER( keyb_irq_w ); DECLARE_WRITE8_MEMBER(sasi_data_w); DECLARE_WRITE_LINE_MEMBER(sasi_io_w); @@ -3747,6 +3747,20 @@ static MACHINE_CONFIG_FRAGMENT( pc9801_sasi ) MCFG_SCSICB_IO_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, pc9801_state, sasi_io_w)) MACHINE_CONFIG_END +WRITE_LINE_MEMBER( pc9801_state::keyb_irq_w ) +{ + // TODO +} + +static PC9801_KBD_INTERFACE( pc9801_kbd_intf ) +{ + DEVCB_DRIVER_LINE_MEMBER( pc9801_state, keyb_irq_w ) +}; + +static MACHINE_CONFIG_FRAGMENT( pc9801_keyboard ) + MCFG_PC9801_KBD_ADD("kbd", 120, pc9801_kbd_intf ) +MACHINE_CONFIG_END + static MACHINE_CONFIG_START( pc9801, pc9801_state ) MCFG_CPU_ADD("maincpu", I8086, 5000000) //unknown clock MCFG_CPU_PROGRAM_MAP(pc9801_map) @@ -3763,6 +3777,7 @@ static MACHINE_CONFIG_START( pc9801, pc9801_state ) MCFG_I8255_ADD( "ppi8255_sys", ppi_system_intf ) MCFG_I8255_ADD( "ppi8255_prn", ppi_printer_intf ) MCFG_I8255_ADD( "ppi8255_fdd", ppi_fdd_intf ) + MCFG_FRAGMENT_ADD(pc9801_keyboard) MCFG_FRAGMENT_ADD(pc9801_mouse) MCFG_FRAGMENT_ADD(pc9801_cbus) MCFG_FRAGMENT_ADD(pc9801_sasi) @@ -3831,6 +3846,7 @@ static MACHINE_CONFIG_START( pc9801rs, pc9801_state ) MCFG_I8255_ADD( "ppi8255_sys", ppi_system_intf ) MCFG_I8255_ADD( "ppi8255_prn", ppi_printer_intf ) MCFG_I8255_ADD( "ppi8255_fdd", ppi_fdd_intf ) + MCFG_FRAGMENT_ADD(pc9801_keyboard) MCFG_FRAGMENT_ADD(pc9801_mouse) MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, pc9801_upd1990a_intf) MCFG_I8251_ADD(UPD8251_TAG, pc9801_uart_interface) @@ -3896,6 +3912,7 @@ static MACHINE_CONFIG_START( pc9821, pc9801_state ) MCFG_I8255_ADD( "ppi8255_sys", ppi_system_intf ) MCFG_I8255_ADD( "ppi8255_prn", ppi_printer_intf ) MCFG_I8255_ADD( "ppi8255_fdd", ppi_fdd_intf ) + MCFG_FRAGMENT_ADD(pc9801_keyboard) MCFG_FRAGMENT_ADD(pc9801_mouse) MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, pc9801_upd1990a_intf) MCFG_I8251_ADD(UPD8251_TAG, pc9801_uart_interface) diff --git a/src/mess/machine/pc9801_kbd.c b/src/mess/machine/pc9801_kbd.c new file mode 100644 index 00000000000..263eac1aab8 --- /dev/null +++ b/src/mess/machine/pc9801_kbd.c @@ -0,0 +1,119 @@ +/*************************************************************************** + + PC-9801 Keyboard simulation + +***************************************************************************/ + +#include "emu.h" +#include "machine/pc9801_kbd.h" + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// device type definition +const device_type PC9801_KBD = &device_creator; + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pc9801_kbd_device - constructor +//------------------------------------------------- + +pc9801_kbd_device::pc9801_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, PC9801_KBD, "pc9801_kbd", tag, owner, clock) +{ + +} + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +static INPUT_PORTS_START( pc9801_kbd ) + +INPUT_PORTS_END + +ioport_constructor pc9801_kbd_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( pc9801_kbd ); +} + +//------------------------------------------------- +// device_validity_check - perform validity checks +// on this device +//------------------------------------------------- + +void pc9801_kbd_device::device_validity_check(validity_checker &valid) const +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pc9801_kbd_device::device_start() +{ + m_irq_func.resolve(m_irq_cb, *this); + m_rxtimer = timer_alloc(RX_TIMER); + m_rxtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void pc9801_kbd_device::device_reset() +{ +} + +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void pc9801_kbd_device::device_config_complete() +{ + // inherit a copy of the static data + const pc9801_kbd_interface *intf = reinterpret_cast(static_config()); + if (intf != NULL) + *static_cast(this) = *intf; + + // or initialize to defaults if none provided + else + { + memset(&m_irq_cb, 0, sizeof(m_irq_cb)); + } +} + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void pc9801_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + // ... +} + +//************************************************************************** +// READ/WRITE HANDLERS +//************************************************************************** + +READ8_MEMBER( pc9801_kbd_device::rx_r ) +{ + m_irq_func(CLEAR_LINE); + return 0; +} + +WRITE8_MEMBER( pc9801_kbd_device::tx_w ) +{ + // ... +} diff --git a/src/mess/machine/pc9801_kbd.h b/src/mess/machine/pc9801_kbd.h new file mode 100644 index 00000000000..842b1dcb3a5 --- /dev/null +++ b/src/mess/machine/pc9801_kbd.h @@ -0,0 +1,76 @@ +/*************************************************************************** + + PC-9801 Keyboard simulation + +***************************************************************************/ + +#pragma once + +#ifndef __PC9801_KBDDEV_H__ +#define __PC9801_KBDDEV_H__ + + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MCFG_PC9801_KBD_ADD(_tag,_freq,_config) \ + MCFG_DEVICE_ADD(_tag, PC9801_KBD, _freq) \ + MCFG_DEVICE_CONFIG(_config) + +#define PC9801_KBD_INTERFACE(name) \ + const pc9801_kbd_interface (name) = + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> pc9801_kbd_interface + +struct pc9801_kbd_interface +{ + devcb_write_line m_irq_cb; +}; + +// ======================> pc9801_kbd_device + +class pc9801_kbd_device : public device_t, + public pc9801_kbd_interface +{ +public: + // construction/destruction + pc9801_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ioport_constructor device_input_ports() const; + + // I/O operations + DECLARE_WRITE8_MEMBER( tx_w ); + DECLARE_READ8_MEMBER( rx_r ); + +protected: + // device-level overrides + virtual void device_validity_check(validity_checker &valid) const; + virtual void device_start(); + virtual void device_reset(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + virtual void device_config_complete(); + + devcb_resolved_write_line m_irq_func; + + static const device_timer_id RX_TIMER = 1; + emu_timer * m_rxtimer; +}; + + +// device type definition +extern const device_type PC9801_KBD; + + + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + + + +#endif diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 41db8bebfc3..aba24915524 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -1476,6 +1476,7 @@ $(MESSOBJ)/pc9801.a: \ $(MESS_MACHINE)/pc9801_86.o \ $(MESS_MACHINE)/pc9801_118.o \ $(MESS_MACHINE)/pc9801_cbus.o \ + $(MESS_MACHINE)/pc9801_kbd.o \ $(MESSOBJ)/pcshare.a: \ $(MESS_MACHINE)/pc_turbo.o \