ASH carry flag

This commit is contained in:
Folkert van Heusden 2025-04-04 22:29:53 +02:00
parent dd546c34d7
commit a965b9ce7e
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

View file

@ -832,6 +832,7 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
setPSW_v(false); setPSW_v(false);
} }
else if (shift < 32) { else if (shift < 32) {
if (shift > 15)
setPSW_c((R << (shift - 16)) & 1); setPSW_c((R << (shift - 16)) & 1);
setPSW_v(false); setPSW_v(false);
for(int i=0; i<shift; i++) { for(int i=0; i<shift; i++) {
@ -839,6 +840,8 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
if (SIGN(R, wm_word) != sign) if (SIGN(R, wm_word) != sign)
setPSW_v(true); setPSW_v(true);
} }
if (shift <= 15)
setPSW_c(R & 0x10000);
} }
else if (shift == 32) { else if (shift == 32) {
R = -sign; R = -sign;
@ -857,10 +860,8 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
} }
} }
R &= 0xffff;
setPSW_n(SIGN(R, wm_word)); setPSW_n(SIGN(R, wm_word));
setPSW_z(R == 0); setPSW_z((R & 0xffff) == 0);
set_register(reg, R); set_register(reg, R);