ASH v-flag

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

16
cpu.cpp
View file

@ -831,18 +831,20 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
setPSW_c(false); setPSW_c(false);
setPSW_v(false); setPSW_v(false);
} }
else if (shift <= 15) {
R <<= shift;
setPSW_c(R & 0x10000);
}
else if (shift < 32) { else if (shift < 32) {
setPSW_c((R << (shift - 16)) & 1); setPSW_c((R << (shift - 16)) & 1);
R = 0; setPSW_v(false);
for(int i=0; i<shift; i++) {
R <<= 1;
if (SIGN(R, wm_word) != sign)
setPSW_v(true);
}
} }
else if (shift == 32) { else if (shift == 32) {
R = -sign; R = -sign;
setPSW_c(sign); setPSW_c(sign);
setPSW_v(SIGN(oldR, wm_word) != SIGN(R, wm_word));
} }
else { else {
int shift_n = 64 - shift; int shift_n = 64 - shift;
@ -855,8 +857,6 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
} }
} }
setPSW_v(SIGN(oldR, wm_word) != SIGN(R, wm_word));
R &= 0xffff; R &= 0xffff;
setPSW_n(SIGN(R, wm_word)); setPSW_n(SIGN(R, wm_word));
@ -917,7 +917,7 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
set_register(reg, R0R1 >> 16); set_register(reg, R0R1 >> 16);
set_register(reg | 1, R0R1 & 65535); set_register(reg | 1, R0R1 & 65535);
setPSW_n(R0R1 & 0x80000000); setPSW_n(new_sign);
setPSW_z(R0R1 == 0); setPSW_z(R0R1 == 0);
return true; return true;