diff --git a/cmos.txt b/cmos.txt deleted file mode 100644 index a2d670e..0000000 --- a/cmos.txt +++ /dev/null @@ -1,1401 +0,0 @@ -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(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = shiftLeft(readVal = read(primaryAddress)))); -} -override void opcode0E() -{ -addrAbsolute(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = shiftLeft(readVal = read(primaryAddress)))); -} -override void opcode16() -{ -addrZeropageX(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = shiftLeft(readVal = read(primaryAddress)))); -} -override void opcode1E() -{ -addrAbsoluteX(false); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = shiftLeft(readVal = read(primaryAddress)))); -} - -override void opcode46() -{ -addrZeropage(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = shiftRight(readVal = read(primaryAddress)))); -} -override void opcode4E() -{ -addrAbsolute(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = shiftRight(readVal = read(primaryAddress)))); -} -override void opcode56() -{ -addrZeropageX(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = shiftRight(readVal = read(primaryAddress)))); -} -override void opcode5E() -{ -addrAbsoluteX(false); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = shiftRight(readVal = read(primaryAddress)))); -} - -override void opcode26() -{ -addrZeropage(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = rotateLeft(readVal = read(primaryAddress)))); -} -override void opcode2E() -{ -addrAbsolute(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = rotateLeft(readVal = read(primaryAddress)))); -} -override void opcode36() -{ -addrZeropageX(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = rotateLeft(readVal = read(primaryAddress)))); -} -override void opcode3E() -{ -addrAbsoluteX(false); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = rotateLeft(readVal = read(primaryAddress)))); -} - -override void opcode66() -{ -addrZeropage(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = rotateRight(readVal = read(primaryAddress)))); -} -override void opcode6E() -{ -addrAbsolute(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = rotateRight(readVal = read(primaryAddress)))); -} -override void opcode76() -{ -addrZeropageX(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = rotateRight(readVal = read(primaryAddress)))); -} -override void opcode7E() -{ -addrAbsoluteX(false); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = rotateRight(readVal = read(primaryAddress)))); -} - -override void opcodeE6() -{ -addrZeropage(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = increment(readVal = read(primaryAddress)))); -} -override void opcodeEE() -{ -addrAbsolute(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = increment(readVal = read(primaryAddress)))); -} -override void opcodeF6() -{ -addrZeropageX(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = increment(readVal = read(primaryAddress)))); -} - -override void opcodeC6() -{ -addrZeropage(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = decrement(readVal = read(primaryAddress)))); -} -override void opcodeCE() -{ -addrAbsolute(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = decrement(readVal = read(primaryAddress)))); -} -override void opcodeD6() -{ -addrZeropageX(); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = decrement(readVal = read(primaryAddress)))); -} - -override void opcodeFE() -{ -addrAbsoluteX(true); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = increment(readVal = read(primaryAddress)))); -} - -override void opcodeDE() -{ -addrAbsoluteX(true); -peek(primaryAddress); -writeFinal(primaryAddress, (flag.zero_ = flag.negative_ = decrement(readVal = read(primaryAddress)))); -} - -override void opcode34() -{ -addrZeropageX(); -bitTest(readVal = readFinal(primaryAddress)); -} -override void opcode3C() -{ -addrAbsoluteX(false); -bitTest(readVal = readFinal(primaryAddress)); -} - -override void opcode12() -{ -addrZeropageI(); -flag.zero_ = flag.negative_ = (accumulator |= (readVal = readFinal(primaryAddress))); -} - -override void opcode32() -{ -addrZeropageI(); -flag.zero_ = flag.negative_ = (accumulator &= (readVal = readFinal(primaryAddress))); -} - -override void opcode52() -{ -addrZeropageI(); -flag.zero_ = flag.negative_ = (accumulator ^= (readVal = readFinal(primaryAddress))); -} - -override void opcodeB2() -{ -addrZeropageI(); -flag.zero_ = flag.negative_ = (accumulator = (readVal = readFinal(primaryAddress))); -} - -override void opcodeD2() -{ -addrZeropageI(); -flag.zero_ = flag.negative_ = (compare(accumulator, (readVal = readFinal(primaryAddress)))); -} - -override void opcode72() -{ -addrZeropageI(); -if (flag.decimal) dec_addWithCarry(readVal = readFinal(primaryAddress)); -else hex_addWithCarry(readVal = readFinal(primaryAddress)); -} - -override void opcodeF2() -{ -addrZeropageI(); -if (flag.decimal) dec_subWithCarry(readVal = readFinal(primaryAddress)); -else hex_subWithCarry(readVal = readFinal(primaryAddress)); -} - -override void opcode92() -{ -addrZeropageI(); -writeFinal(primaryAddress, accumulator); -} - -override void opcode3A() -{ -peek(programCounter); -flag.zero_ = flag.negative_ = (accumulator -= 1); -} - -override void opcode1A() -{ -peek(programCounter); -flag.zero_ = flag.negative_ = (accumulator += 1); -} - -override void opcodeDA() -{ -peek(programCounter); -push(xIndex); -} - -override void opcode5A() -{ -peek(programCounter); -push(yIndex); -} - -override void opcodeFA() -{ -peek(programCounter); -flag.zero_ = flag.negative_ = (xIndex = pull()); -} - -override void opcode7A() -{ -peek(programCounter); -flag.zero_ = flag.negative_ = (yIndex = pull()); -} - -override void opcode80() -{ -readByteOperand(); -if (true) addrRelative(cast(byte)operand1); -} - -override void opcode14() -{ -addrZeropage(); -peek(primaryAddress); -writeFinal(primaryAddress, testReset(readVal = read(primaryAddress))); -} -override void opcode1C() -{ -addrAbsolute; -peek(primaryAddress); -writeFinal(primaryAddress, testReset(readVal = read(primaryAddress))); -} - -override void opcode04() -{ -addrZeropage(); -peek(primaryAddress); -writeFinal(primaryAddress, testSet(readVal = read(primaryAddress))); -} -override void opcode0C() -{ -addrAbsolute(); -peek(primaryAddress); -writeFinal(primaryAddress, testSet(readVal = read(primaryAddress))); -} - -override void opcode64() -{ -addrZeropage(); -writeFinal(primaryAddress, 0); -} -override void opcode74() -{ -addrZeropageX(); -writeFinal(primaryAddress, 0); -} -override void opcode9C() -{ -addrAbsolute(); -writeFinal(primaryAddress, 0); -} -override void opcode9E() -{ -addrAbsoluteX(true); -writeFinal(primaryAddress, 0); -} - -override void opcode02() -{ -primaryAddress = programCounter++; -readVal = readFinal(primaryAddress); -operand1 = readVal; -} -override void opcode22() -{ -primaryAddress = programCounter++; -readVal = readFinal(primaryAddress); -operand1 = readVal; -} -override void opcode42() -{ -primaryAddress = programCounter++; -readVal = readFinal(primaryAddress); -operand1 = readVal; -} -override void opcode62() -{ -primaryAddress = programCounter++; -readVal = readFinal(primaryAddress); -operand1 = readVal; -} -override void opcode82() -{ -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 opcode44() -{ -addrZeropage(); -readVal = readFinal(primaryAddress); -} - -override void opcode54() -{ -addrZeropageX(); -readVal = readFinal(primaryAddress); -} -override void opcodeD4() -{ -addrZeropageX(); -readVal = readFinal(primaryAddress); -} -override void opcodeF4() -{ -addrZeropageX(); -readVal = readFinal(primaryAddress); -} - -override void opcodeDC() -{ -addrAbsoluteX(false); -readVal = readFinal(primaryAddress); -} -override void opcodeFC() -{ -addrAbsoluteX(false); -readVal = readFinal(primaryAddress); -} - -override void opcode03() -{ -addrNone(); -} -override void opcode13() -{ -addrNone(); -} -override void opcode23() -{ -addrNone(); -} -override void opcode33() -{ -addrNone(); -} -override void opcode43() -{ -addrNone(); -} -override void opcode53() -{ -addrNone(); -} -override void opcode63() -{ -addrNone(); -} -override void opcode73() -{ -addrNone(); -} -override void opcode83() -{ -addrNone(); -} -override void opcode93() -{ -addrNone(); -} -override void opcodeA3() -{ -addrNone(); -} -override void opcodeB3() -{ -addrNone(); -} -override void opcodeC3() -{ -addrNone(); -} -override void opcodeD3() -{ -addrNone(); -} -override void opcodeE3() -{ -addrNone(); -} -override void opcodeF3() -{ -addrNone(); -} -override void opcode07() -{ -addrNone(); -} -override void opcode17() -{ -addrNone(); -} -override void opcode27() -{ -addrNone(); -} -override void opcode37() -{ -addrNone(); -} -override void opcode47() -{ -addrNone(); -} -override void opcode57() -{ -addrNone(); -} -override void opcode67() -{ -addrNone(); -} -override void opcode77() -{ -addrNone(); -} -override void opcode87() -{ -addrNone(); -} -override void opcode97() -{ -addrNone(); -} -override void opcodeA7() -{ -addrNone(); -} -override void opcodeB7() -{ -addrNone(); -} -override void opcodeC7() -{ -addrNone(); -} -override void opcodeD7() -{ -addrNone(); -} -override void opcodeE7() -{ -addrNone(); -} -override void opcodeF7() -{ -addrNone(); -} -override void opcode0B() -{ -addrNone(); -} -override void opcode1B() -{ -addrNone(); -} -override void opcode2B() -{ -addrNone(); -} -override void opcode3B() -{ -addrNone(); -} -override void opcode4B() -{ -addrNone(); -} -override void opcode5B() -{ -addrNone(); -} -override void opcode6B() -{ -addrNone(); -} -override void opcode7B() -{ -addrNone(); -} -override void opcode8B() -{ -addrNone(); -} -override void opcode9B() -{ -addrNone(); -} -override void opcodeAB() -{ -addrNone(); -} -override void opcodeBB() -{ -addrNone(); -} -override void opcodeCB() -{ -addrNone(); -} -override void opcodeDB() -{ -addrNone(); -} -override void opcodeEB() -{ -addrNone(); -} -override void opcodeFB() -{ -addrNone(); -} -override void opcode0F() -{ -addrNone(); -} -override void opcode1F() -{ -addrNone(); -} -override void opcode2F() -{ -addrNone(); -} -override void opcode3F() -{ -addrNone(); -} -override void opcode4F() -{ -addrNone(); -} -override void opcode5F() -{ -addrNone(); -} -override void opcode6F() -{ -addrNone(); -} -override void opcode7F() -{ -addrNone(); -} -override void opcode8F() -{ -addrNone(); -} -override void opcode9F() -{ -addrNone(); -} -override void opcodeAF() -{ -addrNone(); -} -override void opcodeBF() -{ -addrNone(); -} -override void opcodeCF() -{ -addrNone(); -} -override void opcodeDF() -{ -addrNone(); -} -override void opcodeEF() -{ -addrNone(); -} -override void opcodeFF() -{ -addrNone(); -} - - /* 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; - } - - /* NOP8 */ - void opcode5C() - { - readByteOperand(); - peek(programCounter++); - peek(0xFF00 | operand1); - peek(0xFFFF); - peek(0xFFFF); - peek(0xFFFF); - peek(0xFFFF); - static if (cumulative) tick(totalCycles); - } - - /* JMP ($$$$) */ - override void opcode6C() - { - ushort vector = readWordOperand(); - peek(programCounter); - programCounter = readWord(vector, cast(ushort)(vector + 1)); - static if (cumulative) tick(totalCycles); - } - - /* JMP ($$$$,X) */ - void opcode7C() - { - baseAddress = readWordOperand(); - peek(programCounter); - ushort vector = cast(ushort)(baseAddress + xIndex); - programCounter = readWord(vector, cast(ushort)(vector + 1)); - static if (cumulative) tick(totalCycles); - } - - /* BIT #$$ */ - void opcode89() - { - readVal = operand1 = readFinal(programCounter++); - flag.zero_ = accumulator & readVal; - } diff --git a/nmos.txt b/nmos.txt deleted file mode 100644 index d2fa3cc..0000000 --- a/nmos.txt +++ /dev/null @@ -1,1609 +0,0 @@ -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); - } diff --git a/test/benchopts b/test/benchopts deleted file mode 100644 index 30212ee..0000000 --- a/test/benchopts +++ /dev/null @@ -1,2 +0,0 @@ --version=Benchmark -inline -release -O -noboundscheck -I.. -I../src - diff --git a/test/base.d b/test/d6502/base.d similarity index 99% rename from test/base.d rename to test/d6502/base.d index fd2251f..19776a8 100644 --- a/test/base.d +++ b/test/d6502/base.d @@ -1,10 +1,10 @@ -module test.base; +module test.d6502.base; import std.algorithm, std.array, std.conv, std.exception, std.getopt, std.stdio, std.string; -import test.cpu, test.opcodes; +import test.d6502.cpu, test.d6502.opcodes; import cpu.data_d6502; @@ -3414,7 +3414,7 @@ struct CheckOptions op = op[2..$]; if (isNumeric(op)) { - int code = to!int(op, 16); + int code = parse!(int, string)(op, 16); if (code >= 0x00 && code <= 0xFF) { codes6502 ~= [cast(ubyte)code]; diff --git a/test/d6502/benchopts b/test/d6502/benchopts new file mode 100644 index 0000000..6af1ac0 --- /dev/null +++ b/test/d6502/benchopts @@ -0,0 +1,2 @@ +-version=Benchmark -inline -release -O -noboundscheck -I../.. -I../../src + diff --git a/test/cpu.d b/test/d6502/cpu.d similarity index 99% rename from test/cpu.d rename to test/d6502/cpu.d index 063f8cb..2aec369 100644 --- a/test/cpu.d +++ b/test/d6502/cpu.d @@ -3,14 +3,14 @@ * implementation, or that may be useful to any test which requires a * cpu (as opposed to testing the cpu itself). */ -module test.cpu; +module test.d6502.cpu; import std.conv, std.exception, std.random, std.string, std.traits; public import cpu.d6502 : Cpu, is6502, is65C02; -import test.base : strict, cumulative; +import test.d6502.base : strict, cumulative; // True if T is the type of a cpu. diff --git a/test/opcodes.d b/test/d6502/opcodes.d similarity index 99% rename from test/opcodes.d rename to test/d6502/opcodes.d index f07fcda..2beea06 100644 --- a/test/opcodes.d +++ b/test/d6502/opcodes.d @@ -1,7 +1,7 @@ -module test.opcodes; +module test.d6502.opcodes; -import test.cpu; +import test.d6502.cpu; // 2-cycle opcodes which neither read nor write. diff --git a/test/runtests.d b/test/d6502/runtests.d similarity index 96% rename from test/runtests.d rename to test/d6502/runtests.d index 32903a2..90ad4e7 100644 --- a/test/runtests.d +++ b/test/d6502/runtests.d @@ -134,7 +134,8 @@ void runTest(OpDefs def, Tests test, string[] args) writeln("With strict=", s, " cumulative=", c); string cmdline = defStrings[def] ~ stStrings[s] ~ cmStrings[c] ~ fNames[test] ~ join(args, " "); - system("rdmd --force -I.. -I../src -version=RunTest " ~ cmdline); + system("rdmd --force -I../.. -I../../src -version=RunTest " ~ + cmdline); } } } diff --git a/test/test_bus.d b/test/d6502/test_bus.d similarity index 91% rename from test/test_bus.d rename to test/d6502/test_bus.d index c6f673b..61497dc 100644 --- a/test/test_bus.d +++ b/test/d6502/test_bus.d @@ -1,6 +1,6 @@ import std.stdio; -import test.base, test.cpu; +import test.d6502.base, test.d6502.cpu; void main(string[] args) diff --git a/test/test_decimal.d b/test/d6502/test_decimal.d similarity index 99% rename from test/test_decimal.d rename to test/d6502/test_decimal.d index 3df6c33..e019ef7 100644 --- a/test/test_decimal.d +++ b/test/d6502/test_decimal.d @@ -1,6 +1,6 @@ import std.stdio; -import test.base, test.cpu; +import test.d6502.base, test.d6502.cpu; void testDecimalMode(T)() diff --git a/test/test_func.d b/test/d6502/test_func.d similarity index 91% rename from test/test_func.d rename to test/d6502/test_func.d index d16a715..63d3c82 100644 --- a/test/test_func.d +++ b/test/d6502/test_func.d @@ -1,6 +1,6 @@ import std.stdio; -import test.base, test.cpu; +import test.d6502.base, test.d6502.cpu; void main(string[] args) diff --git a/test/testopts b/test/testopts deleted file mode 100644 index 58f90ff..0000000 --- a/test/testopts +++ /dev/null @@ -1,2 +0,0 @@ --I.. -I../src -g -