fixed opcode table
This commit is contained in:
parent
92d92a80c6
commit
cb890b0960
|
@ -403,7 +403,7 @@ void execute(struct CPU* cpu)
|
||||||
cpu->x--;
|
cpu->x--;
|
||||||
|
|
||||||
cpu->status.negative = ((cpu->x & 0x80) == 0x80);
|
cpu->status.negative = ((cpu->x & 0x80) == 0x80);
|
||||||
cpu->status.zero = (cpu->x == 0x80);
|
cpu->status.zero = (cpu->x == 0x00);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case DEY:
|
case DEY:
|
||||||
|
|
|
@ -19,7 +19,7 @@ void logBusState(struct Bus* bus)
|
||||||
sprintf(buffer + 3 * i, "%02X ", instructionBytes[i]);
|
sprintf(buffer + 3 * i, "%02X ", instructionBytes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%-10s%s ", buffer, bus->cpu->currentOpcode->str);
|
printf("%-9s%c%s ", buffer, (bus->cpu->currentOpcode->illegal ? '*' : ' '), bus->cpu->currentOpcode->str);
|
||||||
|
|
||||||
switch (bus->cpu->currentOpcode->addr)
|
switch (bus->cpu->currentOpcode->addr)
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ void logBusState(struct Bus* bus)
|
||||||
case IND: sprintf(buffer, "($%04X) -> $%04X", (instructionBytes[2] << 8) | instructionBytes[1], bus->cpu->fetchedAddress); break;
|
case IND: sprintf(buffer, "($%04X) -> $%04X", (instructionBytes[2] << 8) | instructionBytes[1], bus->cpu->fetchedAddress); break;
|
||||||
case INDX: sprintf(buffer, "($%02X, X) -> $%04X", instructionBytes[1], bus->cpu->fetchedAddress); break;
|
case INDX: sprintf(buffer, "($%02X, X) -> $%04X", instructionBytes[1], bus->cpu->fetchedAddress); break;
|
||||||
case INDY: sprintf(buffer, "($%02X), Y -> $%04X", instructionBytes[1], bus->cpu->fetchedAddress); break;
|
case INDY: sprintf(buffer, "($%02X), Y -> $%04X", instructionBytes[1], bus->cpu->fetchedAddress); break;
|
||||||
case REL: sprintf(buffer, "$%02X", bus->cpu->fetchedRelAddress); break;
|
case REL: sprintf(buffer, "$%02X", (Byte)bus->cpu->fetchedRelAddress); break;
|
||||||
case ZPG: sprintf(buffer, "$%02X", bus->cpu->fetchedAddress); break;
|
case ZPG: sprintf(buffer, "$%02X", bus->cpu->fetchedAddress); break;
|
||||||
case ZPX: sprintf(buffer, "$%02X, X -> $%02X", instructionBytes[1], bus->cpu->fetchedAddress); break;
|
case ZPX: sprintf(buffer, "$%02X, X -> $%02X", instructionBytes[1], bus->cpu->fetchedAddress); break;
|
||||||
case ZPY: sprintf(buffer, "$%02X, Y -> $%02X", instructionBytes[1], bus->cpu->fetchedAddress); break;
|
case ZPY: sprintf(buffer, "$%02X, Y -> $%02X", instructionBytes[1], bus->cpu->fetchedAddress); break;
|
||||||
|
|
|
@ -269,9 +269,9 @@ const struct Opcode OPCODE_TABLE[256] =
|
||||||
/* F7 */ NEW_OPCODE(ISC, ZPX, 6, 2, 1),
|
/* F7 */ NEW_OPCODE(ISC, ZPX, 6, 2, 1),
|
||||||
/* F8 */ NEW_OPCODE(SED, IMP, 2, 1, 0),
|
/* F8 */ NEW_OPCODE(SED, IMP, 2, 1, 0),
|
||||||
/* F9 */ NEW_OPCODE(SBC, ABY, 4, 3, 0),
|
/* F9 */ NEW_OPCODE(SBC, ABY, 4, 3, 0),
|
||||||
/* FA */ NEW_OPCODE(SBC, ABY, 4, 3, 1),
|
/* FA */ NEW_OPCODE(NOP, IMP, 2, 1, 1),
|
||||||
/* FB */ NEW_OPCODE(NOP, IMP, 2, 1, 1),
|
|
||||||
/* FC */ NEW_OPCODE(ISC, ABY, 7, 3, 1),
|
/* FC */ NEW_OPCODE(ISC, ABY, 7, 3, 1),
|
||||||
|
/* FB */ NEW_OPCODE(NOP, ABX, 4, 3, 1),
|
||||||
/* FD */ NEW_OPCODE(SBC, ABX, 4, 3, 0),
|
/* FD */ NEW_OPCODE(SBC, ABX, 4, 3, 0),
|
||||||
/* FE */ NEW_OPCODE(INC, ABX, 7, 3, 0),
|
/* FE */ NEW_OPCODE(INC, ABX, 7, 3, 0),
|
||||||
/* FF */ NEW_OPCODE(ISC, ABX, 7, 3, 1)
|
/* FF */ NEW_OPCODE(ISC, ABX, 7, 3, 1)
|
||||||
|
|
Loading…
Reference in a new issue