home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / KEYBOARD / INT9FIX2.ZIP / INT09FIX.ZIP / KBFIX.DOC < prev    next >
Encoding:
Text File  |  1990-04-20  |  4.4 KB  |  80 lines

  1.    KBFIX.DOC    18-Apr-1990
  2.  
  3.    A problem involving incorrect keyboard data has been reported by
  4.    several LANtastic user's. When using enhanced (101-key) keyboards
  5.    with NUM-lock on, a "Left-shift on" state occasionally becomes active
  6.    when no shift key is depressed. The state can be cleared by pressing
  7.    and releasing the left shift key. Also, on some machines, an enhanced
  8.    key (Arrows, Insert, Delete, Home, End, PageUp, PageDown) are
  9.    occassionally decoded as their numeric keypad NUMlocked equivalents,
  10.    e.g. "2", "4", "6", etc.
  11.  
  12.    The problem seems to stem from the fact that the enhanced keyboards
  13.    send a string of scan codes (4 scan codes when NUMlock is on) for
  14.    each press or release of the key. An E0 scan code precedes each of
  15.    the others, to indicate that the following scan code is to be interpreted
  16.    as "enhanced".
  17.  
  18.    These four scan code are sent in rapid succession to the PC motherboard.
  19.    As each is received, an IRQ1 is activated, which invokes the ISR for
  20.    INT 09H. This ISR is initially set to the BIOS keyboard handler,
  21.    although it is later re-hooked by resident drivers such as REDIR.
  22.    One of the first things the AT-BIOS handler does is to inhibit the
  23.    keyboard from sending further scan codes until processing of the one
  24.    causing the interrupt is complete.
  25.  
  26.    Unfortunately, before it does this, AT-BIOS executes an STI intruction,
  27.    allowing other interrupts (e.g., timer ticks) to interrupt the keyboard
  28.    ISR.
  29.  
  30.    Provided the interrupting timer tick ISR executes quickly, and control
  31.    returns to the keyboard handler before the scan code is replaced by
  32.    a new one, no harm is done. However, TSRs (such as REDIR) often hook
  33.    into the timer (08H) interrupt and may prolong its service time by
  34.    a substantial amount. If two scan codes come in quick succession
  35.    (as with the enhanced keys, which send E0 followed by the keycode),
  36.    then the first one (the E0 in this case) may be overwritten by the
  37.    second and be lost. Thus, the next scan code is interpreted as
  38.    a non-enhanced keystroke (a shift key or a numeric key).
  39.  
  40.    This problem would never occur if the BIOS would inhibit the keyboard
  41.    BEFORE it reenables interrupts. Unfortunately it doesn't, and the
  42.    BIOS cannot be changed.
  43.  
  44.    Three solutions to this problem have been written. The first, and the
  45.    preferable one, is KBFIX.EXE. It should be run in AUTOEXEC.BAT
  46.    before any TSRs which hook INT 9 are loaded. It searches through
  47.    the MS-DOS INT 9 handler for DOS's hook into the BIOS keyboard handler.
  48.    When it is found, the hook is modified to point just AFTER the
  49.    offending STI instruction, thereby eliminating the possibility
  50.    of interrupt preemption until after the keyboard is disabled.
  51.    Unfortunately, it is necessary for a program of this nature to
  52.    take advantage of specific characteristics of DOS and BIOS. It has
  53.    been tried successfully on several 386 and 286 AT-BIOS implementations
  54.    with no problems. The program is smart enough NOT to make the
  55.    modification if a discrepancy is noted. Since the modification
  56.    is made within DOS, the program does not need to TSR, and no additional
  57.    memory is consumed.
  58.  
  59.    If KBFIX.EXE cannot be used because INT9 is already hooked by a device
  60.    driver in CONFIG.SYS or the MSDOS is not compatible, the same effect
  61.    can be achieved by including KBDFIX.SYS as a device driver (ahead of
  62.    any other device drivers which hook INT 9) in CONFIG.SYS. The patch
  63.    will be applied directly to the BIOS INT 9 hook, and the driver
  64.    will not remain resident (no memory will be consumed).
  65.  
  66.    For specific BIOS implementations where KBFIX.EXE and KBDFIX.SYS will
  67.    not work, the INT9FIX.EXE utility was written. It loads as a TSR (288
  68.    resident bytes) and hooks the keyboard (09h) interrupt. Before passing
  69.    control to the BIOS keyboard handler, it masks IRQ0 (the timer) so the
  70.    keyboard ISR cannot be interrupted. When BIOS returns, it restores the
  71.    interrupt mask for IRQ0 to its original state. INT9FIX should normally 
  72.    be the FIRST TSR loaded which hooks INT9, so that timer interrupts are
  73.    masked for as short a time as possible. No ill effects from using this
  74.    program have yet been noted, but since timer ticks are disabled,
  75.    operation of the Print-Screen key, the INT15 scan-code translation
  76.    hook, etc., may be affected in some software configurations.
  77.    
  78.     End  KBFIX.DOC
  79.  
  80.