public void keyPressed(int key) {
    int i = keyMapping.getKey(key);
    if (i < 0) return;
    if ((i < 20) && 
      (keyBuffer[(kwp & 0x3F)] == 0)) {
      keyBuffer[(kwp++ & 0x3F)] = (char)i;
    }

    isDown[i] = true;
    doInterrupt = true;
  }