Previous 199869 Revisions Next

r23852 Friday 21st June, 2013 at 21:33:10 UTC by Curt Coder
(MESS) ibm5150: Keyboard WIP. (nw)
[src/emu/cpu/mcs48]mcs48.h
[src/emu/machine]rescap.h
[src/mess/machine]kb_pcxt83.c kb_pcxt83.h pc_keyboards.h

trunk/src/emu/cpu/mcs48/mcs48.h
r23851r23852
8787    MACROS
8888***************************************************************************/
8989
90#define MCS48_LC_CLOCK(_L, _C) \
91    (1 / (2 * 3.14159265358979323846 * sqrt(_L * _C)))
92
9093#define MCS48_ALE_CLOCK(_clock) \
9194   attotime::from_hz(_clock/(3*5))
9295
trunk/src/emu/machine/rescap.h
r23851r23852
88#define CAP_U(cap) ((double)(cap) * 1e-6)
99#define CAP_N(cap) ((double)(cap) * 1e-9)
1010#define CAP_P(cap) ((double)(cap) * 1e-12)
11#define IND_U(ind) ((double)(ind) * 1e-6)
12#define IND_N(ind) ((double)(ind) * 1e-9)
13#define IND_P(ind) ((double)(ind) * 1e-12)
1114
1215/*  vin --/\r1/\-- out --/\r2/\-- gnd  */
1316#define RES_VOLTAGE_DIVIDER(r1, r2)     ((double)(r2) / ((double)(r1) + (double)(r2)))
trunk/src/mess/machine/pc_keyboards.h
r23851r23852
1010
1111// PC XT protocol keyboards
1212#define STR_KBD_KEYTRONIC_PC3270    "keytronc_pc3270"
13#define STR_KBD_IBM_PC_XT_83      "pcxt83"
13#define STR_KBD_IBM_PC_XT_83      "pcxt"
1414
1515SLOT_INTERFACE_EXTERN(pc_xt_keyboards);
1616
trunk/src/mess/machine/kb_pcxt83.c
r23851r23852
11/**********************************************************************
22
3    IBM PC/XT 5150/5160 83-key keyboard emulation
3    IBM Model F PC/XT 5150/5160 83-key keyboard emulation
44
55    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
r23851r23852
3333ROM_START( ibm_pc_xt_83_keyboard )
3434   ROM_REGION( 0x400, I8048_TAG, 0 )
3535   /*
36   Keyboard Part No. 1501105
37
3638   MOI 74 01
3739   PN 4584751
3840   GX 344231
r23851r23852
6163//-------------------------------------------------
6264
6365static ADDRESS_MAP_START( ibm_pc_xt_83_keyboard_io, AS_IO, 8, ibm_pc_xt_83_keyboard_device )
66   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_WRITE(bus_w)
67   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READ(p1_r) AM_WRITENOP
68   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(p2_w)
69   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(t1_r)
6470ADDRESS_MAP_END
6571
6672
r23851r23852
6975//-------------------------------------------------
7076
7177static MACHINE_CONFIG_FRAGMENT( ibm_pc_xt_83_keyboard )
72   MCFG_CPU_ADD(I8048_TAG, I8048, 4000000)
78   MCFG_CPU_ADD(I8048_TAG, I8048, MCS48_LC_CLOCK(IND_U(47), CAP_P(20)))
7379   MCFG_CPU_IO_MAP(ibm_pc_xt_83_keyboard_io)
7480MACHINE_CONFIG_END
7581
r23851r23852
126132
127133void ibm_pc_xt_83_keyboard_device::device_start()
128134{
135   // state saving
136   save_item(NAME(m_cnt));
137   save_item(NAME(m_key_depressed));
129138}
130139
131140
r23851r23852
135144
136145void ibm_pc_xt_83_keyboard_device::device_reset()
137146{
147   m_maincpu->reset();
138148}
139149
140150
141151//-------------------------------------------------
142//  clock_write -
152//  bus_w -
143153//-------------------------------------------------
144154
145WRITE_LINE_MEMBER( ibm_pc_xt_83_keyboard_device::clock_write )
155WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::bus_w )
146156{
157   m_cnt = data;
147158}
148159
149160
150161//-------------------------------------------------
151//  data_write -
162//  p1_r -
152163//-------------------------------------------------
153164
154WRITE_LINE_MEMBER( ibm_pc_xt_83_keyboard_device::data_write )
165READ8_MEMBER( ibm_pc_xt_83_keyboard_device::p1_r )
155166{
167   /*
168   
169       bit     description
170   
171       0       -REQ IN
172       1       DATA IN
173       2       
174       3       
175       4       
176       5       
177       6       
178       7       
179   
180   */
181   
182   UINT8 data = 0;
183
184   data |= clock_signal();
185   data |= data_signal() << 1;
186
187   return data;
156188}
189
190
191//-------------------------------------------------
192//  p2_w -
193//-------------------------------------------------
194
195WRITE8_MEMBER( ibm_pc_xt_83_keyboard_device::p2_w )
196{
197   /*
198   
199       bit     description
200   
201       0       -MATRIX STROBE
202       1       CLOCK OUT
203       2       DATA OUT
204       3       
205       4       
206       5       
207       6       
208       7       
209   
210   */
211
212   m_pc_kbdc->clock_write_from_kb(BIT(data, 1));
213   m_pc_kbdc->data_write_from_kb(BIT(data, 2));
214}
215
216
217//-------------------------------------------------
218//  t1_r -
219//-------------------------------------------------
220
221READ8_MEMBER( ibm_pc_xt_83_keyboard_device::t1_r )
222{
223   return m_key_depressed;
224}
trunk/src/mess/machine/kb_pcxt83.h
r23851r23852
11/**********************************************************************
22
3    IBM PC/XT 5150/5160 83-key keyboard emulation
3    IBM Model F PC/XT 5150/5160 83-key keyboard emulation
44
55    Copyright MESS Team.
66    Visit http://mamedev.org for licensing and usage restrictions.
r23851r23852
1515#include "emu.h"
1616#include "cpu/mcs48/mcs48.h"
1717#include "machine/pc_kbdc.h"
18#include "machine/rescap.h"
1819
1920
2021
r23851r23852
3637   virtual machine_config_constructor device_mconfig_additions() const;
3738   virtual ioport_constructor device_input_ports() const;
3839
40   DECLARE_WRITE8_MEMBER( bus_w );
41   DECLARE_READ8_MEMBER( p1_r );
42   DECLARE_WRITE8_MEMBER( p2_w );
43   DECLARE_READ8_MEMBER( t1_r );
44
3945protected:
4046   // device-level overrides
4147   virtual void device_start();
4248   virtual void device_reset();
4349
4450   // device_pc_kbd_interface overrides
45   virtual DECLARE_WRITE_LINE_MEMBER( clock_write );
46   virtual DECLARE_WRITE_LINE_MEMBER( data_write );
51   virtual DECLARE_WRITE_LINE_MEMBER( clock_write ) { };
52   virtual DECLARE_WRITE_LINE_MEMBER( data_write ) { };
4753
4854private:
4955   required_device<cpu_device> m_maincpu;
56
57   UINT8 m_cnt;
58   int m_key_depressed;
5059};
5160
5261

Previous 199869 Revisions Next


© 1997-2024 The MAME Team