1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-26 08:32:00 +00:00

Merge pull request #2557 from sidneycadot/fix-sim65-rol-ror-ops

sim65 : improve implementation of ROL and ROR operations
This commit is contained in:
Bob Andrews 2024-12-15 22:59:39 +01:00 committed by GitHub
commit 11699a4124
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -737,23 +737,29 @@ static unsigned HaveIRQRequest;
/* ROL */ /* ROL */
#define ROL(Val) \ #define ROL(Val) \
Val <<= 1; \ do { \
if (GET_CF ()) { \ unsigned ShiftOut = (Val & 0x80); \
Val |= 0x01; \ Val <<= 1; \
} \ if (GET_CF ()) { \
TEST_ZF (Val); \ Val |= 0x01; \
TEST_SF (Val); \ } \
TEST_CF (Val) TEST_ZF (Val); \
TEST_SF (Val); \
SET_CF (ShiftOut); \
} while (0)
/* ROR */ /* ROR */
#define ROR(Val) \ #define ROR(Val) \
if (GET_CF ()) { \ do { \
Val |= 0x100; \ unsigned ShiftOut = (Val & 0x01); \
} \ Val >>= 1; \
SET_CF (Val & 0x01); \ if (GET_CF ()) { \
Val >>= 1; \ Val |= 0x80; \
TEST_ZF (Val); \ } \
TEST_SF (Val) TEST_ZF (Val); \
TEST_SF (Val); \
SET_CF (ShiftOut); \
} while(0)
/* ASL */ /* ASL */
#define ASL(Val) \ #define ASL(Val) \