Previous 199869 Revisions Next

r33096 Friday 31st October, 2014 at 22:50:03 UTC by Curt Coder
(MESS) x820: Emulated the ASCII keyboard (key repeat is not working yet). [Curt Coder]
[src/mess]mess.mak
[src/mess/drivers]xerox820.c
[src/mess/includes]xerox820.h
[src/mess/machine]x820kb.c* x820kb.h*

trunk/src/mess/drivers/xerox820.c
r241607r241608
3939
4040
4141#include "includes/xerox820.h"
42#include "bus/rs232/rs232.h"
4342
44#define KEYBOARD_TAG "keyboard"
45
4643/* Read/Write Handlers */
4744
4845void xerox820_state::bankswitch(int bank)
r241607r241608
320317
321318   */
322319
323   return m_keydata;
320   return m_kb->read() ^ 0xff;
324321};
325322
326323WRITE8_MEMBER( xerox820ii_state::rdpio_pb_w )
r241607r241608
407404   m_sio->txca_w(state);
408405}
409406
410WRITE8_MEMBER( xerox820_state::kbd_w )
411{
412   m_keydata = ~data;
413
414   /* strobe in keyboard data */
415   m_kbpio->strobe_b(0);
416   m_kbpio->strobe_b(1);
417}
418
419407/* Video */
420408
421409UINT32 xerox820_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
r241607r241608
470458void xerox820_state::machine_start()
471459{
472460   // state saving
473   save_item(NAME(m_keydata));
474461   save_item(NAME(m_scroll));
475462   save_item(NAME(m_ncset2));
476463   save_item(NAME(m_vatt));
r241607r241608
627614   MCFG_COM8116_FR_HANDLER(WRITELINE(xerox820_state, fr_w))
628615   MCFG_COM8116_FT_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w))
629616
630   MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0)
631   MCFG_GENERIC_KEYBOARD_CB(WRITE8(xerox820_state, kbd_w))
617   MCFG_DEVICE_ADD(KEYBOARD_TAG, XEROX_820_KEYBOARD, 0)
618   MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(DEVWRITELINE(Z80PIO_KB_TAG, z80pio_device, strobe_b))
632619
633620   /* internal ram */
634621   MCFG_RAM_ADD(RAM_TAG)
r241607r241608
714701   MCFG_COM8116_FR_HANDLER(WRITELINE(xerox820_state, fr_w))
715702   MCFG_COM8116_FT_HANDLER(DEVWRITELINE(Z80SIO_TAG, z80dart_device, rxtxcb_w))
716703
717   MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0)
718   MCFG_GENERIC_KEYBOARD_CB(WRITE8(xerox820_state, kbd_w))
704   MCFG_DEVICE_ADD(KEYBOARD_TAG, XEROX_820_KEYBOARD, 0)
705   MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(DEVWRITELINE(Z80PIO_KB_TAG, z80pio_device, strobe_b))
719706
720707   // SASI bus
721708   MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0)
r241607r241608
785772
786773   ROM_REGION( 0x800, "chargen", 0 )
787774   ROM_LOAD( "x820.u92", 0x0000, 0x0800, CRC(b823fa98) SHA1(ad0ea346aa257a53ad5701f4201896a2b3a0f928) )
788
789   ROM_REGION( 0x800, "keyboard", 0 )
790   ROM_LOAD( "keyboard", 0x0000, 0x0800, NO_DUMP )
791775ROM_END
792776
793777ROM_START( x820ii )
r241607r241608
824808   ROM_REGION( 0x1000, "chargen", 0 )
825809   ROM_LOAD( "x820ii.u57", 0x0000, 0x0800, CRC(1a50f600) SHA1(df4470c80611c14fa7ea8591f741fbbecdfe4fd9) )
826810   ROM_LOAD( "x820ii.u58", 0x0800, 0x0800, CRC(aca4b9b3) SHA1(77f41470b0151945b8d3c3a935fc66409e9157b3) )
827
828   ROM_REGION( 0x400, "keyboard", 0 )
829   ROM_LOAD( "820iikey.bin", 0x000, 0x400, CRC(8ea3b39b) SHA1(3f05959f54a558b273567b1b4f0c7cdf46d8d9bf) ) // ASCII keyboard, QZERTY layout (Italian)
830811ROM_END
831812
832813ROM_START( x168 )
r241607r241608
849830   ROM_REGION( 0x1000, "chargen", 0 )
850831   ROM_LOAD( "x820ii.u57", 0x0000, 0x0800, CRC(1a50f600) SHA1(df4470c80611c14fa7ea8591f741fbbecdfe4fd9) )
851832   ROM_LOAD( "x820ii.u58", 0x0800, 0x0800, CRC(aca4b9b3) SHA1(77f41470b0151945b8d3c3a935fc66409e9157b3) )
852
853   ROM_REGION( 0x400, "keyboard", 0 )
854   ROM_LOAD( "820iikey.bin", 0x000, 0x400, CRC(8ea3b39b) SHA1(3f05959f54a558b273567b1b4f0c7cdf46d8d9bf) ) // ASCII keyboard, QZERTY layout (Italian)
855833ROM_END
856834
857835ROM_START( mk83 )
r241607r241608
865843/* System Drivers */
866844
867845/*    YEAR  NAME        PARENT      COMPAT  MACHINE     INPUT       INIT    COMPANY                         FULLNAME        FLAGS */
868COMP( 1980, bigboard,   0,          0,      bigboard,   xerox820, driver_device,   0,      "Digital Research Computers",   "Big Board",     GAME_IMPERFECT_KEYBOARD )
869COMP( 1981, x820,       bigboard,   0,      xerox820,   xerox820, driver_device,   0,      "Xerox",                        "Xerox 820",     GAME_IMPERFECT_KEYBOARD | GAME_NO_SOUND_HW )
870COMP( 1982, mk82,       bigboard,   0,      bigboard,   xerox820, driver_device,   0,      "Scomar",                       "MK-82",         GAME_IMPERFECT_KEYBOARD )
871COMP( 1983, x820ii,     0,          0,      xerox820ii, xerox820, driver_device,   0,      "Xerox",                        "Xerox 820-II",  GAME_NOT_WORKING | GAME_IMPERFECT_KEYBOARD )
872COMP( 1983, x168,       x820ii,     0,      xerox168,   xerox820, driver_device,   0,      "Xerox",                        "Xerox 16/8",    GAME_NOT_WORKING | GAME_IMPERFECT_KEYBOARD )
873COMP( 1983, mk83,       x820ii,     0,      mk83,       xerox820, driver_device,   0,      "Scomar",                       "MK-83",         GAME_NOT_WORKING | GAME_IMPERFECT_KEYBOARD | GAME_NO_SOUND_HW )
846COMP( 1980, bigboard,   0,          0,      bigboard,   xerox820, driver_device,   0,      "Digital Research Computers",   "Big Board",     0 )
847COMP( 1981, x820,       bigboard,   0,      xerox820,   xerox820, driver_device,   0,      "Xerox",                        "Xerox 820",     GAME_NO_SOUND_HW )
848COMP( 1982, mk82,       bigboard,   0,      bigboard,   xerox820, driver_device,   0,      "Scomar",                       "MK-82",         0 )
849COMP( 1983, x820ii,     0,          0,      xerox820ii, xerox820, driver_device,   0,      "Xerox",                        "Xerox 820-II",  GAME_NOT_WORKING )
850COMP( 1983, x168,       x820ii,     0,      xerox168,   xerox820, driver_device,   0,      "Xerox",                        "Xerox 16/8",    GAME_NOT_WORKING )
851COMP( 1983, mk83,       x820ii,     0,      mk83,       xerox820, driver_device,   0,      "Scomar",                       "MK-83",         GAME_NOT_WORKING | GAME_NO_SOUND_HW )
trunk/src/mess/includes/xerox820.h
r241607r241608
55
66#include "emu.h"
77#include "bus/scsi/sa1403d.h"
8#include "bus/rs232/rs232.h"
89#include "cpu/z80/z80.h"
910#include "cpu/z80/z80daisy.h"
1011#include "cpu/i86/i86.h"
1112#include "machine/com8116.h"
12#include "machine/keyboard.h"
1313#include "machine/ram.h"
1414#include "bus/scsi/scsi.h"
1515#include "bus/scsi/scsihd.h"
1616#include "machine/wd_fdc.h"
17#include "machine/x820kb.h"
1718#include "machine/z80pio.h"
1819#include "machine/z80ctc.h"
1920#include "machine/z80dart.h"
r241607r241608
3536#define SASIBUS_TAG     "sasi"
3637#define RS232_A_TAG     "rs232a"
3738#define RS232_B_TAG     "rs232b"
39#define KEYBOARD_TAG   "kb"
3840
3941#define XEROX820_VIDEORAM_SIZE  0x1000
4042#define XEROX820_VIDEORAM_MASK  0x0fff
r241607r241608
4244class xerox820_state : public driver_device
4345{
4446public:
45   xerox820_state(const machine_config &mconfig, device_type type, const char *tag)
46      : driver_device(mconfig, type, tag),
47         m_maincpu(*this, Z80_TAG),
48         m_kbpio(*this, Z80PIO_KB_TAG),
49         m_ctc(*this, Z80CTC_TAG),
50         m_sio(*this, Z80SIO_TAG),
51         m_fdc(*this, FD1771_TAG),
52         m_ram(*this, RAM_TAG),
53         m_palette(*this, "palette"),
54         m_floppy0(*this, FD1771_TAG":0"),
55         m_floppy1(*this, FD1771_TAG":1"),
56         m_rom(*this, Z80_TAG),
57         m_char_rom(*this, "chargen"),
58         m_video_ram(*this, "video_ram"),
59         m_fdc_irq(0),
60         m_fdc_drq(0),
61         m_8n5(0),
62         m_400_460(0)
47   xerox820_state(const machine_config &mconfig, device_type type, const char *tag) :
48      driver_device(mconfig, type, tag),
49      m_maincpu(*this, Z80_TAG),
50      m_kbpio(*this, Z80PIO_KB_TAG),
51      m_ctc(*this, Z80CTC_TAG),
52      m_sio(*this, Z80SIO_TAG),
53      m_fdc(*this, FD1771_TAG),
54      m_ram(*this, RAM_TAG),
55      m_palette(*this, "palette"),
56      m_floppy0(*this, FD1771_TAG":0"),
57      m_floppy1(*this, FD1771_TAG":1"),
58      m_kb(*this, KEYBOARD_TAG),
59      m_rom(*this, Z80_TAG),
60      m_char_rom(*this, "chargen"),
61      m_video_ram(*this, "video_ram"),
62      m_fdc_irq(0),
63      m_fdc_drq(0),
64      m_8n5(0),
65      m_400_460(0)
6366   { }
6467
6568   virtual void machine_start();
r241607r241608
7679   required_device<palette_device> m_palette;
7780   required_device<floppy_connector> m_floppy0;
7881   required_device<floppy_connector> m_floppy1;
82   required_device<xerox_820_keyboard_t> m_kb;
7983   required_memory_region m_rom;
8084   required_memory_region m_char_rom;
8185   required_shared_ptr<UINT8> m_video_ram;
r241607r241608
8993   DECLARE_READ8_MEMBER( kbpio_pb_r );
9094   DECLARE_WRITE_LINE_MEMBER( intrq_w );
9195   DECLARE_WRITE_LINE_MEMBER( drq_w );
92   DECLARE_WRITE8_MEMBER( kbd_w );
9396   DECLARE_WRITE_LINE_MEMBER( fr_w );
9497   DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w );
9598   DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
r241607r241608
97100   void bankswitch(int bank);
98101   void update_nmi();
99102
100   /* keyboard state */
101   int m_keydata;                      /* keyboard data */
102
103103   /* video state */
104104   UINT8 m_scroll;                     /* vertical scroll */
105105   UINT8 m_framecnt;
trunk/src/mess/machine/x820kb.c
r0r241608
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Xerox 820/820-II ASCII keyboard emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10*********************************************************************/
11
12/*
13
14   TODO:
15
16   - LOCK key
17   - repeat
18   - what are T0/T1/INT?
19
20*/
21
22#include "x820kb.h"
23
24
25
26//**************************************************************************
27//  MACROS / CONSTANTS
28//**************************************************************************
29
30#define I8748_TAG       "i8748"
31
32
33
34//**************************************************************************
35//  DEVICE DEFINITIONS
36//**************************************************************************
37
38const device_type XEROX_820_KEYBOARD = &device_creator<xerox_820_keyboard_t>;
39
40
41//-------------------------------------------------
42//  ROM( xerox_820_keyboard )
43//-------------------------------------------------
44
45ROM_START( xerox_820_keyboard )
46   ROM_REGION( 0x400, I8748_TAG, 0 )
47   ROM_LOAD( "820iikey.bin", 0x000, 0x400, CRC(8ea3b39b) SHA1(3f05959f54a558b273567b1b4f0c7cdf46d8d9bf) )
48ROM_END
49
50
51//-------------------------------------------------
52//  rom_region - device-specific ROM region
53//-------------------------------------------------
54
55const rom_entry *xerox_820_keyboard_t::device_rom_region() const
56{
57   return ROM_NAME( xerox_820_keyboard );
58}
59
60
61//-------------------------------------------------
62//  ADDRESS_MAP( kb_io )
63//-------------------------------------------------
64
65static ADDRESS_MAP_START( xerox_820_keyboard_io, AS_IO, 8, xerox_820_keyboard_t )
66   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w)
67   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_READ(kb_p2_r)
68   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T0) AM_READ(kb_t0_r)
69   AM_RANGE(MCS48_PORT_T0, MCS48_PORT_T1) AM_READ(kb_t1_r)
70   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(kb_bus_w)
71ADDRESS_MAP_END
72
73
74//-------------------------------------------------
75//  MACHINE_DRIVER( xerox_820_keyboard )
76//-------------------------------------------------
77
78static MACHINE_CONFIG_FRAGMENT( xerox_820_keyboard )
79   MCFG_CPU_ADD(I8748_TAG, I8048, 4608000) // ???
80   MCFG_CPU_IO_MAP(xerox_820_keyboard_io)
81
82   MCFG_DEVICE_ADD("int_clk", CLOCK, 16) // ???
83   MCFG_CLOCK_SIGNAL_HANDLER(INPUTLINE(I8748_TAG, MCS48_INPUT_IRQ))
84MACHINE_CONFIG_END
85
86
87//-------------------------------------------------
88//  machine_config_additions - device-specific
89//  machine configurations
90//-------------------------------------------------
91
92machine_config_constructor xerox_820_keyboard_t::device_mconfig_additions() const
93{
94   return MACHINE_CONFIG_NAME( xerox_820_keyboard );
95}
96
97
98//-------------------------------------------------
99//  INPUT_PORTS( xerox_820_keyboard )
100//-------------------------------------------------
101
102INPUT_PORTS_START( xerox_820_keyboard )
103   PORT_START("Y0")
104   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
105   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
106   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
107   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
108   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
109   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
110   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
111   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
112
113   PORT_START("Y1")
114   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
115   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
116   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
117   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
118   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
119   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("ESC") PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
120   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
121   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
122
123   PORT_START("Y2")
124   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
125   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
126   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) PORT_CHAR(UCHAR_MAMEKEY(UP))
127   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_ENTER_PAD) PORT_CHAR(UCHAR_MAMEKEY(ENTER_PAD))
128   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RETURN") PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
129   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"') PORT_CHAR('`')
130   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':') PORT_CHAR('~')
131   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
132
133   PORT_START("Y3")
134   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad .")
135   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
136   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
137   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
138   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
139   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?') PORT_CHAR('\\')
140   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
141   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
142
143   PORT_START("Y4")
144   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
145   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) // ; =
146   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // : < >
147   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
148   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
149   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
150   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
151   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
152
153   PORT_START("Y5")
154   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
155   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('0') PORT_CHAR(')')
156   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('9') PORT_CHAR('(')
157   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
158   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
159   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("BACK SPACE") PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
160   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("DEL") PORT_CODE(KEYCODE_DEL) PORT_CHAR(UCHAR_MAMEKEY(DEL))
161   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad -") PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
162
163   PORT_START("Y6")
164   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
165   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
166   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
167   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
168   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
169   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
170   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
171   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("HELP") PORT_CODE(KEYCODE_TILDE)
172
173   PORT_START("Y7")
174   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
175   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
176   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
177   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
178   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
179   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
180   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
181   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB))
182
183   PORT_START("Y8")
184   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
185   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
186   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
187   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
188   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
189   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
190   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
191   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
192
193   PORT_START("YD")
194   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("LOCK") PORT_CODE(KEYCODE_Q) PORT_TOGGLE
195
196   PORT_START("YF")
197   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left SHIFT") PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1)
198   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right SHIFT") PORT_CODE(KEYCODE_RSHIFT)
199   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left CTRL") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL))
200   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
201   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
202   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
203   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right CTRL") PORT_CODE(KEYCODE_RCONTROL) PORT_CHAR(UCHAR_MAMEKEY(RCONTROL))
204   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
205INPUT_PORTS_END
206
207
208//-------------------------------------------------
209//  input_ports - device-specific input ports
210//-------------------------------------------------
211
212ioport_constructor xerox_820_keyboard_t::device_input_ports() const
213{
214   return INPUT_PORTS_NAME( xerox_820_keyboard );
215}
216
217
218
219//**************************************************************************
220//  LIVE DEVICE
221//**************************************************************************
222
223//-------------------------------------------------
224//  xerox_820_keyboard_t - constructor
225//-------------------------------------------------
226
227xerox_820_keyboard_t::xerox_820_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
228   device_t(mconfig, XEROX_820_KEYBOARD, "Xerox 820 Keyboard", tag, owner, clock, "x820kb", __FILE__),
229   m_maincpu(*this, I8748_TAG),
230   m_y0(*this, "Y0"),
231   m_y1(*this, "Y1"),
232   m_y2(*this, "Y2"),
233   m_y3(*this, "Y3"),
234   m_y4(*this, "Y4"),
235   m_y5(*this, "Y5"),
236   m_y6(*this, "Y6"),
237   m_y7(*this, "Y7"),
238   m_y8(*this, "Y8"),
239   m_yd(*this, "YD"),
240   m_yf(*this, "YF"),
241   m_kbstb_cb(*this),
242   m_p1(0xff),
243   m_bus(0xff)
244{
245}
246
247
248//-------------------------------------------------
249//  device_start - device-specific startup
250//-------------------------------------------------
251
252void xerox_820_keyboard_t::device_start()
253{
254   // state saving
255   save_item(NAME(m_p1));
256   save_item(NAME(m_bus));
257}
258
259
260//-------------------------------------------------
261//  device_reset - device-specific reset
262//-------------------------------------------------
263
264void xerox_820_keyboard_t::device_reset()
265{
266   m_kbstb_cb.resolve_safe();
267}
268
269
270//-------------------------------------------------
271//  kb_p1_r -
272//-------------------------------------------------
273
274READ8_MEMBER( xerox_820_keyboard_t::kb_p1_r )
275{
276   return m_p1; // TODO: move to mcs48.c
277}
278
279
280//-------------------------------------------------
281//  kb_p1_w -
282//-------------------------------------------------
283
284WRITE8_MEMBER( xerox_820_keyboard_t::kb_p1_w )
285{
286   /*
287
288      bit    description
289
290      0       A0
291      1       A1
292      2       A2
293      3       A3
294      4         KBSTB
295      5
296      6
297      7      ? (toggled if T1=0)
298
299   */
300
301   m_p1 = data;
302
303   m_kbstb_cb(BIT(data, 4) ? CLEAR_LINE : ASSERT_LINE);
304}
305
306
307//-------------------------------------------------
308//  kb_p2_r -
309//-------------------------------------------------
310
311READ8_MEMBER( xerox_820_keyboard_t::kb_p2_r )
312{
313   UINT8 data = 0xff;
314
315   switch (m_p1 & 0x0f)
316   {
317      case 0: data &= m_y0->read(); break;
318      case 1: data &= m_y1->read(); break;
319      case 2: data &= m_y2->read(); break;
320      case 3: data &= m_y3->read(); break;
321      case 4: data &= m_y4->read(); break;
322      case 5: data &= m_y5->read(); break;
323      case 6: data &= m_y6->read(); break;
324      case 7: data &= m_y7->read(); break;
325      case 8: data &= m_y8->read(); break;
326      case 0xf: data &= m_yf->read(); break;
327   }
328
329   return data;
330}
331
332
333//-------------------------------------------------
334//  kb_t0_r -
335//-------------------------------------------------
336
337READ8_MEMBER( xerox_820_keyboard_t::kb_t0_r )
338{
339   return 1; // ???
340}
341
342
343//-------------------------------------------------
344//  kb_t1_r -
345//-------------------------------------------------
346
347READ8_MEMBER( xerox_820_keyboard_t::kb_t1_r )
348{
349   return 1; // ???
350}
351
352
353//-------------------------------------------------
354//  kb_bus_w -
355//-------------------------------------------------
356
357WRITE8_MEMBER( xerox_820_keyboard_t::kb_bus_w )
358{
359   m_bus = data;
360}
trunk/src/mess/machine/x820kb.h
r0r241608
1// license:BSD-3-Clause
2// copyright-holders:Curt Coder
3/**********************************************************************
4
5    Xerox 820/820-II ASCII keyboard emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10*********************************************************************/
11
12#pragma once
13
14#ifndef __XEROX_820_KEYBOARD__
15#define __XEROX_820_KEYBOARD__
16
17#include "emu.h"
18#include "cpu/mcs48/mcs48.h"
19#include "machine/clock.h"
20
21
22
23//**************************************************************************
24//  INTERFACE CONFIGURATION MACROS
25//**************************************************************************
26
27#define MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(_devcb) \
28   devcb = &xerox_820_keyboard_t::set_kbstb_wr_callback(*device, DEVCB_##_devcb);
29
30
31
32//**************************************************************************
33//  TYPE DEFINITIONS
34//**************************************************************************
35
36// ======================> xerox_820_keyboard_t
37
38class xerox_820_keyboard_t :  public device_t
39{
40public:
41   // construction/destruction
42   xerox_820_keyboard_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
43
44   template<class _Object> static devcb_base &set_kbstb_wr_callback(device_t &device, _Object object) { return downcast<xerox_820_keyboard_t &>(device).m_kbstb_cb.set_callback(object); }
45
46   // optional information overrides
47   virtual const rom_entry *device_rom_region() const;
48   virtual machine_config_constructor device_mconfig_additions() const;
49   virtual ioport_constructor device_input_ports() const;
50
51   UINT8 read() { return m_bus; }
52
53   DECLARE_READ8_MEMBER( kb_p1_r );
54   DECLARE_WRITE8_MEMBER( kb_p1_w );
55   DECLARE_READ8_MEMBER( kb_p2_r );
56   DECLARE_READ8_MEMBER( kb_t0_r );
57   DECLARE_READ8_MEMBER( kb_t1_r );
58   DECLARE_WRITE8_MEMBER( kb_bus_w );
59
60protected:
61   // device-level overrides
62   virtual void device_start();
63   virtual void device_reset();
64
65private:
66   required_device<cpu_device> m_maincpu;
67   required_ioport m_y0;
68   required_ioport m_y1;
69   required_ioport m_y2;
70   required_ioport m_y3;
71   required_ioport m_y4;
72   required_ioport m_y5;
73   required_ioport m_y6;
74   required_ioport m_y7;
75   required_ioport m_y8;
76   required_ioport m_yd;
77   required_ioport m_yf;
78
79   devcb_write_line   m_kbstb_cb;
80
81   UINT8 m_p1;
82   UINT8 m_bus;
83};
84
85
86// device type definition
87extern const device_type XEROX_820_KEYBOARD;
88
89
90
91#endif
trunk/src/mess/mess.mak
r241607r241608
18291829   $(MESS_DRIVERS)/jupiter.o   \
18301830
18311831$(MESSOBJ)/xerox.a:             \
1832   $(MESS_DRIVERS)/xerox820.o  \
1832   $(MESS_DRIVERS)/xerox820.o $(MESS_MACHINE)/x820kb.o \
18331833   $(MESS_DRIVERS)/bigbord2.o  \
18341834   $(MESS_DRIVERS)/alto2.o     \
18351835


Previous 199869 Revisions Next


© 1997-2024 The MAME Team