How fast is a PS/2 keyboard?

A few weeks ago, an interesting question cropped up: How fast is a PS/2 keyboard? That is to say, how quickly can it send scan codes (bytes) to the keyboard controller?

One might also ask, does it really matter? Sure enough, it does. As it turns out, the Borland Turbo Pascal 6.0 run-time, and probably a few related versions, handle keyboard input in a rather unorthodox way. The run-time installs its own INT 9/IRQ 1 handler (keyboard interrupt) which reads port 60h (keyboard data) and then chains to the original INT 9 handler, which reads port 60h again, expecting to read the same value.

That is a completely crazy approach, unless there is a solid guarantee that the keyboard can’t send a new byte of data before port 60h is read the second time. The two reads are done more or less back to back, with interrupts disabled, so much time cannot elapse between the two. But there will be some period of time where the keyboard might send further data. So, how quickly can a keyboard do that?

I love these questions.

16 Comments

  1. 2018-08-06 9:27 pm
    • 2018-08-07 1:42 pm
  2. 2018-08-06 10:44 pm
    • 2018-08-07 7:40 am
      • 2018-08-08 2:45 am
        • 2018-08-08 8:10 am
          • 2018-08-08 12:40 pm
      • 2018-08-09 12:07 am
    • 2018-08-07 1:40 pm
      • 2018-08-07 2:25 pm
        • 2018-08-07 2:41 pm
          • 2018-08-07 3:19 pm
  3. 2018-08-07 7:20 pm
    • 2018-08-07 9:55 pm
  4. 2018-08-08 12:37 pm
    • 2018-08-10 4:02 pm