       // fake 6821
       switch (addrl & 0xff) {
         case 0x10:
-          val = Serial.read() | 0x80;
+          val = 0x80 | (uint8_t)Serial.read();
           break;
         case 0x11:
-          if (Serial.available() > 0) {
+          if (Serial.available()) {
             val = 0x80;
           } else {
             val = 0x00;
           }
           break;
         default:
-          val = pia[addr & 0xff];
+          val = pia[addrl & 0xff];
       }
       if (LCD) printAddr(addr, 8, 0);
       if (LCD) printByte(val, 14, 0);

  lcd.write(hex[(addr >> 8) & 0x0f]);
  lcd.write(hex[(addr >> 4) & 0x0f]);
  lcd.write(hex[addr & 0x0f]);

}

void printByte(const uint8_t val, const uint8_t col, const uint8_t row) {


void loop() {
  while (true) {
    cli();
    cbi(PORTB, 0);
    __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"); // 4 * 62.5ns delay @ 16mhz
    __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");
    sbi(PORTB, 0);
    sei();
    if (PINB & _BV(PB2)) {
