ASLB: need to retain MSB for register access in byte mode

This commit is contained in:
folkert van heusden 2024-03-30 10:29:48 +01:00
parent 7bf07d747f
commit ddfb16e628
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

View file

@ -1185,7 +1185,6 @@ bool cpu::single_operand_instructions(const uint16_t instr)
case 0b000110010: { // ASR/ASRB
if (dst_mode == 0) {
uint16_t v = getRegister(dst_reg);
uint16_t hb = word_mode == wm_byte ? v & 128 : v & 32768;
setPSW_c(v & 1);
@ -1232,7 +1231,10 @@ bool cpu::single_operand_instructions(const uint16_t instr)
case 0b00110011: { // ASL/ASLB
if (dst_mode == 0) {
uint16_t vl = getRegister(dst_reg);
uint16_t v = (vl << 1) & (word_mode == wm_byte ? 0xff : 0xffff);
uint16_t v = ((vl << 1) & (word_mode == wm_byte ? 0xff : 0xffff));
if (word_mode == wm_byte)
v |= vl & 0xff00;
setPSW_n(SIGN(v, word_mode));
setPSW_z(IS_0(v, wm_word));
@ -1240,7 +1242,6 @@ bool cpu::single_operand_instructions(const uint16_t instr)
setPSW_v(getPSW_n() ^ getPSW_c());
setRegister(dst_reg, v);
}
else {
auto a = getGAM(dst_mode, dst_reg, word_mode, rm_cur);