From 2596ac2c6588524b6b1af03dbe1a6615f8a07001 Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Sat, 23 Oct 2021 16:00:40 +0200 Subject: [PATCH] added LAX --- NES Emulator/cpu.c | 9 +++++++++ NES Emulator/opcodes.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NES Emulator/cpu.c b/NES Emulator/cpu.c index 914f6a9..8119ac6 100644 --- a/NES Emulator/cpu.c +++ b/NES Emulator/cpu.c @@ -462,6 +462,15 @@ void execute(struct CPU* cpu) cpu->pc.word = cpu->fetchedAddress; } break; + case LAX: + { + cpu->acc = cpu->fetchedVal; + cpu->x = cpu->fetchedVal; + + cpu->status.negative = ((cpu->acc & 0x80) == 0x80); + cpu->status.zero = (cpu->acc == 0x00); + } break; + case LDA: { cpu->acc = cpu->fetchedVal; diff --git a/NES Emulator/opcodes.c b/NES Emulator/opcodes.c index 1d632ee..8e5a873 100644 --- a/NES Emulator/opcodes.c +++ b/NES Emulator/opcodes.c @@ -177,7 +177,7 @@ const struct Opcode OPCODE_TABLE[256] = /* A0 */ NEW_OPCODE(LDY, IMM, 2, 2, 0), /* A1 */ NEW_OPCODE(LDA, INDX, 6, 2, 0), /* A2 */ NEW_OPCODE(LDX, IMM, 2, 2, 0), - /* A3 */ NEW_OPCODE(LAX, INDX, 0, 1, 1), + /* A3 */ NEW_OPCODE(LAX, INDX, 6, 2, 1), /* A4 */ NEW_OPCODE(LDY, ZPG, 3, 2, 0), /* A5 */ NEW_OPCODE(LDA, ZPG, 3, 2, 0), /* A6 */ NEW_OPCODE(LDX, ZPG, 3, 2, 0),