           }
           break;
         default:
-          val = pia[addrl & 0xff];
+          val = pia[addrl];
       }
       if (LCD) printAddr(addr, 8, 0);
       if (LCD) printByte(val, 14, 0);

    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)) {
      // read cycle
      DDRL = 0xff;
      PORTL = memRead(PINC, PINA);
    } else {
      // write cycle
      DDRL = 0x00;
      PORTL = 0;
      memWrite(PINC, PINA, PINL);
    }
  }
}

    case 0xd:
      if (LCD) printAddr(addr, 8, 1);
      if (LCD) printByte(val, 14, 1);
      switch (addrl) {
        default:
          pia[addr & 0xff] = val;
          break;
