From d588033a56e6a351efc195b141600f40ec78eb51 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Wed, 2 Jun 2021 15:56:32 +0200 Subject: [PATCH] Fix BIT instruction description. Flag handling for the BIT instruction did not follow the datasheet. This fixes #2558. --- Ghidra/Processors/6502/data/languages/6502.slaspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Ghidra/Processors/6502/data/languages/6502.slaspec b/Ghidra/Processors/6502/data/languages/6502.slaspec index 7775ef3f0d..ba7a70ddc7 100644 --- a/Ghidra/Processors/6502/data/languages/6502.slaspec +++ b/Ghidra/Processors/6502/data/languages/6502.slaspec @@ -168,8 +168,10 @@ ADDRI: imm16 is imm16 { tmp:2 = imm16; export *:2 tmp; } :BIT OP2 is (op=0x24 | op=0x2C) ... & OP2 { + N = (OP2 & 0x80) == 0x80; + V = (OP2 & 0x40) == 0x40; local value = A & OP2; - resultFlags(value); + Z = (value == 0); } :BMI REL is op=0x30; REL