sum = imm + reg2 + ((PSW & PSW_C) != 0);
State.regs[dstreg] = sum;
- z = (sum == 0);
+ z = ((PSW & PSW_Z) != 0) && (sum == 0);
n = (sum & 0x80000000);
c = (sum < imm) || (sum < reg2);
v = ((reg2 & 0x80000000) == (imm & 0x80000000)
difference = reg2 - imm - ((PSW & PSW_C) != 0);
State.regs[dstreg] = difference;
- z = (difference == 0);
+ z = ((PSW & PSW_Z) != 0) && (difference == 0);
n = (difference & 0x80000000);
c = (imm > reg2);
v = ((reg2 & 0x80000000) == (imm & 0x80000000)
PC = cia;
if (XRN0 == 0)
- State.regs[REG_SP] = EXTEND8 (IMM8);
+ State.regs[REG_SP] = IMM8;
else
abort ();
}
genericBtst(IMM8, State.regs[srcreg]);
}
-
// 1111 1011 0000 1010 Rn Rm IMM8; mov (d8,Rm),Rn
8.0xfb+8.0x0a+4.RN2,4.RM0+8.IMM8:D2l:::mov
"mov"
PC = cia;
srcreg = translate_rreg (SD_, RN2);
- temp = ((signed64)EXTEND8 (IMM8)
- * (signed64)State.regs[srcreg]);
+ temp = ((signed64)(signed32)EXTEND8 (IMM8)
+ * (signed64)(signed32)State.regs[srcreg]);
sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
State.regs[REG_MCRL] = sum;
PC = cia;
srcreg = translate_rreg (SD_, RN2);
- temp = ((signed64)EXTEND8 (IMM8)
- * (signed64)State.regs[srcreg] & 0xff);
+ temp = ((signed64)(signed8)EXTEND8 (IMM8)
+ * (signed64)(signed8)State.regs[srcreg] & 0xff);
sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
State.regs[REG_MCRL] = sum;
PC = cia;
srcreg = translate_rreg (SD_, RN2);
- temp = ((signed64)EXTEND8 (IMM8)
- * (signed64)State.regs[srcreg] & 0xffff);
+ temp = ((signed64)(signed16)EXTEND8 (IMM8)
+ * (signed64)(signed16)State.regs[srcreg] & 0xffff);
sum = State.regs[REG_MCRL] + (temp & 0xffffffff);
c = (sum < State.regs[REG_MCRL]) || (sum < (temp & 0xffffffff));
State.regs[REG_MCRL] = sum;
sum = source1 + source2 + ((PSW & PSW_C) != 0);
State.regs[dstreg] = sum;
- z = (sum == 0);
+ z = ((PSW & PSW_Z) != 0) && (sum == 0);
n = (sum & 0x80000000);
c = (sum < source1) || (sum < source2);
v = ((source1 & 0x80000000) == (source2 & 0x80000000)
difference = source2 - source1 - ((PSW & PSW_C) != 0);
State.regs[dstreg] = difference;
- z = (difference == 0);
+ z = ((PSW & PSW_Z) != 0) && (difference == 0);
n = (difference & 0x80000000);
c = (source1 > source2);
v = ((source1 & 0x80000000) == (source2 & 0x80000000)
"and"
*am33
{
- int z, c, n, v;
+ int z, n;
int srcreg1, srcreg2, dstreg;
PC = cia;
"or"
*am33
{
- int z, c, n, v;
+ int z, n;
int srcreg1, srcreg2, dstreg;
PC = cia;
"xor"
*am33
{
- int z, c, n, v;
+ int z, n;
int srcreg1, srcreg2, dstreg;
PC = cia;
"asr"
*am33
{
- int z, c, n, v;
+ int z, c, n;
long temp;
int srcreg1, srcreg2, dstreg;
"lsr"
*am33
{
- int z, c, n, v;
+ int z, c, n;
int srcreg1, srcreg2, dstreg;
PC = cia;
"asl"
*am33
{
- int z, c, n, v;
+ int z, n;
int srcreg1, srcreg2, dstreg;
PC = cia;
dstreg1 = translate_rreg (SD_, RD0);
dstreg2 = translate_rreg (SD_, RD2);
- temp = ((unsigned64)(unsigned32)State.regs[srcreg1]
- * (unsigned64)(unsigned32)State.regs[srcreg2]);
+ temp = ((unsigned64)State.regs[srcreg1]
+ * (unsigned64)State.regs[srcreg2]);
State.regs[dstreg1] = temp & 0xffffffff;
State.regs[dstreg2] = (temp & 0xffffffff00000000LL) >> 32;;
}
sum = imm + reg2 + ((PSW & PSW_C) != 0);
State.regs[dstreg] = sum;
- z = (sum == 0);
+ z = ((PSW & PSW_Z) != 0) && (sum == 0);
n = (sum & 0x80000000);
c = (sum < imm) || (sum < reg2);
v = ((reg2 & 0x80000000) == (imm & 0x80000000)
difference = reg2 - imm - ((PSW & PSW_C) != 0);
State.regs[dstreg] = difference;
- z = (difference == 0);
+ z = ((PSW & PSW_Z) != 0) && (difference == 0);
n = (difference & 0x80000000);
c = (imm > reg2);
v = ((reg2 & 0x80000000) == (imm & 0x80000000)
srcreg = translate_rreg (SD_, RM0);
dstreg = translate_rreg (SD_, RN2);
State.regs[dstreg] = load_word (State.regs[srcreg]
- + FETCH24 (IMM24A, IMM24B, IMM24C));
+ + EXTEND24 (FETCH24 (IMM24A,
+ IMM24B, IMM24C)));
}
// 1111 1101 0001 1010 Rm Rn IMM24; mov Rm,(d24,Rn)
PC = cia;
srcreg = translate_rreg (SD_, RM2);
dstreg = translate_rreg (SD_, RN0);
- store_word (State.regs[dstreg] + FETCH24 (IMM24A, IMM24B, IMM24C),
+ store_word (State.regs[dstreg] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
State.regs[srcreg]);
}
srcreg = translate_rreg (SD_, RM0);
dstreg = translate_rreg (SD_, RN2);
State.regs[dstreg] = load_byte (State.regs[srcreg]
- + FETCH24 (IMM24A, IMM24B, IMM24C));
+ + EXTEND24 (FETCH24 (IMM24A,
+ IMM24B, IMM24C)));
}
// 1111 1101 0011 1010 Rm Rn IMM24; movbu Rm,(d24,Rn)
PC = cia;
srcreg = translate_rreg (SD_, RM2);
dstreg = translate_rreg (SD_, RN0);
- store_byte (State.regs[dstreg] + FETCH24 (IMM24A, IMM24B, IMM24C),
+ store_byte (State.regs[dstreg] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
State.regs[srcreg]);
}
srcreg = translate_rreg (SD_, RM0);
dstreg = translate_rreg (SD_, RN2);
State.regs[dstreg] = load_half (State.regs[srcreg]
- + FETCH24 (IMM24A, IMM24B, IMM24C));
+ + EXTEND24 (FETCH24 (IMM24A,
+ IMM24B, IMM24C)));
}
// 1111 1101 0101 1010 Rm Rn IMM24; movhu Rm,(d24,Rn)
PC = cia;
srcreg = translate_rreg (SD_, RM2);
dstreg = translate_rreg (SD_, RN0);
- store_half (State.regs[dstreg] + FETCH24 (IMM24A, IMM24B, IMM24C),
+ store_half (State.regs[dstreg] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
State.regs[srcreg]);
}
srcreg = translate_rreg (SD_, RM0);
dstreg = translate_rreg (SD_, RN2);
State.regs[dstreg] = load_word (State.regs[srcreg]
- + FETCH24 (IMM24A, IMM24B, IMM24C));
+ + EXTEND24 (FETCH24 (IMM24A,
+ IMM24B, IMM24C)));
State.regs[srcreg] += 4;
}
PC = cia;
srcreg = translate_rreg (SD_, RM2);
dstreg = translate_rreg (SD_, RN0);
- store_word (State.regs[dstreg] + FETCH24 (IMM24A, IMM24B, IMM24C),
+ store_word (State.regs[dstreg] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
State.regs[srcreg]);
State.regs[dstreg] += 4;
}
PC = cia;
dstreg = translate_rreg (SD_, RN2);
State.regs[dstreg] = load_word (State.regs[REG_SP]
- + FETCH24 (IMM24A, IMM24B, IMM24C));
+ + EXTEND24 (FETCH24 (IMM24A,
+ IMM24B, IMM24C)));
}
// 1111 1101 1001 1010 Rm 0000 IMM24; mov Rm,(d24,sp)
PC = cia;
srcreg = translate_rreg (SD_, RM2);
- store_word (State.regs[REG_SP] + FETCH24 (IMM24A, IMM24B, IMM24C),
+ store_word (State.regs[REG_SP] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
State.regs[srcreg]);
}
PC = cia;
dstreg = translate_rreg (SD_, RN2);
State.regs[dstreg] = load_byte (State.regs[REG_SP]
- + FETCH24 (IMM24A, IMM24B, IMM24C));
+ + EXTEND24 (FETCH24 (IMM24A,
+ IMM24B, IMM24C)));
}
// 1111 1101 1011 1010 Rm 0000 IMM24; movbu Rm,(d24,sp)
PC = cia;
srcreg = translate_rreg (SD_, RM2);
- store_byte (State.regs[REG_SP] + FETCH24 (IMM24A, IMM24B, IMM24C),
+ store_byte (State.regs[REG_SP] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
State.regs[srcreg]);
}
PC = cia;
dstreg = translate_rreg (SD_, RN2);
State.regs[dstreg] = load_half (State.regs[REG_SP]
- + FETCH24 (IMM24A, IMM24B, IMM24C));
+ + EXTEND24 (FETCH24 (IMM24A,
+ IMM24B, IMM24C)));
}
// 1111 1101 1101 1010 Rm Rn IMM24; movhu Rm,(d24,sp)
PC = cia;
srcreg = translate_rreg (SD_, RM2);
- store_half (State.regs[REG_SP] + FETCH24 (IMM24A, IMM24B, IMM24C),
+ store_half (State.regs[REG_SP] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
State.regs[srcreg]);
}
srcreg = translate_rreg (SD_, RM0);
dstreg = translate_rreg (SD_, RN2);
State.regs[dstreg] = load_half (State.regs[srcreg]
- + FETCH24 (IMM24A, IMM24B, IMM24C));
+ + EXTEND24 (FETCH24 (IMM24A,
+ IMM24B, IMM24C)));
State.regs[dstreg] += 2;
}
PC = cia;
srcreg = translate_rreg (SD_, RM2);
dstreg = translate_rreg (SD_, RN0);
- store_half (State.regs[dstreg] + FETCH24 (IMM24A, IMM24B, IMM24C),
+ store_half (State.regs[dstreg] + EXTEND24 (FETCH24 (IMM24A, IMM24B, IMM24C)),
State.regs[srcreg]);
State.regs[srcreg] += 2;
}
sum = imm + reg2 + ((PSW & PSW_C) != 0);
State.regs[dstreg] = sum;
- z = (sum == 0);
+ z = ((PSW & PSW_Z) != 0) && (sum == 0);
n = (sum & 0x80000000);
c = (sum < imm) || (sum < reg2);
v = ((reg2 & 0x80000000) == (imm & 0x80000000)
difference = reg2 - imm - ((PSW & PSW_C) != 0);
State.regs[dstreg] = difference;
- z = (difference == 0);
+ z = ((PSW & PSW_Z) != 0) && (difference == 0);
n = (difference & 0x80000000);
c = (imm > reg2);
v = ((reg2 & 0x80000000) == (imm & 0x80000000)