1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Merge pull request #2550 from sidneycadot/fix-bit-imm

Fixed behavior of the 65C02 "BIT #imm" instruction in sim65.
This commit is contained in:
Bob Andrews 2024-12-02 00:28:07 +01:00 committed by GitHub
commit c0a4942b5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -824,6 +824,12 @@ static unsigned HaveIRQRequest;
SET_OF (Val & 0x40); \ SET_OF (Val & 0x40); \
SET_ZF ((Val & Regs.AC) == 0) SET_ZF ((Val & Regs.AC) == 0)
/* BITIMM */
/* The BIT instruction with immediate mode addressing only sets
the zero flag; the sign and overflow flags are not changed. */
#define BITIMM(Val) \
SET_ZF ((Val & Regs.AC) == 0)
/* LDA */ /* LDA */
#define LDA(Val) \ #define LDA(Val) \
Regs.AC = Val; \ Regs.AC = Val; \
@ -2250,7 +2256,9 @@ static void OPC_6502_88 (void)
static void OPC_65SC02_89 (void) static void OPC_65SC02_89 (void)
/* Opcode $89: BIT #imm */ /* Opcode $89: BIT #imm */
{ {
ALU_OP_IMM (BIT); /* Note: BIT #imm behaves differently from BIT with other addressing modes,
* hence the different 'op' argument to the macro. */
ALU_OP_IMM (BITIMM);
} }