src/doskbd.c
/************************************************************************/
/*                                                                      */
/*                      E N T E R D O S K B D                           */
/*                                                                      */
/*      Turn on the DOS keyboard device.                                */
/*                                                                      */
/************************************************************************/
E N T E R D O S K B D

Turn on the DOS keyboard device.
E N T E R D O S K B D Turn on the DOS keyboard device .
void EnterDosKbd(KbdInterface kbd)
{
  int i;
  if (kbd->device.active == FALSE) {
    kbd->device.active = TRUE;
    for (i = 0; i < 0x80; i++) kbd->KeyMap[i] = DOSLispKeyMap_101[i];
    if (eurokbd)
      kbd->keyeventsize = EUROKEYEVENTSIZE;
    else
      kbd->keyeventsize = NOEUROKEYEVENTSIZE;
    kbd->eurokbd = eurokbd;
    kbd->maxkeyevent = (MINKEYEVENT + (NUMBEROFKEYEVENTS * kbd->keyeventsize));
    _dpmi_lockregion((void *)&currentkbd, sizeof(currentkbd));
    _dpmi_lockregion((void *)kbd, sizeof(*kbd));
    _dpmi_lockregion((void *)&InterfacePage, sizeof(InterfacePage));
    _dpmi_lockregion((void *)InterfacePage, sizeof(IFPAGE));
    _dpmi_lockregion((void *)&IOPage68K, sizeof(IOPage68K));
    _dpmi_lockregion((void *)IOPage68K, sizeof(IOPAGE));
    _dpmi_lockregion((void *)&MachineState, sizeof(MachineState));
    _dpmi_lockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent));
    _dpmi_lockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent));
    _dpmi_lockregion((void *)&KEYBUFFERING68k, sizeof(KEYBUFFERING68k));
    _dpmi_lockregion((void *)&ExitDosKbd, 4096);
    _dpmi_lockregion((void *)&Kbd_event, 4096);
    if (!nokbdflag) {
      kbd->prev_handler = _dos_getvect(0x09); 
      _dos_setvect(0x09, kbd->device_event);  
    }
  }
}
void EnterDosKbd ( KbdInterface kbd ) { int i ; if ( kbd -> device . active == FALSE ) { kbd -> device . active = TRUE ; for ( i = 0 ; i < 0x80 ; i ++ ) kbd -> KeyMap [ i ] = DOSLispKeyMap_101 [ i ] ; if ( eurokbd ) kbd -> keyeventsize = EUROKEYEVENTSIZE ; else kbd -> keyeventsize = NOEUROKEYEVENTSIZE ; kbd -> eurokbd = eurokbd ; kbd -> maxkeyevent = ( MINKEYEVENT + ( NUMBEROFKEYEVENTS * kbd -> keyeventsize ) ) ; _dpmi_lockregion ( ( void * ) & currentkbd , sizeof ( currentkbd ) ) ; _dpmi_lockregion ( ( void * ) kbd , sizeof ( * kbd ) ) ; _dpmi_lockregion ( ( void * ) & InterfacePage , sizeof ( InterfacePage ) ) ; _dpmi_lockregion ( ( void * ) InterfacePage , sizeof ( IFPAGE ) ) ; _dpmi_lockregion ( ( void * ) & IOPage68K , sizeof ( IOPage68K ) ) ; _dpmi_lockregion ( ( void * ) IOPage68K , sizeof ( IOPAGE ) ) ; _dpmi_lockregion ( ( void * ) & MachineState , sizeof ( MachineState ) ) ; _dpmi_lockregion ( ( void * ) & CTopKeyevent , sizeof ( CTopKeyevent ) ) ; _dpmi_lockregion ( ( void * ) CTopKeyevent , sizeof ( * CTopKeyevent ) ) ; _dpmi_lockregion ( ( void * ) & KEYBUFFERING68k , sizeof ( KEYBUFFERING68k ) ) ; _dpmi_lockregion ( ( void * ) & ExitDosKbd , 4096 ) ; _dpmi_lockregion ( ( void * ) & Kbd_event , 4096 ) ; if ( ! nokbdflag ) { kbd -> prev_handler = _dos_getvect ( 0x09 ) ; _dos_setvect ( 0x09 , kbd -> device_event ) ; } } }
E N T E R D O S K B D
E N T E R D O S K B D
/* Offset of the end of the ring buffer */ /* Don't hook in our handler if the user flagged he wants to run */ /* without a kbd. */ /* get addr of current 09 hndlr */ /* hook our int handler to interrupt  */