override void opcode18() { peek(programCounter); flag.carry = false; } override void opcode38() { peek(programCounter); flag.carry = true; } override void opcode58() { peek(programCounter); flag.interrupt = false; } override void opcode78() { peek(programCounter); flag.interrupt = true; } override void opcodeB8() { peek(programCounter); flag.overflow = false; } override void opcodeD8() { peek(programCounter); flag.decimal = false; } override void opcodeF8() { peek(programCounter); flag.decimal = true; } override void opcodeEA() { peek(programCounter); } override void opcode08() { peek(programCounter); push(flag.toByte()); } override void opcode28() { peek(programCounter); flag.fromByte(pull()); } override void opcode48() { peek(programCounter); push(accumulator); } override void opcode9A() { peek(programCounter); stackPointer = xIndex; } override void opcode68() { peek(programCounter); flag.zero_ = flag.negative_ = (accumulator = pull()); } override void opcodeBA() { peek(programCounter); flag.zero_ = flag.negative_ = (xIndex = stackPointer); } override void opcodeAA() { peek(programCounter); flag.zero_ = flag.negative_ = (xIndex = accumulator); } override void opcode8A() { peek(programCounter); flag.zero_ = flag.negative_ = (accumulator = xIndex); } override void opcodeCA() { peek(programCounter); flag.zero_ = flag.negative_ = (xIndex -= 1); } override void opcodeE8() { peek(programCounter); flag.zero_ = flag.negative_ = (xIndex += 1); } override void opcodeA8() { peek(programCounter); flag.zero_ = flag.negative_ = (yIndex = accumulator); } override void opcode98() { peek(programCounter); flag.zero_ = flag.negative_ = (accumulator = yIndex); } override void opcode88() { peek(programCounter); flag.zero_ = flag.negative_ = (yIndex -= 1); } override void opcodeC8() { peek(programCounter); flag.zero_ = flag.negative_ = (yIndex += 1); } override void opcode10() { readByteOperand(); if (flag.negative_ < 0x80) addrRelative(cast(byte)operand1); } override void opcode30() { readByteOperand(); if (flag.negative_ > 0x7F) addrRelative(cast(byte)operand1); } override void opcode50() { readByteOperand(); if (!flag.overflow) addrRelative(cast(byte)operand1); } override void opcode70() { readByteOperand(); if (flag.overflow) addrRelative(cast(byte)operand1); } override void opcode90() { readByteOperand(); if (!flag.carry) addrRelative(cast(byte)operand1); } override void opcodeB0() { readByteOperand(); if (flag.carry) addrRelative(cast(byte)operand1); } override void opcodeD0() { readByteOperand(); if (flag.zero_ != 0) addrRelative(cast(byte)operand1); } override void opcodeF0() { readByteOperand(); if (flag.zero_ == 0) addrRelative(cast(byte)operand1); } override void opcode0A() { peek(programCounter); flag.zero_ = flag.negative_ = (accumulator = shiftLeft(accumulator)); } override void opcode2A() { peek(programCounter); flag.zero_ = flag.negative_ = (accumulator = rotateLeft(accumulator)); } override void opcode4A() { peek(programCounter); flag.zero_ = flag.negative_ = (accumulator = shiftRight(accumulator)); } override void opcode6A() { peek(programCounter); flag.zero_ = flag.negative_ = (accumulator = rotateRight(accumulator)); } override void opcodeA1() { addrIndirectX(); flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); } override void opcodeA5() { addrZeropage(); flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); } override void opcodeA9() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); operand1 = readVal; } override void opcodeAD() { addrAbsolute(); flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); } override void opcodeB1() { addrIndirectY(false); flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); } override void opcodeB5() { addrZeropageX(); flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); } override void opcodeB9() { addrAbsoluteY(false); flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); } override void opcodeBD() { addrAbsoluteX(false); flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); } override void opcode01() { addrIndirectX(); flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); } override void opcode05() { addrZeropage(); flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); } override void opcode09() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); operand1 = readVal; } override void opcode0D() { addrAbsolute(); flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); } override void opcode11() { addrIndirectY(false); flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); } override void opcode15() { addrZeropageX(); flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); } override void opcode19() { addrAbsoluteY(false); flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); } override void opcode1D() { addrAbsoluteX(false); flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); } override void opcode21() { addrIndirectX(); flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); } override void opcode25() { addrZeropage(); flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); } override void opcode29() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); operand1 = readVal; } override void opcode2D() { addrAbsolute(); flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); } override void opcode31() { addrIndirectY(false); flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); } override void opcode35() { addrZeropageX(); flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); } override void opcode39() { addrAbsoluteY(false); flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); } override void opcode3D() { addrAbsoluteX(false); flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); } override void opcode41() { addrIndirectX(); flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); } override void opcode45() { addrZeropage(); flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); } override void opcode49() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); operand1 = readVal; } override void opcode4D() { addrAbsolute(); flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); } override void opcode51() { addrIndirectY(false); flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); } override void opcode55() { addrZeropageX(); flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); } override void opcode59() { addrAbsoluteY(false); flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); } override void opcode5D() { addrAbsoluteX(false); flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); } override void opcode61() { addrIndirectX(); if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); else hex_addWithCarry(readVal = readFinal(primaryAddress)); } override void opcode65() { addrZeropage(); if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); else hex_addWithCarry(readVal = readFinal(primaryAddress)); } override void opcode69() { primaryAddress = programCounter++; if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); else hex_addWithCarry(readVal = readFinal(primaryAddress)); operand1 = readVal; } override void opcode6D() { addrAbsolute(); if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); else hex_addWithCarry(readVal = readFinal(primaryAddress)); } override void opcode71() { addrIndirectY(false); if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); else hex_addWithCarry(readVal = readFinal(primaryAddress)); } override void opcode75() { addrZeropageX(); if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); else hex_addWithCarry(readVal = readFinal(primaryAddress)); } override void opcode79() { addrAbsoluteY(false); if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); else hex_addWithCarry(readVal = readFinal(primaryAddress)); } override void opcode7D() { addrAbsoluteX(false); if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); else hex_addWithCarry(readVal = readFinal(primaryAddress)); } override void opcodeE1() { addrIndirectX(); if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); else hex_subWithCarry(readVal = readFinal(primaryAddress)); } override void opcodeE5() { addrZeropage(); if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); else hex_subWithCarry(readVal = readFinal(primaryAddress)); } override void opcodeE9() { primaryAddress = programCounter++; if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); else hex_subWithCarry(readVal = readFinal(primaryAddress)); operand1 = readVal; } override void opcodeED() { addrAbsolute(); if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); else hex_subWithCarry(readVal = readFinal(primaryAddress)); } override void opcodeF1() { addrIndirectY(false); if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); else hex_subWithCarry(readVal = readFinal(primaryAddress)); } override void opcodeF5() { addrZeropageX(); if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); else hex_subWithCarry(readVal = readFinal(primaryAddress)); } override void opcodeF9() { addrAbsoluteY(false); if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); else hex_subWithCarry(readVal = readFinal(primaryAddress)); } override void opcodeFD() { addrAbsoluteX(false); if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); else hex_subWithCarry(readVal = readFinal(primaryAddress)); } override void opcodeC1() { addrIndirectX(); flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); } override void opcodeC5() { addrZeropage(); flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); } override void opcodeC9() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); operand1 = readVal; } override void opcodeCD() { addrAbsolute(); flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); } override void opcodeD1() { addrIndirectY(false); flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); } override void opcodeD5() { addrZeropageX(); flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); } override void opcodeD9() { addrAbsoluteY(false); flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); } override void opcodeDD() { addrAbsoluteX(false); flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); } override void opcode81() { addrIndirectX(); writeFinal(primaryAddress, accumulator); } override void opcode85() { addrZeropage(); writeFinal(primaryAddress, accumulator); } override void opcode8D() { addrAbsolute(); writeFinal(primaryAddress, accumulator); } override void opcode91() { addrIndirectY(true); writeFinal(primaryAddress, accumulator); } override void opcode95() { addrZeropageX(); writeFinal(primaryAddress, accumulator); } override void opcode99() { addrAbsoluteY(true); writeFinal(primaryAddress, accumulator); } override void opcode9D() { addrAbsoluteX(true); writeFinal(primaryAddress, accumulator); } override void opcodeA2() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (xIndex = (readVal = readFinal(primaryAddress))); operand1 = readVal; } override void opcodeA6() { addrZeropage(); flag.zero_ = flag.negative_ = (xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeAE() { addrAbsolute(); flag.zero_ = flag.negative_ = (xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeB6() { addrZeropageY(); flag.zero_ = flag.negative_ = (xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeBE() { addrAbsoluteY(false); flag.zero_ = flag.negative_ = (xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeA0() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (yIndex = (readVal = readFinal(primaryAddress))); operand1 = readVal; } override void opcodeA4() { addrZeropage(); flag.zero_ = flag.negative_ = (yIndex = (readVal = readFinal(primaryAddress))); } override void opcodeAC() { addrAbsolute(); flag.zero_ = flag.negative_ = (yIndex = (readVal = readFinal(primaryAddress))); } override void opcodeB4() { addrZeropageX(); flag.zero_ = flag.negative_ = (yIndex = (readVal = readFinal(primaryAddress))); } override void opcodeBC() { addrAbsoluteX(false); flag.zero_ = flag.negative_ = (yIndex = (readVal = readFinal(primaryAddress))); } override void opcodeE0() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (compare(xIndex, (readVal = readFinal(primaryAddress)))); operand1 = readVal; } override void opcodeE4() { addrZeropage(); flag.zero_ = flag.negative_ = (compare(xIndex, (readVal = readFinal(primaryAddress)))); } override void opcodeEC() { addrAbsolute(); flag.zero_ = flag.negative_ = (compare(xIndex, (readVal = readFinal(primaryAddress)))); } override void opcodeC0() { primaryAddress = programCounter++; flag.zero_ = flag.negative_ = (compare(yIndex, (readVal = readFinal(primaryAddress)))); operand1 = readVal; } override void opcodeC4() { addrZeropage(); flag.zero_ = flag.negative_ = (compare(yIndex, (readVal = readFinal(primaryAddress)))); } override void opcodeCC() { addrAbsolute(); flag.zero_ = flag.negative_ = (compare(yIndex, (readVal = readFinal(primaryAddress)))); } override void opcode86() { addrZeropage(); writeFinal(primaryAddress, xIndex); } override void opcode8E() { addrAbsolute(); writeFinal(primaryAddress, xIndex); } override void opcode96() { addrZeropageY(); writeFinal(primaryAddress, xIndex); } override void opcode84() { addrZeropage(); writeFinal(primaryAddress, yIndex); } override void opcode8C() { addrAbsolute(); writeFinal(primaryAddress, yIndex); } override void opcode94() { addrZeropageX(); writeFinal(primaryAddress, yIndex); } override void opcode24() { addrZeropage(); bitTest(readVal = readFinal(primaryAddress)); } override void opcode2C() { addrAbsolute(); bitTest(readVal = readFinal(primaryAddress)); } override void opcode06() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = shiftLeft(readVal)); } override void opcode0E() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = shiftLeft(readVal)); } override void opcode16() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = shiftLeft(readVal)); } override void opcode1E() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = shiftLeft(readVal)); } override void opcode46() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = shiftRight(readVal)); } override void opcode4E() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = shiftRight(readVal)); } override void opcode56() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = shiftRight(readVal)); } override void opcode5E() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = shiftRight(readVal)); } override void opcode26() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = rotateLeft(readVal)); } override void opcode2E() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = rotateLeft(readVal)); } override void opcode36() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = rotateLeft(readVal)); } override void opcode3E() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = rotateLeft(readVal)); } override void opcode66() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = rotateRight(readVal)); } override void opcode6E() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = rotateRight(readVal)); } override void opcode76() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = rotateRight(readVal)); } override void opcode7E() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = rotateRight(readVal)); } override void opcodeE6() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = increment(readVal)); } override void opcodeEE() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = increment(readVal)); } override void opcodeF6() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = increment(readVal)); } override void opcodeFE() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = increment(readVal)); } override void opcodeC6() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = decrement(readVal)); } override void opcodeCE() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = decrement(readVal)); } override void opcodeD6() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = decrement(readVal)); } override void opcodeDE() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = decrement(readVal)); } override void opcode02() { addrHalt(); } override void opcode12() { addrHalt(); } override void opcode22() { addrHalt(); } override void opcode32() { addrHalt(); } override void opcode42() { addrHalt(); } override void opcode52() { addrHalt(); } override void opcode62() { addrHalt(); } override void opcode72() { addrHalt(); } override void opcode92() { addrHalt(); } override void opcodeB2() { addrHalt(); } override void opcodeD2() { addrHalt(); } override void opcodeF2() { addrHalt(); } override void opcode1A() { addrImplied(); } override void opcode3A() { addrImplied(); } override void opcode5A() { addrImplied(); } override void opcode7A() { addrImplied(); } override void opcodeDA() { addrImplied(); } override void opcodeFA() { addrImplied(); } override void opcode0C() { addrAbsolute(); readVal = readFinal(primaryAddress); } override void opcode1C() { addrAbsoluteX(false); readVal = readFinal(primaryAddress); } override void opcode3C() { addrAbsoluteX(false); readVal = readFinal(primaryAddress); } override void opcode5C() { addrAbsoluteX(false); readVal = readFinal(primaryAddress); } override void opcode7C() { addrAbsoluteX(false); readVal = readFinal(primaryAddress); } override void opcodeDC() { addrAbsoluteX(false); readVal = readFinal(primaryAddress); } override void opcodeFC() { addrAbsoluteX(false); readVal = readFinal(primaryAddress); } override void opcode80() { primaryAddress = programCounter++; readVal = readFinal(primaryAddress); operand1 = readVal; } override void opcode82() { primaryAddress = programCounter++; readVal = readFinal(primaryAddress); operand1 = readVal; } override void opcode89() { primaryAddress = programCounter++; readVal = readFinal(primaryAddress); operand1 = readVal; } override void opcodeC2() { primaryAddress = programCounter++; readVal = readFinal(primaryAddress); operand1 = readVal; } override void opcodeE2() { primaryAddress = programCounter++; readVal = readFinal(primaryAddress); operand1 = readVal; } override void opcode04() { addrZeropage(); readVal = readFinal(primaryAddress); } override void opcode44() { addrZeropage(); readVal = readFinal(primaryAddress); } override void opcode64() { addrZeropage(); readVal = readFinal(primaryAddress); } override void opcode14() { addrZeropageX(); readVal = readFinal(primaryAddress); } override void opcode34() { addrZeropageX(); readVal = readFinal(primaryAddress); } override void opcode54() { addrZeropageX(); readVal = readFinal(primaryAddress); } override void opcode74() { addrZeropageX(); readVal = readFinal(primaryAddress); } override void opcodeD4() { addrZeropageX(); readVal = readFinal(primaryAddress); } override void opcodeF4() { addrZeropageX(); readVal = readFinal(primaryAddress); } override void opcodeA3() { addrIndirectX(); flag.zero_ = flag.negative_ = (accumulator = xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeA7() { addrZeropage(); flag.zero_ = flag.negative_ = (accumulator = xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeAF() { addrAbsolute(); flag.zero_ = flag.negative_ = (accumulator = xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeB3() { addrIndirectY(false); flag.zero_ = flag.negative_ = (accumulator = xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeB7() { addrZeropageY(); flag.zero_ = flag.negative_ = (accumulator = xIndex = (readVal = readFinal(primaryAddress))); } override void opcodeBF() { addrAbsoluteY(false); flag.zero_ = flag.negative_ = (accumulator = xIndex = (readVal = readFinal(primaryAddress))); } override void opcode83() { addrIndirectX(); writeFinal(primaryAddress, accumulator & xIndex); } override void opcode87() { addrZeropage(); writeFinal(primaryAddress, accumulator & xIndex); } override void opcode97() { addrZeropageY(); writeFinal(primaryAddress, accumulator & xIndex); } override void opcode8F() { addrAbsolute(); writeFinal(primaryAddress, accumulator & xIndex); } override void opcode03() { addrIndirectX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftLeft(readVal))); accumulator |= writeVal; } override void opcode07() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftLeft(readVal))); accumulator |= writeVal; } override void opcode0F() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftLeft(readVal))); accumulator |= writeVal; } override void opcode13() { addrIndirectY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftLeft(readVal))); accumulator |= writeVal; } override void opcode17() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftLeft(readVal))); accumulator |= writeVal; } override void opcode1B() { addrAbsoluteY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftLeft(readVal))); accumulator |= writeVal; } override void opcode1F() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftLeft(readVal))); accumulator |= writeVal; } override void opcode23() { addrIndirectX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateLeft(readVal))); accumulator &= writeVal; } override void opcode27() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateLeft(readVal))); accumulator &= writeVal; } override void opcode2F() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateLeft(readVal))); accumulator &= writeVal; } override void opcode33() { addrIndirectY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateLeft(readVal))); accumulator &= writeVal; } override void opcode37() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateLeft(readVal))); accumulator &= writeVal; } override void opcode3B() { addrAbsoluteY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateLeft(readVal))); accumulator &= writeVal; } override void opcode3F() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateLeft(readVal))); accumulator &= writeVal; } override void opcode43() { addrIndirectX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftRight(readVal))); accumulator ^= writeVal; } override void opcode47() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftRight(readVal))); accumulator ^= writeVal; } override void opcode4F() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftRight(readVal))); accumulator ^= writeVal; } override void opcode53() { addrIndirectY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftRight(readVal))); accumulator ^= writeVal; } override void opcode57() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftRight(readVal))); accumulator ^= writeVal; } override void opcode5B() { addrAbsoluteY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftRight(readVal))); accumulator ^= writeVal; } override void opcode5F() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = shiftRight(readVal))); accumulator ^= writeVal; } override void opcodeC3() { addrIndirectX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, (writeVal = decrement(readVal))); flag.zero_ = flag.negative_ = compare(accumulator, writeVal); } override void opcodeC7() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, (writeVal = decrement(readVal))); flag.zero_ = flag.negative_ = compare(accumulator, writeVal); } override void opcodeCF() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, (writeVal = decrement(readVal))); flag.zero_ = flag.negative_ = compare(accumulator, writeVal); } override void opcodeD3() { addrIndirectY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, (writeVal = decrement(readVal))); flag.zero_ = flag.negative_ = compare(accumulator, writeVal); } override void opcodeD7() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, (writeVal = decrement(readVal))); flag.zero_ = flag.negative_ = compare(accumulator, writeVal); } override void opcodeDB() { addrAbsoluteY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, (writeVal = decrement(readVal))); flag.zero_ = flag.negative_ = compare(accumulator, writeVal); } override void opcodeDF() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, (writeVal = decrement(readVal))); flag.zero_ = flag.negative_ = compare(accumulator, writeVal); } override void opcode63() { addrIndirectX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateRight(readVal))); if (flag.decimal) dec_addWithCarry(writeVal); else hex_addWithCarry(writeVal); } override void opcode67() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateRight(readVal))); if (flag.decimal) dec_addWithCarry(writeVal); else hex_addWithCarry(writeVal); } override void opcode6F() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateRight(readVal))); if (flag.decimal) dec_addWithCarry(writeVal); else hex_addWithCarry(writeVal); } override void opcode73() { addrIndirectY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateRight(readVal))); if (flag.decimal) dec_addWithCarry(writeVal); else hex_addWithCarry(writeVal); } override void opcode77() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateRight(readVal))); if (flag.decimal) dec_addWithCarry(writeVal); else hex_addWithCarry(writeVal); } override void opcode7B() { addrAbsoluteY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateRight(readVal))); if (flag.decimal) dec_addWithCarry(writeVal); else hex_addWithCarry(writeVal); } override void opcode7F() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = rotateRight(readVal))); if (flag.decimal) dec_addWithCarry(writeVal); else hex_addWithCarry(writeVal); } override void opcodeE3() { addrIndirectX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = increment(readVal))); if (flag.decimal) dec_subWithCarry(writeVal); else hex_subWithCarry(writeVal); } override void opcodeE7() { addrZeropage(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = increment(readVal))); if (flag.decimal) dec_subWithCarry(writeVal); else hex_subWithCarry(writeVal); } override void opcodeEF() { addrAbsolute(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = increment(readVal))); if (flag.decimal) dec_subWithCarry(writeVal); else hex_subWithCarry(writeVal); } override void opcodeF3() { addrIndirectY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = increment(readVal))); if (flag.decimal) dec_subWithCarry(writeVal); else hex_subWithCarry(writeVal); } override void opcodeF7() { addrZeropageX(); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = increment(readVal))); if (flag.decimal) dec_subWithCarry(writeVal); else hex_subWithCarry(writeVal); } override void opcodeFB() { addrAbsoluteY(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = increment(readVal))); if (flag.decimal) dec_subWithCarry(writeVal); else hex_subWithCarry(writeVal); } override void opcodeFF() { addrAbsoluteX(true); poke(primaryAddress, (readVal = read(primaryAddress))); writeFinal(primaryAddress, flag.zero_ = flag.negative_ = (writeVal = increment(readVal))); if (flag.decimal) dec_subWithCarry(writeVal); else hex_subWithCarry(writeVal); } /* BRK */ final override void opcode00() { peek(programCounter); ++programCounter; doInterrupt(IRQ_VECTOR, flag.toByte()); } /* JSR */ final override void opcode20() { ushort finalAddress = (operand1 = read(programCounter++)); peek(STACK_BASE + stackPointer); pushWord(programCounter); finalAddress |= ((operand2 = read(programCounter)) << 8); static if (cumulative) tick(totalCycles); programCounter = finalAddress; } /* RTI */ final override void opcode40() { peek(programCounter); flag.fromByte(pull()); programCounter = readStack() | (readStack() << 8); static if (cumulative) tick(totalCycles); } /* JMP $$$$ */ final override void opcode4C() { programCounter = readWordOperand(); static if (cumulative) tick(totalCycles); } /* RTS */ final override void opcode60() { peek(programCounter); programCounter = pullWord(); peek(programCounter); static if (cumulative) tick(totalCycles); ++programCounter; } /* JMP ($$$$) */ override void opcode6C() { ushort vector = readWordOperand(); programCounter = readWord(vector, (vector & 0xFF00) | cast(ubyte)(vector + 1)); static if (cumulative) tick(totalCycles); } /* ANC #$$ */ override void opcode0B() { readVal = operand1 = readFinal(programCounter); flag.zero_ = flag.negative_ = (accumulator = readVal); flag.carry = (flag.negative_ > 0x7F); } /* ANC #$$ */ override void opcode2B() { readVal = operand1 = readFinal(programCounter); flag.zero_ = flag.negative_ = (accumulator = readVal); flag.carry = (flag.negative_ > 0x7F); } /* ALR #$$ */ override void opcode4B() { readVal = operand1 = readFinal(programCounter); flag.zero_ = flag.negative_ = (accumulator = shiftRight(accumulator & readVal)); } /* ARR #$$ */ override void opcode6B() { readVal = operand1 = readFinal(programCounter); ubyte val = readVal & accumulator; if (flag.decimal) { ubyte temp = cast(ubyte)((val >> 1) + (flag.carry ? 0x80 : 0)); flag.zero_ = flag.negative_ = temp; flag.overflow = (((temp ^ val) & 0x40) != 0); if ((readVal & 0x0F) + (val & 0x01) > 5) temp = (temp & 0xF0) + ((temp + 0x6) & 0x0F); if (val + (val & 0x10) >= 0x60) { temp += 0x60; flag.carry = true; } else flag.carry = false; accumulator = temp; } else { accumulator = cast(ubyte)((val >> 1) + (flag.carry ? 0x80 : 0)); flag.zero_ = flag.negative_ = accumulator; val >>= 7; flag.carry = (val != 0); flag.overflow = ((val ^ ((accumulator >> 5) & 1)) != 0); } } /* ANE #$$ */ override void opcode8B() { // unstable readVal = operand1 = readFinal(programCounter++); version(Atari8Bit) { flag.zero_ = flag.negative_ = (accumulator & xIndex & readVal); accumulator &= xIndex & (operand1 | 0xEF); } else { flag.zero_ = flag.negative_ = (accumulator &= (xIndex & readVal)); } } /* SHA ($$),Y */ void opcode93() { addrIndirectY(true); strange(accumulator & xIndex); } /* SHA $$$$,Y */ void opcode9F() { addrAbsoluteY(true); strange(accumulator & xIndex); } /* SHS $$$$,Y */ void opcode9B() { addrAbsoluteY(true); strange(stackPointer = (accumulator & xIndex)); } /* SHY $$$$,X */ void opcode9C() { addrAbsoluteX(true); strange(yIndex); } /* SHX $$$$,Y */ void opcode9E() { addrAbsoluteY(true); strange(xIndex); } /* LAX #$$ */ override void opcodeAB() { readVal = operand1 = readFinal(programCounter); version(Commodore128) { // not unstable? flag.zero_ = flag.negative_ = (accumulator = readVal); } else { // unstable version(Commodore64) { accumulator |= 0xEE; } flag.zero_ = flag.negative_ = (accumulator &= readVal); } xIndex = accumulator; } /* LAS $$$$,Y */ override void opcodeBB() { addrAbsoluteY(false); readVal = readFinal(primaryAddress); flag.zero_ = flag.negative_ = (xIndex = accumulator = (stackPointer & readVal)); } /* SBX #$$ */ override void opcodeCB() { readVal = operand1 = readFinal(programCounter++); xIndex &= accumulator; flag.zero_ = flag.negative_ = compare(xIndex, readVal); } /* SBC #$$ */ override void opcodeEB() { readVal = operand1 = readFinal(programCounter++); if (flag.decimal) dec_subWithCarry(readVal); else hex_subWithCarry(readVal); }