   }
 }
 
-void memWrite(const uint8_t addrh, const uint8_t addrl, const uint8_t val) {
+static void memWrite() {
+  const uint8_t addrh = PINC;
+  const uint8_t addrl = PINA;
   const uint16_t addr = ADDR;
+  const uint8_t val = PINL;
   switch (addr >> 12) {
     default:
       // nothing in the address space ignore the write;

      return val;
    case 0xd:
      // fake 6821
      switch (addrl & 0xff) {
        case 0x10:
          val = 0x80 | (uint8_t)Serial.read();
          break;

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