Add DEX and DEY instructions
This commit is contained in:
parent
287bd31a90
commit
702c02383c
|
@ -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];
|
||||
};
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue