diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-01-29 20:48:04 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-01-29 20:48:04 +0100 |
| commit | aaa4fd1265603e004fb68f387d10cc6ef6808ddf (patch) | |
| tree | 81542eb7e772c39f9e690c363bcbdc1348b11acd | |
| parent | 9793c3b142c325d9405b1baa5959547a3f49fcaf (diff) | |
| download | box64-aaa4fd1265603e004fb68f387d10cc6ef6808ddf.tar.gz box64-aaa4fd1265603e004fb68f387d10cc6ef6808ddf.zip | |
[INTERPRETOR] More finetunning to shrd16/shld16
| -rw-r--r-- | src/emu/x64primop.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/emu/x64primop.c b/src/emu/x64primop.c index 94bb4348..9bb001ba 100644 --- a/src/emu/x64primop.c +++ b/src/emu/x64primop.c @@ -1055,7 +1055,7 @@ uint16_t shrd16 (x64emu_t *emu, uint16_t d, uint16_t fill, uint8_t s) s = s&0x1f; cnt = s % 16; - if (s <= 16) { + if (s < 16) { if (cnt > 0) { cf = d & (1 << (cnt - 1)); res = (d >> cnt) | (fill << (16 - cnt)); @@ -1073,7 +1073,10 @@ uint16_t shrd16 (x64emu_t *emu, uint16_t d, uint16_t fill, uint8_t s) CONDITIONAL_SET_FLAG((d >> 15)&1, F_OF); } } else { - cf = fill & (1 << (cnt - 1)); + if(s==16) + cf = d & (1 << 15); + else + cf = fill & (1 << (cnt - 1)); res = (fill >> cnt) | (d << (16 - cnt)); CONDITIONAL_SET_FLAG(cf, F_CF); CONDITIONAL_SET_FLAG((res & 0xffff) == 0, F_ZF); |