diff --git a/src/6502/6502.h b/src/6502/6502.h index 8cc8c14..e1cfcae 100644 --- a/src/6502/6502.h +++ b/src/6502/6502.h @@ -41,6 +41,9 @@ typedef unsigned short word; // 16 bit #define INS_INX 0xE8 // INX Implied #define INS_INY 0xC8 // INY Implied +#define INS_DEX 0xCA // DEX Implied +#define INS_DEY 0x88 // DEY Implied + struct MEMORY { byte memory[MAX_MEMORY]; }; diff --git a/src/6502/main.c b/src/6502/main.c index 5a7e851..8936ac0 100644 --- a/src/6502/main.c +++ b/src/6502/main.c @@ -175,6 +175,7 @@ void execute() { break; case INS_NOP: break; + case INS_INX: cpu.X++; cpu.Z = (cpu.X == 0); @@ -185,6 +186,17 @@ void execute() { cpu.Z = (cpu.Y == 0); cpu.N = (cpu.Y & 0b1000000) > 0; break; + + case INS_DEX: + cpu.X--; + cpu.Z = (cpu.X == 0); + cpu.N = (cpu.X & 0b1000000) > 0; + break; + case INS_DEY: + cpu.Y--; + cpu.Z = (cpu.Y == 0); + cpu.N = (cpu.Y & 0b1000000) > 0; + break; case 0x00: // EOF return; default: