trunk/src/mess/machine/pc9801_kbd.c
| r0 | r19819 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | PC-9801 Keyboard simulation |
| 4 | |
| 5 | ***************************************************************************/ |
| 6 | |
| 7 | #include "emu.h" |
| 8 | #include "machine/pc9801_kbd.h" |
| 9 | |
| 10 | |
| 11 | |
| 12 | //************************************************************************** |
| 13 | // GLOBAL VARIABLES |
| 14 | //************************************************************************** |
| 15 | |
| 16 | // device type definition |
| 17 | const device_type PC9801_KBD = &device_creator<pc9801_kbd_device>; |
| 18 | |
| 19 | |
| 20 | //************************************************************************** |
| 21 | // LIVE DEVICE |
| 22 | //************************************************************************** |
| 23 | |
| 24 | //------------------------------------------------- |
| 25 | // pc9801_kbd_device - constructor |
| 26 | //------------------------------------------------- |
| 27 | |
| 28 | pc9801_kbd_device::pc9801_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 29 | : device_t(mconfig, PC9801_KBD, "pc9801_kbd", tag, owner, clock) |
| 30 | { |
| 31 | |
| 32 | } |
| 33 | |
| 34 | //------------------------------------------------- |
| 35 | // input_ports - device-specific input ports |
| 36 | //------------------------------------------------- |
| 37 | |
| 38 | static INPUT_PORTS_START( pc9801_kbd ) |
| 39 | |
| 40 | INPUT_PORTS_END |
| 41 | |
| 42 | ioport_constructor pc9801_kbd_device::device_input_ports() const |
| 43 | { |
| 44 | return INPUT_PORTS_NAME( pc9801_kbd ); |
| 45 | } |
| 46 | |
| 47 | //------------------------------------------------- |
| 48 | // device_validity_check - perform validity checks |
| 49 | // on this device |
| 50 | //------------------------------------------------- |
| 51 | |
| 52 | void pc9801_kbd_device::device_validity_check(validity_checker &valid) const |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | |
| 57 | //------------------------------------------------- |
| 58 | // device_start - device-specific startup |
| 59 | //------------------------------------------------- |
| 60 | |
| 61 | void pc9801_kbd_device::device_start() |
| 62 | { |
| 63 | m_irq_func.resolve(m_irq_cb, *this); |
| 64 | m_rxtimer = timer_alloc(RX_TIMER); |
| 65 | m_rxtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); |
| 66 | } |
| 67 | |
| 68 | |
| 69 | //------------------------------------------------- |
| 70 | // device_reset - device-specific reset |
| 71 | //------------------------------------------------- |
| 72 | |
| 73 | void pc9801_kbd_device::device_reset() |
| 74 | { |
| 75 | } |
| 76 | |
| 77 | //------------------------------------------------- |
| 78 | // device_config_complete - perform any |
| 79 | // operations now that the configuration is |
| 80 | // complete |
| 81 | //------------------------------------------------- |
| 82 | |
| 83 | void pc9801_kbd_device::device_config_complete() |
| 84 | { |
| 85 | // inherit a copy of the static data |
| 86 | const pc9801_kbd_interface *intf = reinterpret_cast<const pc9801_kbd_interface *>(static_config()); |
| 87 | if (intf != NULL) |
| 88 | *static_cast<pc9801_kbd_interface *>(this) = *intf; |
| 89 | |
| 90 | // or initialize to defaults if none provided |
| 91 | else |
| 92 | { |
| 93 | memset(&m_irq_cb, 0, sizeof(m_irq_cb)); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | //------------------------------------------------- |
| 98 | // device_timer - handler timer events |
| 99 | //------------------------------------------------- |
| 100 | |
| 101 | void pc9801_kbd_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 102 | { |
| 103 | // ... |
| 104 | } |
| 105 | |
| 106 | //************************************************************************** |
| 107 | // READ/WRITE HANDLERS |
| 108 | //************************************************************************** |
| 109 | |
| 110 | READ8_MEMBER( pc9801_kbd_device::rx_r ) |
| 111 | { |
| 112 | m_irq_func(CLEAR_LINE); |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | WRITE8_MEMBER( pc9801_kbd_device::tx_w ) |
| 117 | { |
| 118 | // ... |
| 119 | } |
trunk/src/mess/machine/pc9801_kbd.h
| r0 | r19819 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | PC-9801 Keyboard simulation |
| 4 | |
| 5 | ***************************************************************************/ |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #ifndef __PC9801_KBDDEV_H__ |
| 10 | #define __PC9801_KBDDEV_H__ |
| 11 | |
| 12 | |
| 13 | //************************************************************************** |
| 14 | // INTERFACE CONFIGURATION MACROS |
| 15 | //************************************************************************** |
| 16 | |
| 17 | #define MCFG_PC9801_KBD_ADD(_tag,_freq,_config) \ |
| 18 | MCFG_DEVICE_ADD(_tag, PC9801_KBD, _freq) \ |
| 19 | MCFG_DEVICE_CONFIG(_config) |
| 20 | |
| 21 | #define PC9801_KBD_INTERFACE(name) \ |
| 22 | const pc9801_kbd_interface (name) = |
| 23 | |
| 24 | |
| 25 | //************************************************************************** |
| 26 | // TYPE DEFINITIONS |
| 27 | //************************************************************************** |
| 28 | |
| 29 | // ======================> pc9801_kbd_interface |
| 30 | |
| 31 | struct pc9801_kbd_interface |
| 32 | { |
| 33 | devcb_write_line m_irq_cb; |
| 34 | }; |
| 35 | |
| 36 | // ======================> pc9801_kbd_device |
| 37 | |
| 38 | class pc9801_kbd_device : public device_t, |
| 39 | public pc9801_kbd_interface |
| 40 | { |
| 41 | public: |
| 42 | // construction/destruction |
| 43 | pc9801_kbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 44 | virtual ioport_constructor device_input_ports() const; |
| 45 | |
| 46 | // I/O operations |
| 47 | DECLARE_WRITE8_MEMBER( tx_w ); |
| 48 | DECLARE_READ8_MEMBER( rx_r ); |
| 49 | |
| 50 | protected: |
| 51 | // device-level overrides |
| 52 | virtual void device_validity_check(validity_checker &valid) const; |
| 53 | virtual void device_start(); |
| 54 | virtual void device_reset(); |
| 55 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 56 | virtual void device_config_complete(); |
| 57 | |
| 58 | devcb_resolved_write_line m_irq_func; |
| 59 | |
| 60 | static const device_timer_id RX_TIMER = 1; |
| 61 | emu_timer * m_rxtimer; |
| 62 | }; |
| 63 | |
| 64 | |
| 65 | // device type definition |
| 66 | extern const device_type PC9801_KBD; |
| 67 | |
| 68 | |
| 69 | |
| 70 | //************************************************************************** |
| 71 | // GLOBAL VARIABLES |
| 72 | //************************************************************************** |
| 73 | |
| 74 | |
| 75 | |
| 76 | #endif |
trunk/src/mess/drivers/pc9801.c
| r19818 | r19819 | |
| 78 | 78 | - Arquephos: needs extra sound board(s)? |
| 79 | 79 | - Asoko no Koufuku: black screen with BGM, waits at 0x225f6; |
| 80 | 80 | - Aura Battler Dumbine: upd7220: unimplemented FIGD, has layer clearance bugs on gameplay; |
| 81 | | - Bakasuka Wars: drawing seems busted (either mouse or upd7220) |
| 82 | 81 | - Band-Kun: (how to run this without installing?) |
| 83 | 82 | - Battle Chess: wants some dip-switches to be on in DSW4, too slow during IA thinking? |
| 84 | 83 | - Bishoujo Audition: Moans with a "(program) ended. remove the floppy disk and turn off the power." |
| r19818 | r19819 | |
| 86 | 85 | - Bishoujo Shanshinkan: has white rectangles all over the place; |
| 87 | 86 | - Bishoujo Tsuushin: hangs with a beep while writing some intro text; |
| 88 | 87 | |
| 89 | | - Dragon Buster: slight issue with window masking; |
| 88 | - Dragon Buster: slight issue with window masking, that translates to abuse of the uPD7220 (sets resolution differently for each GDC); |
| 90 | 89 | - Far Side Moon: doesn't detect sound board (tied to 0x00ec ports) |
| 91 | 90 | - Jan Borg Suzume: gets stuck at a pic8259 read; |
| 92 | | - Jump Hero: right status display isn't shown during gameplay (changes the mode dynamically?) |
| 93 | 91 | - Lovely Horror: Doesn't show kanji, tries to read it thru the 0xa9 port; |
| 94 | 92 | - Quarth: should do a split screen effect, it doesn't hence there are broken gfxs |
| 95 | | - Quarth: uploads a PCG charset |
| 93 | - Quarth: PCG charset is wrong with normal display |
| 96 | 94 | - Runner's High: wrong double height on the title screen; |
| 97 | 95 | - Sorcerian, Twilight Zone 3: Fails initial booting, issue with 2dd irq? |
| 98 | 96 | - Uchiyama Aki no Chou Bangai: keyboard irq is fussy (sometimes it doesn't register a key press); |
| r19818 | r19819 | |
| 343 | 341 | #include "machine/pc9801_86.h" |
| 344 | 342 | #include "machine/pc9801_118.h" |
| 345 | 343 | #include "machine/pc9801_cbus.h" |
| 344 | #include "machine/pc9801_kbd.h" |
| 346 | 345 | |
| 347 | 346 | |
| 348 | 347 | #define UPD1990A_TAG "upd1990a" |
| r19818 | r19819 | |
| 481 | 480 | inline UINT8 m_pc9801rs_grcg_r(UINT32 offset,int vbank); |
| 482 | 481 | inline void m_pc9801rs_grcg_w(UINT32 offset,int vbank,UINT8 data); |
| 483 | 482 | DECLARE_CUSTOM_INPUT_MEMBER(system_type_r); |
| 483 | DECLARE_WRITE_LINE_MEMBER( keyb_irq_w ); |
| 484 | 484 | |
| 485 | 485 | DECLARE_WRITE8_MEMBER(sasi_data_w); |
| 486 | 486 | DECLARE_WRITE_LINE_MEMBER(sasi_io_w); |
| r19818 | r19819 | |
| 3747 | 3747 | MCFG_SCSICB_IO_HANDLER(DEVWRITELINE(DEVICE_SELF_OWNER, pc9801_state, sasi_io_w)) |
| 3748 | 3748 | MACHINE_CONFIG_END |
| 3749 | 3749 | |
| 3750 | WRITE_LINE_MEMBER( pc9801_state::keyb_irq_w ) |
| 3751 | { |
| 3752 | // TODO |
| 3753 | } |
| 3754 | |
| 3755 | static PC9801_KBD_INTERFACE( pc9801_kbd_intf ) |
| 3756 | { |
| 3757 | DEVCB_DRIVER_LINE_MEMBER( pc9801_state, keyb_irq_w ) |
| 3758 | }; |
| 3759 | |
| 3760 | static MACHINE_CONFIG_FRAGMENT( pc9801_keyboard ) |
| 3761 | MCFG_PC9801_KBD_ADD("kbd", 120, pc9801_kbd_intf ) |
| 3762 | MACHINE_CONFIG_END |
| 3763 | |
| 3750 | 3764 | static MACHINE_CONFIG_START( pc9801, pc9801_state ) |
| 3751 | 3765 | MCFG_CPU_ADD("maincpu", I8086, 5000000) //unknown clock |
| 3752 | 3766 | MCFG_CPU_PROGRAM_MAP(pc9801_map) |
| r19818 | r19819 | |
| 3763 | 3777 | MCFG_I8255_ADD( "ppi8255_sys", ppi_system_intf ) |
| 3764 | 3778 | MCFG_I8255_ADD( "ppi8255_prn", ppi_printer_intf ) |
| 3765 | 3779 | MCFG_I8255_ADD( "ppi8255_fdd", ppi_fdd_intf ) |
| 3780 | MCFG_FRAGMENT_ADD(pc9801_keyboard) |
| 3766 | 3781 | MCFG_FRAGMENT_ADD(pc9801_mouse) |
| 3767 | 3782 | MCFG_FRAGMENT_ADD(pc9801_cbus) |
| 3768 | 3783 | MCFG_FRAGMENT_ADD(pc9801_sasi) |
| r19818 | r19819 | |
| 3831 | 3846 | MCFG_I8255_ADD( "ppi8255_sys", ppi_system_intf ) |
| 3832 | 3847 | MCFG_I8255_ADD( "ppi8255_prn", ppi_printer_intf ) |
| 3833 | 3848 | MCFG_I8255_ADD( "ppi8255_fdd", ppi_fdd_intf ) |
| 3849 | MCFG_FRAGMENT_ADD(pc9801_keyboard) |
| 3834 | 3850 | MCFG_FRAGMENT_ADD(pc9801_mouse) |
| 3835 | 3851 | MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, pc9801_upd1990a_intf) |
| 3836 | 3852 | MCFG_I8251_ADD(UPD8251_TAG, pc9801_uart_interface) |
| r19818 | r19819 | |
| 3896 | 3912 | MCFG_I8255_ADD( "ppi8255_sys", ppi_system_intf ) |
| 3897 | 3913 | MCFG_I8255_ADD( "ppi8255_prn", ppi_printer_intf ) |
| 3898 | 3914 | MCFG_I8255_ADD( "ppi8255_fdd", ppi_fdd_intf ) |
| 3915 | MCFG_FRAGMENT_ADD(pc9801_keyboard) |
| 3899 | 3916 | MCFG_FRAGMENT_ADD(pc9801_mouse) |
| 3900 | 3917 | MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, pc9801_upd1990a_intf) |
| 3901 | 3918 | MCFG_I8251_ADD(UPD8251_TAG, pc9801_uart_interface) |