Add TAX instruction

This commit is contained in:
g1n 2021-10-08 15:25:50 +03:00
parent ab23f2f98f
commit c21fdeb552
3 changed files with 10 additions and 2 deletions

View File

@ -26,6 +26,9 @@ typedef unsigned short word; // 16 bit
#define INS_LDY_ABS 0xAC // LDY Absolute
#define INS_LDY_ABSX 0xBC // LDY Absolute,X
#define INS_TAX 0xAA // TAX Implied
#define INS_TAY 0xA8 // TAY Implied
#define INS_JSR 0x20 // JSR
#define INS_RTS 0x60 // RTS

View File

@ -127,7 +127,12 @@ void execute() {
cpu.Z = (cpu.Y == 0);
cpu.N = (cpu.Y & 0b1000000) > 0;
break;
case INS_TAX:
cpu.X = cpu.A;
cpu.Z = (cpu.X == 0);
cpu.N = (cpu.X & 0b1000000) > 0;
cpu.PC++;
break;
case INS_JSR:
word jsr_addr = fetch_word();
write_word(cpu.PC - 1, cpu.SP);

View File

@ -1 +1 @@
VゥdゥB
Uェ