 // Pin 12  PORTB4 7 vSync  SER_LATCH  0 PAR/SER None
 // Pin 11  PORTB3 6 hSync  SER_PULSE 10 CLOCK   11 SRCLK 12 RCLK
 
-// Keyboard
-// Pin  4  PS/2 Data
-// Pin  3  PS/2 Clock
-
-#include <PS2Keyboard.h> // Install from the Arduino IDE's Library Manager
-
-// Pins for PS/2 keyboard (Arduino Uno)
-const int keyboardClockPin = 3;  // Pin 2 or 3 for IRQ
-const int keyboardDataPin  = 4;  // Any available free pin
-
-PS2Keyboard keyboard;
+// Game controller button mapping. The kit's controller gives inverted signals.
 #define buttonRight  1
 #define buttonLeft   2
 #define buttonDown   4

  while (millis() < timeout)
    T[(PINB >> PORTB3) & 3]++; // capture PORTB3 and PORTB4

  float S = T[0] + T[1] + T[2] + T[3];
  float vSync = (T[0] + T[1]) / ( 8 * S / 521); // Gigatron VGA
  float hSync = (T[0] + T[2]) / (96 * S / 800); // Default VGA

  return 0.95 <= vSync && vSync <= 1.20 && 0.95 <= hSync && hSync <= 1.05;
}


  prompt();
}

/*
 *  Loop runs repeatedly
 */
void loop()
{
  static char line[20];
