Previous 15994 Revisions Next

r13836 Tuesday 3rd January, 2012 at 12:10:02 UTC by Curt Coder
[VICTOR9K] Keyboard WIP. (nw)
[src/mess/drivers]victor9k.c
[src/mess/includes]victor9k.h
[src/mess/machine]victor9kb.c victor9kb.h

src/mess/machine/victor9kb.c
r13835r13836
4343//-------------------------------------------------
4444 
4545static ADDRESS_MAP_START( victor9k_keyboard_io, AS_IO, 8, victor9k_keyboard_device )
46   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_READWRITE(kb_p1_r, kb_p1_w)
47   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_WRITE(kb_p2_w)
48   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_READ(kb_t1_r)
4649ADDRESS_MAP_END
4750 
4851 
r13835r13836
5154//-------------------------------------------------
5255 
5356static MACHINE_CONFIG_FRAGMENT( victor9k_keyboard )
54   MCFG_CPU_ADD(I8021_TAG, I8021, 100000) // XTAL 48-300-010, 30 clocks/cycle
57   MCFG_CPU_ADD(I8021_TAG, I8021, 10000000) // XTAL 48-300-010
5558   MCFG_CPU_IO_MAP(victor9k_keyboard_io)
5659MACHINE_CONFIG_END
5760 
r13835r13836
7275//-------------------------------------------------
7376 
7477INPUT_PORTS_START( victor9k_keyboard )
78    PORT_START("Y0")
79    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
80    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
81    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
82    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
83    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
84    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
85    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
86    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
87 
88    PORT_START("Y1")
89    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
90    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
91    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
92    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
93    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
94    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
95    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
96    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
97 
98    PORT_START("Y2")
99    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
100    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
101    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
102    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
103    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
104    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
105    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
106    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
107 
108    PORT_START("Y3")
109    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
110    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
111    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
112    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
113    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
114    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
115    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
116    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
117 
118    PORT_START("Y4")
119    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
120    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
121    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
122    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
123    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
124    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
125    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
126    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
127 
128    PORT_START("Y5")
129    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
130    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
131    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
132    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
133    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
134    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
135    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
136    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
137 
138    PORT_START("Y6")
139    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
140    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
141    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
142    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
143    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
144    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
145    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
146    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
147 
148    PORT_START("Y7")
149    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
150    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
151    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
152    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
153    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
154    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
155    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
156    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
157 
158    PORT_START("Y8")
159    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
160    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
161    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
162    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
163    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
164    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
165    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
166    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
167 
168    PORT_START("Y9")
169    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
170    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
171    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
172    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
173    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
174    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
175    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
176    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
177 
178    PORT_START("YA")
179    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
180    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
181    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
182    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
183    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
184    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
185    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
186    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
187 
188    PORT_START("YB")
189    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
190    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
191    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
192    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
193    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
194    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
195    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
196    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
197 
198    PORT_START("YC")
199    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
200    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
201    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
202    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
203    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
204    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
205    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
206    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) 
75207INPUT_PORTS_END
76208 
77209 
r13835r13836
97229victor9k_keyboard_device::victor9k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
98230    : device_t(mconfig, VICTOR9K_KEYBOARD, "Victor 9000 Keyboard", tag, owner, clock),
99231     m_maincpu(*this, I8021_TAG),
100     m_kbdata(0)
232     m_y(0),
233     m_kbrdy(1),
234     m_kbdata(1),
235     m_kback(1)
101236{
102237}
103238 
r13835r13836
112247    m_out_kbrdy_func.resolve(m_out_kbrdy_cb, *this);
113248 
114249   // state saving
250   save_item(NAME(m_y));
251   save_item(NAME(m_kbrdy));
115252   save_item(NAME(m_kbdata));
253   save_item(NAME(m_kback));
116254}
117255 
118256 
r13835r13836
126264 
127265 
128266//-------------------------------------------------
267//  kbrdy_r - 
268//-------------------------------------------------
269 
270READ_LINE_MEMBER( victor9k_keyboard_device::kbrdy_r )
271{
272   return m_kbrdy;
273}
274 
275 
276//-------------------------------------------------
129277//  kback_w - 
130278//-------------------------------------------------
131279 
132280WRITE_LINE_MEMBER( victor9k_keyboard_device::kback_w )
133281{
282   m_kback = state;
134283}
135284 
136285 
r13835r13836
142291{
143292   return m_kbdata;
144293}
294 
295 
296//-------------------------------------------------
297//  kb_p1_r - 
298//-------------------------------------------------
299 
300READ8_MEMBER( victor9k_keyboard_device::kb_p1_r )
301{
302   UINT8 data = 0xff;
303   
304   switch (m_y)
305   {
306      case 0: data &= input_port_read(this, "Y0"); break;
307      case 1: data &= input_port_read(this, "Y1"); break;
308      case 2: data &= input_port_read(this, "Y2"); break;
309      case 3: data &= input_port_read(this, "Y3"); break;
310      case 4: data &= input_port_read(this, "Y4"); break;
311      case 5: data &= input_port_read(this, "Y5"); break;
312      case 6: data &= input_port_read(this, "Y6"); break;
313      case 7: data &= input_port_read(this, "Y7"); break;
314      case 8: data &= input_port_read(this, "Y8"); break;
315      case 9: data &= input_port_read(this, "Y9"); break;
316      case 0xa: data &= input_port_read(this, "YA"); break;
317      case 0xb: data &= input_port_read(this, "YB"); break;
318      case 0xc: data &= input_port_read(this, "YC"); break;
319   }
320   
321   return data;
322}
323 
324 
325//-------------------------------------------------
326//  kb_p1_w -
327//-------------------------------------------------
328 
329WRITE8_MEMBER( victor9k_keyboard_device::kb_p1_w )
330{
331   if ((data & 0xf0) == 0x20)
332   {
333      m_y = data & 0x0f;
334   }
335   
336   logerror("P1 %02x\n", data);
337}
338 
339 
340//-------------------------------------------------
341//  kb_p2_w -
342//-------------------------------------------------
343 
344WRITE8_MEMBER( victor9k_keyboard_device::kb_p2_w )
345{
346   /*
347 
348        bit     description
349 
350        P20      keylatch enable ?
351        P21       
352        P22      key available ?
353        P23      data ?
354 
355   */
356   
357   int kbrdy = BIT(data, 2);
358   
359   if (m_kbrdy != kbrdy)
360   {
361      m_kbrdy = kbrdy;
362      m_out_kbrdy_func(m_kbrdy);
363   }
364   
365   m_kbdata = BIT(data, 3);
366   
367   logerror("P2 %01x\n", data & 0x0f);
368}
369 
370 
371//-------------------------------------------------
372//  kb_t1_r - 
373//-------------------------------------------------
374 
375READ8_MEMBER( victor9k_keyboard_device::kb_t1_r )
376{
377   logerror("read T1 %u\n", m_kback);
378   
379   return m_kback;
380}
src/mess/machine/victor9kb.h
r13835r13836
5858   virtual machine_config_constructor device_mconfig_additions() const;
5959   virtual ioport_constructor device_input_ports() const;
6060 
61   DECLARE_READ_LINE_MEMBER( kbrdy_r );
6162   DECLARE_WRITE_LINE_MEMBER( kback_w );
6263   DECLARE_READ_LINE_MEMBER( kbdata_r );
6364 
65   // not really public
66   DECLARE_READ8_MEMBER( kb_p1_r );
67   DECLARE_WRITE8_MEMBER( kb_p1_w );
68   DECLARE_WRITE8_MEMBER( kb_p2_w );
69   DECLARE_READ8_MEMBER( kb_t1_r );
70 
6471protected:
6572    // device-level overrides
6673    virtual void device_start();
r13835r13836
7279 
7380   required_device<cpu_device> m_maincpu;
7481   
82   UINT8 m_y;
83   int m_kbrdy;
7584   int m_kbdata;
85   int m_kback;
7686};
7787 
7888 
src/mess/includes/victor9k.h
r13835r13836
4949        m_pic(*this, I8259A_TAG),
5050        m_ssda(*this, MC6852_TAG),
5151        m_via1(*this, M6522_1_TAG),
52        m_via2(*this, M6522_2_TAG),
5253        m_cvsd(*this, HC55516_TAG),
5354        m_crtc(*this, HD46505S_TAG),
5455        m_ram(*this, RAM_TAG),
r13835r13836
6263   required_device<ieee488_device> m_ieee488;
6364   required_device<device_t> m_pic;
6465   required_device<mc6852_device> m_ssda;
65   required_device<device_t> m_via1;
66   required_device<via6522_device> m_via1;
67   required_device<via6522_device> m_via2;
6668   required_device<device_t> m_cvsd;
6769   required_device<mc6845_device> m_crtc;
6870   required_device<ram_device> m_ram;
r13835r13836
103105   DECLARE_WRITE8_MEMBER( via6_pb_w );
104106   DECLARE_WRITE_LINE_MEMBER( drw_w );
105107   DECLARE_WRITE_LINE_MEMBER( erase_w );
108   DECLARE_WRITE_LINE_MEMBER( kbrdy_w );
106109
107110   /* video state */
108111   UINT8 *m_video_ram;
src/mess/drivers/victor9k.c
r13835r13836
5353ADDRESS_MAP_END
5454
5555static ADDRESS_MAP_START( floppy_io, AS_IO, 8, victor9k_state )
56//  AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1)
57//  AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2)
58//  AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1)
59//  AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS)
56   AM_RANGE(MCS48_PORT_P1, MCS48_PORT_P1) AM_NOP
57   AM_RANGE(MCS48_PORT_P2, MCS48_PORT_P2) AM_NOP
58   AM_RANGE(MCS48_PORT_T1, MCS48_PORT_T1) AM_NOP
59   AM_RANGE(MCS48_PORT_BUS, MCS48_PORT_BUS) AM_NOP
6060ADDRESS_MAP_END
6161
6262// Input Ports
r13835r13836
463463   DEVCB_DRIVER_MEMBER(victor9k_state, via2_pa_r),
464464   DEVCB_NULL,
465465   DEVCB_NULL,
466   DEVCB_NULL, // KBRDY
466   DEVCB_DEVICE_LINE_MEMBER(VICTOR9K_KEYBOARD_TAG, victor9k_keyboard_device, kbrdy_r),
467467   DEVCB_NULL, // SRQ/BUSY
468468   DEVCB_DEVICE_LINE_MEMBER(VICTOR9K_KEYBOARD_TAG, victor9k_keyboard_device, kbdata_r),
469469
r13835r13836
874874   DEVCB_DRIVER_LINE_MEMBER(victor9k_state, via6_irq_w)
875875};
876876
877// Keyboard
878
879WRITE_LINE_MEMBER( victor9k_state::kbrdy_w )
880{
881   m_via2->write_cb1(state);
882   
883   pic8259_ir6_w(m_pic, state ? CLEAR_LINE : ASSERT_LINE);
884}
885
877886static VICTOR9K_KEYBOARD_INTERFACE( kb_intf )
878887{
879   DEVCB_DEVICE_LINE_MEMBER(M6522_2_TAG, via6522_device, write_cb1)
888   DEVCB_DRIVER_LINE_MEMBER(victor9k_state, kbrdy_w)
880889};
881890
882891// Floppy Configuration

Previous 15994 Revisions Next


© 1998-2018 The MESS Team