Previous 15994 Revisions Next

r3922 Saturday 20th December, 2008 at 16:58:17 UTC by Wilbert Pol
Removed deprecat.h from machine/at.c. Merged 8042kbdc updates from mame.
[src/emu/machine]8042kbdc.c 8042kbdc.h
[src/mess/machine]at.c

src/emu/machine/8042kbdc.c
r3921r3922
204204static struct
205205{
206206   kbdc8042_type_t type;
207   void (*set_gate_a20)(int a20);
208   void (*keyboard_interrupt)(int state);
207   void (*set_gate_a20)(running_machine *machine, int a20);
208   void (*keyboard_interrupt)(running_machine *machine, int state);
209209   int (*get_out2)(running_machine *machine);
210210
211211   UINT8 inport, outport, data, command;
r3921r3922
234234
235235static int poll_delay;
236236
237static void at_8042_check_keyboard(void);
237static void at_8042_check_keyboard(running_machine *machine);
238238
239239
240240
r3921r3922
244244
245245***************************************************************************/
246246
247static void at_8042_set_outport(UINT8 data, int initial)
247static void at_8042_set_outport(running_machine *machine, UINT8 data, int initial)
248248{
249249   UINT8 change;
250250   change = initial ? 0xFF : (kbdc8042.outport ^ data);
r3921r3922
252252   if (change & 0x02)
253253   {
254254      if (kbdc8042.set_gate_a20)
255         kbdc8042.set_gate_a20(data & 0x02 ? 1 : 0);
255         kbdc8042.set_gate_a20(machine, data & 0x02 ? 1 : 0);
256256   }
257257}
258258
r3921r3922
261261static TIMER_CALLBACK( kbdc8042_time )
262262{
263263   at_keyboard_polling();
264   at_8042_check_keyboard();
264   at_8042_check_keyboard(machine);
265265}
266266
267267
r3921r3922
277277
278278   /* ibmat bios wants 0x20 set! (keyboard locked when not set) 0x80 */
279279   kbdc8042.inport = 0xa0;
280   at_8042_set_outport(0xfe, 1);
280   at_8042_set_outport(machine, 0xfe, 1);
281281
282282   timer_pulse(machine, ATTOTIME_IN_HZ(60), NULL, 0, kbdc8042_time);
283283}
284284
285static void at_8042_receive(int data)
285static void at_8042_receive(running_machine *machine, UINT8 data)
286286{
287287   if (LOG_KEYBOARD)
288288      logerror("at_8042_receive Received 0x%02x\n", data);
289289
290   kbdc8042.data = (UINT8) data;
290   kbdc8042.data = data;
291291   kbdc8042.keyboard.received = 1;
292292
293293   if (kbdc8042.keyboard_interrupt)
294294   {
295      kbdc8042.keyboard_interrupt(1);
296      kbdc8042.keyboard_interrupt(0);
295      kbdc8042.keyboard_interrupt(machine, 1);
296      kbdc8042.keyboard_interrupt(machine, 0);
297297   }
298298}
299299
300static void at_8042_check_keyboard(void)
300static void at_8042_check_keyboard(running_machine *machine)
301301{
302302   int data;
303303
r3921r3922
305305      && !kbdc8042.mouse.received)
306306   {
307307      if ( (data = at_keyboard_read())!=-1)
308         at_8042_receive(data);
308         at_8042_receive(machine, data);
309309   }
310310}
311311
r3921r3922
360360         /* at386 self test doesn't like this */
361361         at_8042_clear_keyboard_received();
362362      }
363      at_8042_check_keyboard();
363      at_8042_check_keyboard(space->machine);
364364      break;
365365
366366   case 1:
r3921r3922
395395      break;
396396
397397   case 4:
398      at_8042_check_keyboard();
398      at_8042_check_keyboard(space->machine);
399399
400400      if (kbdc8042.keyboard.received || kbdc8042.mouse.received)
401401         data |= 1;
r3921r3922
432432
433433static TIMER_CALLBACK(at_8042_receive_timer)
434434{
435   at_8042_receive(param);
435   at_8042_receive(machine, param);
436436}
437437
438438
r3921r3922
462462             *   | `----------- keyboard clock (output)
463463             *   `------------ keyboard data (output)
464464             */
465         at_8042_set_outport(data, 0);
465         at_8042_set_outport(space->machine, data, 0);
466466         break;
467467
468468      case 2:
r3921r3922
513513         kbdc8042.mouse.on = 1;
514514         break;
515515      case 0xa9:   /* test mouse */
516         at_8042_receive(PS2_MOUSE_ON ? 0x00 : 0xff);
516         at_8042_receive(space->machine, PS2_MOUSE_ON ? 0x00 : 0xff);
517517         break;
518518      case 0xaa:   /* selftest */
519519         if (space->machine->config->cpu[0].type == CPU_I486)
520520            timer_set(space->machine, ATTOTIME_IN_MSEC(10), NULL, 0x55, at_8042_receive_timer); /* HACK */
521521         else
522            at_8042_receive(0x55);
522            at_8042_receive(space->machine, 0x55);
523523         break;
524524      case 0xab:   /* test keyboard */
525         at_8042_receive(KEYBOARD_ON ? 0x00 : 0xff);
525         at_8042_receive(space->machine, KEYBOARD_ON ? 0x00 : 0xff);
526526         break;
527527      case 0xad:   /* disable keyboard interface */
528528         kbdc8042.keyboard.on = 0;
r3921r3922
540540             *   | `----------- 1=primary display is MDA, 0=CGA
541541             *   `------------ 1=keyboard not inhibited; 0=inhibited
542542             */
543         at_8042_receive(kbdc8042.inport);
543         at_8042_receive(space->machine, kbdc8042.inport);
544544         break;
545545      case 0xc1:   /* read input port 3..0 until write to 0x60 */
546546         kbdc8042.status_read_mode = 1;
r3921r3922
549549         kbdc8042.status_read_mode = 2;
550550         break;
551551      case 0xd0:   /* read output port */
552         at_8042_receive(kbdc8042.outport);
552         at_8042_receive(space->machine, kbdc8042.outport);
553553         break;
554554      case 0xd1:
555555         /* write output port; next byte written to port 60h is placed on
r3921r3922
578578         break;
579579      case 0xe0:
580580         /* read test inputs; read T1/T0 test inputs into bit 1/0 */
581         at_8042_receive(0x00);
581         at_8042_receive(space->machine, 0x00);
582582         break;
583583
584584      case 0xf0:
r3921r3922
595595             * an effect currently is bit 0, which pulses the CPU's reset line
596596             */
597597         cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE);
598         at_8042_set_outport(kbdc8042.outport | 0x02, 0);
598         at_8042_set_outport(space->machine, kbdc8042.outport | 0x02, 0);
599599         break;
600600      }
601601      kbdc8042.sending = 1;
src/emu/machine/8042kbdc.h
r3921r3922
2121struct kbdc8042_interface
2222{
2323   kbdc8042_type_t type;
24   void (*set_gate_a20)(int a20);
25   void (*keyboard_interrupt)(int state);
24   void (*set_gate_a20)(running_machine *machine, int a20);
25   void (*keyboard_interrupt)(running_machine *machine, int state);
2626   int (*get_out2)(running_machine *machine);
2727};
2828
src/mess/machine/at.c
r3921r3922
55***************************************************************************/
66
77#include "driver.h"
8#include "deprecat.h"
98
109#include "cpu/i386/i386.h"
1110#include "cpu/i8x41/i8x41.h"
r3921r3922
142141};
143142
144143
145static void at_set_gate_a20(int a20)
144static void at_set_gate_a20(running_machine *machine, int a20)
146145{
147146   /* set the CPU's A20 line */
148   cpu_set_input_line(Machine->cpu[0], INPUT_LINE_A20, a20);
147   cpu_set_input_line(machine->cpu[0], INPUT_LINE_A20, a20);
149148}
150149
151150
r3921r3922
178177
179178
180179
181static void at_keyboard_interrupt(int state)
180static void at_keyboard_interrupt(running_machine *machine, int state)
182181{
183182   pic8259_set_irq_line(at_devices.pic8259_master, 1, state);
184183}
r3921r3922
485484{
486485   logerror("%04x: writing $%02x to P2\n", cpu_get_pc(space->machine->cpu[0]), data );
487486
488   at_set_gate_a20( ( data & 0x02 ) ? 1 : 0 );
487   at_set_gate_a20( space->machine, ( data & 0x02 ) ? 1 : 0 );
489488   
490489   cpu_set_input_line(space->machine->cpu[0], INPUT_LINE_RESET, ( data & 0x01 ) ? CLEAR_LINE : ASSERT_LINE );
491490

Previous 15994 Revisions Next


© 1998-2018 The MESS Team