INCB clean-up & fix
This commit is contained in:
parent
1e91bb9814
commit
ef4739b251
1 changed files with 3 additions and 6 deletions
9
cpu.cpp
9
cpu.cpp
|
@ -886,10 +886,8 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0b000101010: { // INC/INCB
|
case 0b000101010: { // INC/INCB
|
||||||
auto a = getGAM(dst_mode, dst_reg, word_mode, rm_cur);
|
|
||||||
|
|
||||||
if (dst_mode == 0) {
|
if (dst_mode == 0) {
|
||||||
uint16_t v = a.value.value();
|
uint16_t v = getRegister(dst_reg);
|
||||||
uint16_t add = word_mode == wm_byte ? v & 0xff00 : 0;
|
uint16_t add = word_mode == wm_byte ? v & 0xff00 : 0;
|
||||||
|
|
||||||
v = (v + 1) & (word_mode == wm_byte ? 0xff : 0xffff);
|
v = (v + 1) & (word_mode == wm_byte ? 0xff : 0xffff);
|
||||||
|
@ -902,8 +900,8 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
setRegister(dst_reg, v);
|
setRegister(dst_reg, v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
auto a = getGAM(dst_mode, dst_reg, word_mode, rm_cur);
|
||||||
int32_t vl = (a.value.value() + 1) & (word_mode == wm_byte ? 0xff : 0xffff);
|
int32_t vl = (a.value.value() + 1) & (word_mode == wm_byte ? 0xff : 0xffff);
|
||||||
|
|
||||||
bool set_flags = a.addr.value() != ADDR_PSW;
|
bool set_flags = a.addr.value() != ADDR_PSW;
|
||||||
|
|
||||||
if (set_flags) {
|
if (set_flags) {
|
||||||
|
@ -935,8 +933,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
auto a = getGAM(dst_mode, dst_reg, word_mode, rm_cur);
|
auto a = getGAM(dst_mode, dst_reg, word_mode, rm_cur);
|
||||||
uint16_t v = a.value.value();
|
int32_t vl = (a.value.value() - 1) & (word_mode == wm_byte ? 0xff : 0xffff);
|
||||||
int32_t vl = (v - 1) & (word_mode == wm_byte ? 0xff : 0xffff);
|
|
||||||
|
|
||||||
bool set_flags = a.addr.value() != ADDR_PSW;
|
bool set_flags = a.addr.value() != ADDR_PSW;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue