private final void opADCimp(int data) {
    int tmp = data + acc + (carry ? 1 : 0);
    zero = (tmp & 0xff) == 0; // not valid in decimal mode

    if (decimal) {
      tmp = (acc & 0xf) + (data & 0xf) + (carry ? 1 : 0);
      if (tmp > 0x9)
        tmp += 0x6;
      if (tmp <= 0x0f)
        tmp = (tmp & 0xf) + (acc & 0xf0) + (data & 0xf0);
      else
        tmp = (tmp & 0xf) + (acc & 0xf0) + (data & 0xf0) + 0x10;

      overflow = (((acc ^ data) & 0x80) == 0) &&
      (((acc ^ tmp) & 0x80) != 0);

      sign = (tmp & 0x80) > 0;

      if ((tmp & 0x1f0) > 0x90)
        tmp += 0x60;
      carry = tmp > 0x99;
    } else {
      overflow = (((acc ^ data) & 0x80) == 0) &&
      (((acc ^ tmp) & 0x80) != 0);
      carry = tmp > 0xff;
      sign = (tmp & 0x80) > 0;
    }
    acc = tmp & 0xff;
  }