Add INX and INY instructions

This commit is contained in:
g1n 2021-10-13 17:29:24 +03:00
parent f830fc4ea0
commit 8607e93b3e
3 changed files with 14 additions and 2 deletions

View File

@ -38,6 +38,9 @@ typedef unsigned short word; // 16 bit
#define INS_NOP 0xEA // NOP
#define INS_INX 0xE8 // INX Implied
#define INS_INY 0xC8 // INY Implied
struct MEMORY {
byte memory[MAX_MEMORY];
};

View File

@ -162,8 +162,7 @@ void execute() {
cpu.Z = (cpu.A == 0);
cpu.N = (cpu.A & 0b1000000) > 0;
cpu.PC++;
break;
break;
case INS_JSR:
word jsr_addr = fetch_word();
@ -176,6 +175,16 @@ void execute() {
break;
case INS_NOP:
break;
case INS_INX:
cpu.X++;
cpu.Z = (cpu.X == 0);
cpu.N = (cpu.X & 0b1000000) > 0;
break;
case INS_INY:
cpu.Y++;
cpu.Z = (cpu.Y == 0);
cpu.N = (cpu.Y & 0b1000000) > 0;
break;
case 0x00: // EOF
return;
default:

Binary file not shown.