     if (PINB & _BV(PB2)) {
       // read cycle
       DDRL = 0xff;
-      PORTL = memRead((addrh << 8) | addrl);
+      PORTL = memRead(addrh, addrl);
     } else {
       // write cycle
       DDRL = 0x00;
       PORTL = 0;
-      memWrite((addrh << 8) | addrl, PINL);
+      memWrite(ADDR, PINL);
     }
   }
 }

byte ram[0x1000];
byte pia[0x14];

void printAddr(uint16_t addr, uint8_t col, uint8_t row) {

  lcd.setCursor(col, row);
  lcd.print((addr >> 12) & 0x0f, HEX);
  lcd.print((addr >> 8) & 0x0f, HEX);

      if (LCD) printAddr(addr, 8, 0);
      if (LCD) printByte(val, 14, 0);
      return val;
  }
}

void memWrite(const uint16_t addr, const uint8_t val) {
  switch (addr >> 12) {
    default:
      // nothing in the address space ignore the write;
