mirror of
https://github.com/edmccard/twoapple-reboot.git
synced 2024-09-28 10:55:18 +00:00
1402 lines
28 KiB
Plaintext
1402 lines
28 KiB
Plaintext
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;
|
|
}
|