Previous 15994 Revisions Next

r12448 Monday 1st August, 2011 at 21:57:31 UTC by Curt Coder
[PC1512] Fixed keyboard interface, pc1512v2 boots now. [Curt Coder]
[src/mess/drivers]pc1512.c
[src/mess/machine]pc1512kb.c pc1512kb.h

src/mess/machine/pc1512kb.c
r12447r12448
255255pc1512_keyboard_device::pc1512_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
256256    : device_t(mconfig, PC1512_KEYBOARD, "Amstrad PC1512 Keyboard", tag, owner, clock),
257257     m_maincpu(*this, I8048_TAG),
258     m_data_in(0),
258     m_data_in(1),
259259     m_clock_in(1),
260260     m_kb_y(0xffff),
261261     m_joy_com(1),
r12447r12448
271271
272272void pc1512_keyboard_device::device_start()
273273{
274   // allocate timers
275   m_reset_timer = timer_alloc();
276   
274277   // resolve callbacks
275278    m_out_data_func.resolve(m_out_data_cb, *this);
276279    m_out_clock_func.resolve(m_out_clock_cb, *this);
r12447r12448
296299
297300
298301//-------------------------------------------------
302//  device_timer - handler timer events
303//-------------------------------------------------
304
305void pc1512_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
306{
307   if (!m_clock_in)
308   {
309      device_set_input_line(m_maincpu, INPUT_LINE_RESET, ASSERT_LINE);
310   }
311}
312
313
314//-------------------------------------------------
299315//  data_w - keyboard data input
300316//-------------------------------------------------
301317
r12447r12448
311327
312328WRITE_LINE_MEMBER( pc1512_keyboard_device::clock_w )
313329{
330   if (m_clock_in != state)
331   {
332      if (!state)
333      {
334         m_reset_timer->adjust(attotime::from_msec(10));   
335      }
336      else
337      {
338         device_set_input_line(m_maincpu, INPUT_LINE_RESET, CLEAR_LINE);
339      }
340   }
341   
314342   m_clock_in = state;
315343}
316344
src/mess/machine/pc1512kb.h
r12447r12448
7575    // device-level overrides
7676    virtual void device_start();
7777   virtual void device_reset();
78   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
7879    virtual void device_config_complete();
7980
8081private:
r12447r12448
8990   int m_joy_com;
9091   int m_m1;
9192   int m_m2;
93
94   emu_timer *m_reset_timer;
9295};
9396
9497
src/mess/drivers/pc1512.c
r12447r12448
1111    TODO:
1212
1313   - adjust mouse speed
14   - V2 keyboard error
1514   - V3 VDU check goes crazy
1615
1716*/
r12447r12448
5857      {
5958         data = m_kbd;
6059         m_kb_bits = 0;
60         m_kb->data_w(1);
6161         pic8259_ir1_w(m_pic, CLEAR_LINE);
6262      }
6363      break;
r12447r12448
126126      m_speaker_drive = BIT(data, 1);
127127      update_speaker();
128128
129      m_kb->data_w(BIT(data, 6));
129      m_kb->clock_w(BIT(data, 6));
130130      break;
131131
132132   case 4:
r12447r12448
327327      break;
328328
329329   case 2:
330      data = m_printer_control;
330      /*
331
332            bit     description
333
334            0       Data Strobe
335            1       Select Auto Feed
336            2       Reset Printer
337            3       Select Printer
338            4       Enable Int on ACK
339            5      1
340            6
341            7
342
343        */
344
345      data = m_printer_control | 0x20;
331346      break;
332347   }
333348
r12447r12448
358373            2       Reset Printer
359374            3       Select Printer
360375            4       Enable Int on ACK
361            5
376            5     
362377            6
363378            7
364379
365380        */
366381
367      m_printer_control = data;
382      m_printer_control = data & 0x1f;
368383
369384      centronics_strobe_w(m_centronics, BIT(data, 0));
370385      centronics_autofeed_w(m_centronics, BIT(data, 1));
r12447r12448
480495   AM_RANGE(0x020, 0x021) AM_DEVREADWRITE8_LEGACY(I8259A2_TAG, pic8259_r, pic8259_w, 0xffff)
481496   AM_RANGE(0x040, 0x043) AM_DEVREADWRITE8_LEGACY(I8253_TAG, pit8253_r, pit8253_w, 0xffff)
482497   AM_RANGE(0x060, 0x06f) AM_READWRITE8(system_r, system_w, 0xffff)
483   AM_RANGE(0x070, 0x071) AM_DEVREADWRITE8(MC146818_TAG, mc146818_device, read, write, 0xffff)
498   AM_RANGE(0x070, 0x071) AM_MIRROR(0x02) AM_DEVREADWRITE8(MC146818_TAG, mc146818_device, read, write, 0xffff)
484499   AM_RANGE(0x078, 0x07f) AM_READWRITE8(mouse_r, mouse_w, 0xffff)
485500   AM_RANGE(0x080, 0x083) AM_WRITE8(dma_page_w, 0xffff)
486501   AM_RANGE(0x0a0, 0x0a1) AM_WRITE8(nmi_mask_w, 0xff00)
r12447r12448
608623
609624WRITE_LINE_MEMBER( pc1512_state::kbclk_w )
610625{
611   if (m_kbclk && !state)
626   if (!BIT(m_port61, 7) && m_kbclk && !state)
612627   {
613628      m_kbd <<= 1;
614629      m_kbd |= m_kbdata;
r12447r12448
616631
617632      if (m_kb_bits == 8)
618633      {
634         m_kb->data_w(0);
619635         pic8259_ir1_w(m_pic, ASSERT_LINE);
620636      }
621637   }
r12447r12448
10121028   m_vdu_rdsel = 0;
10131029   m_vdu_plane = 0x0f;
10141030   m_vdu_border = 0;
1031   
1032   m_kb->clock_w(0);
10151033}
10161034
10171035

Previous 15994 Revisions Next


© 1998-2018 The MESS Team