Previous 199869 Revisions Next

r25458 Sunday 29th September, 2013 at 15:30:43 UTC by R. Belmont
(MESS) ec1841 updates: [shattered]
- Emulated the original keyboard
- DIP switches added
- Improved memory mapping
[src/mess]mess.mak
[src/mess/drivers]pc.c
[src/mess/includes]pc.h
[src/mess/machine]kb_ec1841.c* kb_ec1841.h* pc.c pc_keyboards.c pc_keyboards.h

trunk/src/mess/drivers/pc.c
r25457r25458
140140
141141static ADDRESS_MAP_START( ec1841_map, AS_PROGRAM, 16, pc_state )
142142   ADDRESS_MAP_UNMAP_HIGH
143   AM_RANGE(0x00000, 0x7ffff) AM_RAMBANK("bank10") // up to 4 banks
143   AM_RANGE(0x00000, 0x7ffff) AM_RAM
144144   AM_RANGE(0xa0000, 0xbffff) AM_NOP
145145   AM_RANGE(0xc0000, 0xc7fff) AM_ROM
146146   AM_RANGE(0xc8000, 0xcffff) AM_ROM
r25457r25458
879879   PORT_INCLUDE( pcvideo_mc1502 )
880880INPUT_PORTS_END
881881
882static INPUT_PORTS_START( ec1841 )
883   PORT_START("DSW0") /* SA1 */
884   PORT_DIPNAME( 0xc0, 0x40, "Number of floppy drives")
885   PORT_DIPSETTING(    0x00, "1" )
886   PORT_DIPSETTING(    0x40, "2" )
887   PORT_DIPSETTING(    0x80, "3" )
888   PORT_DIPSETTING(    0xc0, "4" )
889   PORT_DIPNAME( 0x30, 0x20, "Graphics adapter")
890   PORT_DIPSETTING(    0x00, "Reserved" )
891   PORT_DIPSETTING(    0x10, "Color 40x25" )
892   PORT_DIPSETTING(    0x20, "Color 80x25" )
893   PORT_DIPSETTING(    0x30, "Monochrome" )
894   PORT_BIT(     0x08, 0x08, IPT_UNUSED )
895   PORT_DIPNAME( 0x04, 0x04, "Floppy type")
896   PORT_DIPSETTING(    0x00, "80 tracks" )
897   PORT_DIPSETTING(    0x04, "40 tracks" )
898   PORT_DIPNAME( 0x02, 0x00, "8087 installed")
899   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
900   PORT_DIPSETTING(    0x02, DEF_STR( Yes ) )
901   PORT_DIPNAME( 0x01, 0x01, "Boot from floppy")
902   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
903   PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
882904
905//   PORT_START("DSW1") /* SA2 */
906
907   PORT_INCLUDE( pcvideo_cga )
908INPUT_PORTS_END
909
910
911
883912static const pc_lpt_interface pc_lpt_config =
884913{
885914   DEVCB_CPU_INPUT_LINE("maincpu", 0)
r25457r25458
15231552
15241553   MCFG_SOFTWARE_LIST_ADD("flop_list","ec1841")
15251554
1526   /* keyboard -- needs dump */
15271555   MCFG_PC_KBDC_ADD("pc_kbdc", pc_kbdc_intf)
1528   MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270)
1556   MCFG_PC_KBDC_SLOT_ADD("pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841)
15291557
15301558   /* internal ram -- up to 4 banks of 512K */
15311559   MCFG_RAM_ADD(RAM_TAG)
15321560   MCFG_RAM_DEFAULT_SIZE("512K")
1533//  MCFG_RAM_EXTRA_OPTIONS("640K,1024K,1576K,2048K")
1561   MCFG_RAM_EXTRA_OPTIONS("1024K,1576K,2048K")
15341562MACHINE_CONFIG_END
15351563
15361564
r25457r25458
25402568COMP( 1992, iskr3104,   ibm5150,    0,          iskr3104,   pcega, pc_state,      pccga,      "Schetmash", "Iskra 3104", GAME_NOT_WORKING)
25412569COMP( 198?, asst128,    ibm5150,    0,          asst128,    pccga, pc_state,      pccga,      "Schetmash", "Assistent 128", GAME_NOT_WORKING)
25422570COMP( 1987, ec1840,     ibm5150,    0,          iskr1031,   pccga, pc_state,      pccga,      "<unknown>", "EC-1840", GAME_NOT_WORKING)
2543COMP( 1987, ec1841,     ibm5150,    0,          ec1841,     pccga, pc_state,      pccga,      "<unknown>", "EC-1841", GAME_NOT_WORKING)
2571COMP( 1987, ec1841,     ibm5150,    0,          ec1841,     ec1841, pc_state,     ec1841,     "<unknown>", "EC-1841", GAME_NOT_WORKING)
25442572COMP( 1989, ec1845,     ibm5150,    0,          iskr1031,   pccga, pc_state,      pccga,      "<unknown>", "EC-1845", GAME_NOT_WORKING)
25452573COMP( 1989, mk88,       ibm5150,    0,          iskr1031,   pccga, pc_state,      pccga,      "<unknown>", "MK-88", GAME_NOT_WORKING)
25462574COMP( 1990, poisk1,     ibm5150,    0,          iskr1031,   pccga, pc_state,      pccga,      "<unknown>", "Poisk-1", GAME_NOT_WORKING)
trunk/src/mess/mess.mak
r25457r25458
18281828   $(MESS_MACHINE)/pc_joy.o    \
18291829   $(MESS_MACHINE)/pc_joy_sw.o \
18301830   $(MESS_MACHINE)/pc_keyboards.o \
1831   $(MESS_MACHINE)/kb_ec1841.o \
18311832   $(MESS_MACHINE)/kb_keytro.o \
18321833   $(MESS_MACHINE)/kb_msnat.o  \
18331834   $(MESS_MACHINE)/kb_pc83.o   \
trunk/src/mess/machine/pc_keyboards.c
r25457r25458
11
22#include "emu.h"
33#include "machine/pc_keyboards.h"
4#include "machine/kb_ec1841.h"
45#include "machine/kb_keytro.h"
56#include "machine/kb_msnat.h"
67#include "machine/kb_pc83.h"
r25457r25458
1112   SLOT_INTERFACE(STR_KBD_KEYTRONIC_PC3270, PC_KBD_KEYTRONIC_PC3270)
1213   SLOT_INTERFACE(STR_KBD_IBM_PC_83, PC_KBD_IBM_PC_83)
1314   SLOT_INTERFACE(STR_KBD_IBM_PC_XT_83, PC_KBD_IBM_PC_XT_83)
15   SLOT_INTERFACE(STR_KBD_EC_1841, PC_KBD_EC_1841)
1416SLOT_INTERFACE_END
1517
1618
trunk/src/mess/machine/pc_keyboards.h
r25457r25458
1212#define STR_KBD_KEYTRONIC_PC3270    "keytronc_pc3270"
1313#define STR_KBD_IBM_PC_83           "pc"
1414#define STR_KBD_IBM_PC_XT_83        "pcxt"
15#define STR_KBD_EC_1841             "ec1841"
1516
1617SLOT_INTERFACE_EXTERN(pc_xt_keyboards);
1718
trunk/src/mess/machine/pc.c
r25457r25458
8888READ8_MEMBER(pc_state::ec1841_memboard_r)
8989{
9090   pc_state *st = space.machine().driver_data<pc_state>();
91   return st->m_memboard[(offset % 4)];
91   UINT8 data;
92
93   data = offset % 4;
94   if (data > m_memboards)
95      data = 0xff;
96   else
97      data = st->m_memboard[data];
98   DBG_LOG(1,"ec1841_memboard",("R (%d of %d) == %02X\n", offset, m_memboards, data ));
99
100   return data;
92101}
93102
94103WRITE8_MEMBER(pc_state::ec1841_memboard_w)
r25457r25458
97106   address_space &program = st->m_maincpu->space(AS_PROGRAM);
98107   UINT8 current;
99108
100   DBG_LOG(1,"ec1841_memboard_w",("(%d) <- %02X\n", offset, data));
109   current = st->m_memboard[offset];
101110
102   // for now, handle only board 0
103   if (offset > 0) {
104      st->m_memboard[offset] = data;
111   DBG_LOG(1,"ec1841_memboard",("W (%d of %d) <- %02X (%02X)\n", offset, m_memboards, data, current));
112
113   if (offset > m_memboards) {
105114      return;
106115   }
107116
108   current = st->m_memboard[offset];
109
110117   if (BIT(current, 2) && !BIT(data, 2)) {
111118      // disable read access
112119      program.unmap_read(0, 0x7ffff);
r25457r25458
120127   }
121128
122129   if (!BIT(current, 2) && BIT(data, 2)) {
130      for(int i=0; i<4; i++)
131         st->m_memboard[i] &= 0xfb;
123132      // enable read access
133      membank("bank10")->set_base(m_ram->pointer() + offset*0x80000);
124134      program.install_read_bank(0, 0x7ffff, "bank10");
125135      DBG_LOG(1,"ec1841_memboard_w",("map_read(%d)\n", offset));
126136   }
127137
128138   if (!BIT(current, 3) && BIT(data, 3)) {
139      for(int i=0; i<4; i++)
140         st->m_memboard[i] &= 0xf7;
129141      // enable write access
130      program.install_write_bank(0, 0x7ffff, "bank10");
142      membank("bank20")->set_base(m_ram->pointer() + offset*0x80000);
143      program.install_write_bank(0, 0x7ffff, "bank20");
131144      DBG_LOG(1,"ec1841_memboard_w",("map_write(%d)\n", offset));
132145   }
133146
r25457r25458
14701483   mess_init_pc_common(NULL);
14711484}
14721485
1486DRIVER_INIT_MEMBER(pc_state,ec1841)
1487{
1488   address_space &program = m_maincpu->space(AS_PROGRAM);
14731489
1490   program.install_read_bank(0, 0x7ffff, "bank10");
1491   program.install_write_bank(0, 0x7ffff, "bank20");
1492   membank( "bank10" )->set_base( m_ram->pointer() );
1493   membank( "bank20" )->set_base( m_ram->pointer() );
1494
1495   pc_rtc_init();
1496}
1497
1498
14741499IRQ_CALLBACK_MEMBER(pc_state::pc_irq_callback)
14751500{
14761501   return m_pic8259->acknowledge();
r25457r25458
15071532   m_ppi_shift_enable = 0;
15081533
15091534   m_speaker->level_w(0);
1535
1536   // ec1841-specific code
1537   m_memboards = m_ram->size()/(512*1024) - 1;
1538   if (m_memboards > 3)
1539      m_memboards = 3;
1540   memset(m_memboard,0,sizeof(m_memboard));
1541   // mark 1st board enabled
1542   m_memboard[0]=0xc;
15101543}
15111544
15121545
r25457r25458
15481581   m_pc_spkrdata = 0;
15491582   m_pc_input = 1;
15501583   m_dma_channel = -1;
1551   memset(m_memboard,0xc,sizeof(m_memboard));  // check
15521584   memset(m_dma_offset,0,sizeof(m_dma_offset));
15531585   m_ppi_portc_switch_high = 0;
15541586   m_ppi_speaker = 0;
trunk/src/mess/machine/kb_ec1841.c
r0r25458
1/**********************************************************************
2
3    EC-1841 92-key keyboard emulation
4
5    Sends 9 non-standard scan codes (54..5C) and reassigns 3 standard
6    ones (2A, 36, 3A).  EC-1841 BIOS converts scan codes into Cyrillic
7    by default; 'Lat' key (mapped to F11) switches it to Latin mode.
8    'Rus' (F12) switches back.
9
10    Copyright MESS Team.
11    Visit http://mamedev.org for licensing and usage restrictions.
12
13*********************************************************************/
14
15#include "kb_ec1841.h"
16
17#define VERBOSE_DBG 0       /* general debug messages */
18
19#define DBG_LOG(N,M,A) \
20   do { \
21   if(VERBOSE_DBG>=N) \
22      { \
23         logerror("%11.6f at %s: ",machine().time().as_double(),machine().describe_context()); \
24         logerror A; \
25      } \
26   } while (0)
27
28
29
30//**************************************************************************
31//  MACROS / CONSTANTS
32//**************************************************************************
33
34#define I8048_TAG       "i8048"
35
36
37
38//**************************************************************************
39//  DEVICE DEFINITIONS
40//**************************************************************************
41
42const device_type PC_KBD_EC_1841 = &device_creator<ec_1841_keyboard_device>;
43
44
45//-------------------------------------------------
46//  ROM( ec_1841_keyboard )
47//-------------------------------------------------
48
49ROM_START( ec_1841_keyboard )
50   ROM_REGION( 0x400, I8048_TAG, 0 )
51   // XXX add P/N etc
52   ROM_LOAD( "1816be48.bin", 0x000, 0x400, CRC(e9abfe44) SHA1(1db430c72c2d007ea0b8ae2514ff15c96baba308) )
53ROM_END
54
55
56//-------------------------------------------------
57//  rom_region - device-specific ROM region
58//-------------------------------------------------
59
60const rom_entry *ec_1841_keyboard_device::device_rom_region() const
61{
62   return ROM_NAME( ec_1841_keyboard );
63}
64
65
66//-------------------------------------------------
67//  ADDRESS_MAP( kb_io )
68//-------------------------------------------------
69
70static ADDRESS_MAP_START( ec_1841_keyboard_io, AS_IO, 8, ec_1841_keyboard_device )
71   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w)
72   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(p1_r, p1_w)
73   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
74   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r)
75ADDRESS_MAP_END
76
77
78//-------------------------------------------------
79//  MACHINE_DRIVER( ec_1841_keyboard )
80//-------------------------------------------------
81
82static MACHINE_CONFIG_FRAGMENT( ec_1841_keyboard )
83   // XXX check
84   MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20.7)))
85   MCFG_CPU_IO_MAP(ec_1841_keyboard_io)
86MACHINE_CONFIG_END
87
88
89//-------------------------------------------------
90//  machine_config_additions - device-specific
91//  machine configurations
92//-------------------------------------------------
93
94machine_config_constructor ec_1841_keyboard_device::device_mconfig_additions() const
95{
96   return MACHINE_CONFIG_NAME( ec_1841_keyboard );
97}
98
99
100//-------------------------------------------------
101//  INPUT_PORTS( ec_1841_keyboard )
102//-------------------------------------------------
103
104INPUT_PORTS_START( ec_1841_keyboard )
105   PORT_START("MD00")
106   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
107   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(TAB))
108   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A')
109   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z')
110   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?59?") // 0x59 = Inf
111   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(MINUS_PAD))
112   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
113   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
114
115   PORT_START("MD01")
116   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ESC) PORT_CHAR(UCHAR_MAMEKEY(ESC))
117   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q')
118   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S')
119   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X')
120   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
121   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 7 Home") PORT_CODE(KEYCODE_7_PAD) PORT_CHAR(UCHAR_MAMEKEY(7_PAD))
122   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
123   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
124
125   PORT_START("MD02")
126   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHAR('!')
127   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W')
128   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('d') PORT_CHAR('D')
129   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('c') PORT_CHAR('C')
130   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RCONTROL) // 0x5a = R/L (R)
131   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 8 "UTF8_UP) PORT_CODE(KEYCODE_8_PAD) PORT_CHAR(UCHAR_MAMEKEY(8_PAD))
132   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
133   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
134
135   PORT_START("MD03")
136   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHAR('@')
137   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E')
138   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('f') PORT_CHAR('F')
139   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V')
140   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F12) PORT_CHAR(UCHAR_MAMEKEY(F12)) // 0x5b = Rus
141   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 9 PgUp") PORT_CODE(KEYCODE_9_PAD) PORT_CHAR(UCHAR_MAMEKEY(9_PAD))
142   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
143   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
144
145   PORT_START("MD04")
146   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHAR('#')
147   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R')
148   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G')
149   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B')
150   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
151   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 4 "UTF8_LEFT) PORT_CODE(KEYCODE_4_PAD) PORT_CHAR(UCHAR_MAMEKEY(4_PAD))
152   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
153   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
154
155   PORT_START("MD05")
156   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
157   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T')
158   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H')
159   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N')
160   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
161   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5_PAD) PORT_CHAR(UCHAR_MAMEKEY(5_PAD))
162   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
163   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
164
165   PORT_START("MD06")
166   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
167   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y')
168   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J')
169   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M')
170   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
171   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 6 "UTF8_RIGHT) PORT_CODE(KEYCODE_6_PAD) PORT_CHAR(UCHAR_MAMEKEY(6_PAD))
172   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
173   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
174
175   PORT_START("MD07")
176   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('^')
177   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U')
178   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K')
179   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_TILDE) PORT_CHAR('`') PORT_CHAR('~')
180   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
181   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 1 End") PORT_CODE(KEYCODE_1_PAD) PORT_CHAR(UCHAR_MAMEKEY(1_PAD))
182   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
183   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
184
185   PORT_START("MD08")
186   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('&')
187   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I')
188   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_L) PORT_CHAR('l') PORT_CHAR('L')
189   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?2a?")
190   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
191   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 2 "UTF8_DOWN) PORT_CODE(KEYCODE_2_PAD) PORT_CHAR(UCHAR_MAMEKEY(2_PAD))
192   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
193   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
194
195   PORT_START("MD09")
196   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('*')
197   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O')
198   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_OPENBRACE) PORT_CHAR('[') PORT_CHAR('{')
199   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?5c?") // 0x5c = YO
200   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
201   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 3 PgDn") PORT_CODE(KEYCODE_3_PAD) PORT_CHAR(UCHAR_MAMEKEY(3_PAD))
202   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
203   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
204
205   PORT_START("MD10")
206   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHAR('(')
207   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P')
208   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CLOSEBRACE) PORT_CHAR(']') PORT_CHAR('}')
209   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COMMA) PORT_CHAR(',') PORT_CHAR('<')
210   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
211   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad 0 Ins") PORT_CODE(KEYCODE_0_PAD) PORT_CHAR(UCHAR_MAMEKEY(0_PAD))
212   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
213   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
214
215   PORT_START("MD11")
216   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHAR(')')
217   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?36?")
218   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_COLON) PORT_CHAR(';') PORT_CHAR(':')
219   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_STOP) PORT_CHAR('.') PORT_CHAR('>')
220   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
221   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Keypad . Del") PORT_CODE(KEYCODE_DEL_PAD) PORT_CHAR(UCHAR_MAMEKEY(DEL_PAD))
222   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
223   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
224
225   PORT_START("MD12")
226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_CHAR('-') PORT_CHAR('_')
227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("?3a?")
228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_QUOTE) PORT_CHAR('\'') PORT_CHAR('"')
229   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x55
230   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F9) PORT_CHAR(UCHAR_MAMEKEY(F9))
231   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CHAR(UCHAR_MAMEKEY(PLUS_PAD))
232   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
233   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
234
235   PORT_START("MD13")
236   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+')
237   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_SLASH) PORT_CHAR('/') PORT_CHAR('?')
238   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
239   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_CAPSLOCK) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) // 0x56
240   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F10) PORT_CHAR(UCHAR_MAMEKEY(F10))
241   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
242   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
243   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
244
245   PORT_START("MD14")
246   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSLASH) PORT_CHAR('\\') PORT_CHAR('|')
247   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_PRTSCR)
248   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LALT) PORT_CHAR(UCHAR_MAMEKEY(LALT))
249   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F11) PORT_CHAR(UCHAR_MAMEKEY(F11)) // 0x57 = Lat
250   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_NUMLOCK) PORT_CHAR(UCHAR_MAMEKEY(NUMLOCK))
251   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
252   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
253   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
254
255   PORT_START("MD15")
256   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(8)
257   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_SHIFT_2)
258   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LSHIFT) PORT_CHAR(UCHAR_SHIFT_1) // 0x54
259   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RALT) // 0x58 = R/L (L)
260   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Scroll Lock Break") PORT_CODE(KEYCODE_SCRLOCK) PORT_CHAR(UCHAR_MAMEKEY(SCRLOCK))
261   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
262   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
263   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
264INPUT_PORTS_END
265
266
267//-------------------------------------------------
268//  input_ports - device-specific input ports
269//-------------------------------------------------
270
271ioport_constructor ec_1841_keyboard_device::device_input_ports() const
272{
273   return INPUT_PORTS_NAME( ec_1841_keyboard );
274}
275
276
277
278//**************************************************************************
279//  LIVE DEVICE
280//**************************************************************************
281
282//-------------------------------------------------
283//  ec_1841_keyboard_device - constructor
284//-------------------------------------------------
285
286ec_1841_keyboard_device::ec_1841_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
287   : device_t(mconfig, PC_KBD_EC_1841, "EC-1841 Keyboard", tag, owner, clock, "kb_ec1841", __FILE__),
288      device_pc_kbd_interface(mconfig, *this),
289      m_maincpu(*this, I8048_TAG),
290      m_md00(*this, "MD00"),
291      m_md01(*this, "MD01"),
292      m_md02(*this, "MD02"),
293      m_md03(*this, "MD03"),
294      m_md04(*this, "MD04"),
295      m_md05(*this, "MD05"),
296      m_md06(*this, "MD06"),
297      m_md07(*this, "MD07"),
298      m_md08(*this, "MD08"),
299      m_md09(*this, "MD09"),
300      m_md10(*this, "MD10"),
301      m_md11(*this, "MD11"),
302      m_md12(*this, "MD12"),
303      m_md13(*this, "MD13"),
304      m_md14(*this, "MD14"),
305      m_md15(*this, "MD15"),
306      m_bus(0xff),
307      m_p1(0xff),
308      m_p2(0xff),
309      m_q(1)
310{
311}
312
313
314//-------------------------------------------------
315//  device_start - device-specific startup
316//-------------------------------------------------
317
318void ec_1841_keyboard_device::device_start()
319{
320   set_pc_kbdc_device();
321
322   // state saving
323   save_item(NAME(m_bus));
324   save_item(NAME(m_p1));
325   save_item(NAME(m_p2));
326   save_item(NAME(m_q));
327}
328
329
330//-------------------------------------------------
331//  device_reset - device-specific reset
332//-------------------------------------------------
333
334void ec_1841_keyboard_device::device_reset()
335{
336}
337
338
339//-------------------------------------------------
340//  clock_write -
341//-------------------------------------------------
342
343WRITE_LINE_MEMBER( ec_1841_keyboard_device::clock_write )
344{
345   DBG_LOG(1,0,( "%s: clock write %d\n", tag(), state));
346}
347
348
349//-------------------------------------------------
350//  data_write -
351//-------------------------------------------------
352
353WRITE_LINE_MEMBER( ec_1841_keyboard_device::data_write )
354{
355   DBG_LOG(1,0,( "%s: data write %d\n", tag(), state));
356}
357
358
359//-------------------------------------------------
360//  bus_w -
361//-------------------------------------------------
362
363WRITE8_MEMBER( ec_1841_keyboard_device::bus_w )
364{
365   DBG_LOG(2,0,( "%s: bus_w %02x\n", tag(), data));
366
367   m_bus = data;
368}
369
370
371//-------------------------------------------------
372//  p1_r -
373//-------------------------------------------------
374
375READ8_MEMBER( ec_1841_keyboard_device::p1_r )
376{
377   /*
378
379       bit     description
380
381       0       -REQ IN
382       1       DATA IN
383       2
384       3
385       4
386       5
387       6
388       7
389
390   */
391
392   UINT8 data = 0;
393
394   data |= clock_signal();
395   data |= data_signal() << 1;
396
397   DBG_LOG(1,0,( "%s: p1_r %02x\n", tag(), data));
398
399   return data;
400}
401
402
403//-------------------------------------------------
404//  p1_w -
405//-------------------------------------------------
406
407WRITE8_MEMBER( ec_1841_keyboard_device::p1_w )
408{
409   /*
410       bit     description
411
412       0
413       1
414       2
415       3
416       4
417       5       LED XXX
418       6       LED XXX
419       7       LED XXX
420   */
421   DBG_LOG(1,0,( "%s: p1_w %02x\n", tag(), data));
422
423   m_p1 = data;
424}
425
426
427//-------------------------------------------------
428//  p2_w -
429//-------------------------------------------------
430
431WRITE8_MEMBER( ec_1841_keyboard_device::p2_w )
432{
433   /*
434       bit     description
435
436       0       -STROBE (to matrix mux)
437       1       XXX CLOCK out 1
438       2       XXX DATA out 1
439       3
440       4
441       5       XXX DATA out 2?
442       6       XXX CLOCK out 2?
443       7       XXX
444   */
445   DBG_LOG(1,0,( "%s: p2_w %02x\n", tag(), data));
446
447   m_pc_kbdc->data_write_from_kb(BIT(data, 2));
448   m_pc_kbdc->clock_write_from_kb(BIT(data, 1));
449
450   m_p2 = data;
451}
452
453
454//-------------------------------------------------
455//  t1_r -
456//-------------------------------------------------
457
458READ8_MEMBER( ec_1841_keyboard_device::t1_r )
459{
460   if (BIT(m_p2,0)) {
461      m_q = 1;
462   } else {
463      UINT8 sense = 0xff;
464
465      switch(m_bus & 15) {
466         case 0: sense &= m_md00->read(); break;
467         case 1: sense &= m_md01->read(); break;
468         case 2: sense &= m_md02->read(); break;
469         case 3: sense &= m_md03->read(); break;
470         case 4: sense &= m_md04->read(); break;
471         case 5: sense &= m_md05->read(); break;
472         case 6: sense &= m_md06->read(); break;
473         case 7: sense &= m_md07->read(); break;
474         case 8: sense &= m_md08->read(); break;
475         case 9: sense &= m_md09->read(); break;
476         case 10: sense &= m_md10->read(); break;
477         case 11: sense &= m_md11->read(); break;
478         case 12: sense &= m_md12->read(); break;
479         case 13: sense &= m_md13->read(); break;
480         case 14: sense &= m_md14->read(); break;
481         case 15: sense &= m_md15->read(); break;
482      }
483      m_q = BIT(sense, (m_bus >> 4) & 7);
484   }
485
486   DBG_LOG(1,0,( "%s: bus %02X t1_r %d\n", tag(), m_bus, m_q));
487
488   return m_q;
489}
Property changes on: trunk/src/mess/machine/kb_ec1841.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/machine/kb_ec1841.h
r0r25458
1/**********************************************************************
2
3    EC-1841 92-key keyboard emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8*********************************************************************/
9
10#pragma once
11
12#ifndef __PC_KBD_EC_1841__
13#define __PC_KBD_EC_1841__
14
15#include "emu.h"
16#include "cpu/mcs48/mcs48.h"
17#include "machine/pc_kbdc.h"
18#include "machine/rescap.h"
19
20
21
22//**************************************************************************
23//  TYPE DEFINITIONS
24//**************************************************************************
25
26// ======================> ec_1841_keyboard_device
27
28class ec_1841_keyboard_device :  public device_t,
29                              public device_pc_kbd_interface
30{
31public:
32   // construction/destruction
33   ec_1841_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
34
35   // optional information overrides
36   virtual const rom_entry *device_rom_region() const;
37   virtual machine_config_constructor device_mconfig_additions() const;
38   virtual ioport_constructor device_input_ports() const;
39
40   DECLARE_WRITE8_MEMBER( bus_w );
41   DECLARE_READ8_MEMBER( p1_r );
42   DECLARE_WRITE8_MEMBER( p1_w );
43   DECLARE_WRITE8_MEMBER( p2_w );
44   DECLARE_READ8_MEMBER( t1_r );
45
46protected:
47   // device-level overrides
48   virtual void device_start();
49   virtual void device_reset();
50
51   // device_pc_kbd_interface overrides
52   virtual DECLARE_WRITE_LINE_MEMBER( clock_write );
53   virtual DECLARE_WRITE_LINE_MEMBER( data_write );
54
55private:
56   required_device<cpu_device> m_maincpu;
57   required_ioport m_md00;
58   required_ioport m_md01;
59   required_ioport m_md02;
60   required_ioport m_md03;
61   required_ioport m_md04;
62   required_ioport m_md05;
63   required_ioport m_md06;
64   required_ioport m_md07;
65   required_ioport m_md08;
66   required_ioport m_md09;
67   required_ioport m_md10;
68   required_ioport m_md11;
69   required_ioport m_md12;
70   required_ioport m_md13;
71   required_ioport m_md14;
72   required_ioport m_md15;
73
74   UINT8 m_bus;
75   UINT8 m_p1;
76   UINT8 m_p2;
77   int m_q;
78};
79
80
81// device type definition
82extern const device_type PC_KBD_EC_1841;
83
84
85
86#endif
Property changes on: trunk/src/mess/machine/kb_ec1841.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/includes/pc.h
r25457r25458
5252   UINT8   m_u73_q2;
5353   UINT8   m_out1;
5454   UINT8   m_memboard[4];      /* used only by ec1840 and ec1841 */
55   int m_memboards;
5556   int m_dma_channel;
5657   UINT8 m_dma_offset[2][4];
5758   int m_cur_eop;
r25457r25458
9192   DECLARE_READ8_MEMBER(unk_r);
9293   DECLARE_READ8_MEMBER(ec1841_memboard_r);
9394   DECLARE_WRITE8_MEMBER(ec1841_memboard_w);
95   DECLARE_DRIVER_INIT(ec1841);
9496   DECLARE_DRIVER_INIT(mc1502);
9597   DECLARE_DRIVER_INIT(bondwell);
9698   DECLARE_DRIVER_INIT(pcjr);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team