Add TYA instruction

This commit is contained in:
g1n 2021-10-12 20:20:38 +03:00
parent 99be8b1568
commit f830fc4ea0
3 changed files with 10 additions and 1 deletions

View File

@ -31,6 +31,7 @@ typedef unsigned short word; // 16 bit
#define INS_TSX 0xBA // TSX Implied
#define INS_TXA 0x8A // TXA Implied
#define INS_TXS 0x9A // TXS Implied
#define INS_TYA 0x98 // TYA Implied
#define INS_JSR 0x20 // JSR
#define INS_RTS 0x60 // RTS

View File

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

View File

@ -1 +1 @@
<EFBFBD>B<EFBFBD>
<EFBFBD>S<EFBFBD>