 #define buttonSelect 32
 #define buttonB      64
 #define buttonA      128
-
-/*
- *  Loader protocol
- */
-
-#define N 60 // Payload bytes per transmission frame
-byte checksum; // Global is simplest
-
-/*
- *  PS/2 keyboard hookup to Arduino
- */
-
-#include <PS2Keyboard.h> // Install from the Arduino IDE's Library Manager
-
-PS2Keyboard keyboard;
-
-// 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
-
-// Keyboard
-// Pin  4  PS/2 Data
-// Pin  3  PS/2 Clock
+// Note: The kit's controller gives inverted signals.
 
 /*
  *  Setup runs once when the Arduino wakes up

bool detectGigatron()
{
  unsigned long timeout = millis() + 85;
  long T[] = {0, 0, 0, 0};

  // Sample the sync signals coming out of the controller port
  while (millis() < timeout)
    T[(PINB >> PORTB3) & 3]++; // capture PORTB3 and PORTB4

  float S = T[0] + T[1] + T[2] + T[3] + .1; // Avoid zero division (pedantic)
  float vSync = (T[0] + T[1]) / ( 8 * S / 521); // Adjusted vSync signal
  float hSync = (T[0] + T[2]) / (96 * S / 800); // Standard hSync signal

  // Check that vSync and hSync characteristics look normal
  return 0.95 <= vSync && vSync <= 1.20 && 0.95 <= hSync && hSync <= 1.05;

  byte lastByte = -checksum;   // Checksum must come out as 0
  sendBits(lastByte, 8);
  checksum = lastByte;         // Concatenate checksums
  PORTB |= 1<<SER_DATA;          // Send 1 when idle
}

void sendFirst(byte value, byte n)
{
  // Wait vertical sync NEGATIVE edge to sync with loader
  while (~PINB & (1<<SER_LATCH)) // Ensure vSync is HIGH first
    ;
  while (PINB & (1<<SER_LATCH)) // Then wait for vSync to drop
    ;
  sendBits(value, n);
}
