setPSW_flags_nzv
This commit is contained in:
parent
7245340c20
commit
57c7a23bd5
2 changed files with 25 additions and 45 deletions
69
cpu.cpp
69
cpu.cpp
|
@ -260,6 +260,13 @@ void cpu::setPSW(const uint16_t v, const bool limited)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cpu::setPSW_flags_nzv(const uint16_t value, const bool word_mode)
|
||||||
|
{
|
||||||
|
setPSW_n(SIGN(value, word_mode));
|
||||||
|
setPSW_z(IS_0(value, word_mode));
|
||||||
|
setPSW_v(false);
|
||||||
|
}
|
||||||
|
|
||||||
bool cpu::check_queued_interrupts()
|
bool cpu::check_queued_interrupts()
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lck(qi_lock);
|
std::unique_lock<std::mutex> lck(qi_lock);
|
||||||
|
@ -496,11 +503,8 @@ bool cpu::double_operand_instructions(const uint16_t instr)
|
||||||
|
|
||||||
addToMMR1(dst_mode, dst_reg, word_mode);
|
addToMMR1(dst_mode, dst_reg, word_mode);
|
||||||
|
|
||||||
if (set_flags) {
|
if (set_flags)
|
||||||
setPSW_n(SIGN(src_value, word_mode));
|
setPSW_flags_nzv(src_value, word_mode);
|
||||||
setPSW_z(IS_0(src_value, word_mode));
|
|
||||||
setPSW_v(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -526,9 +530,7 @@ bool cpu::double_operand_instructions(const uint16_t instr)
|
||||||
uint16_t dst_value = getGAM(dst_mode, dst_reg, word_mode, false);
|
uint16_t dst_value = getGAM(dst_mode, dst_reg, word_mode, false);
|
||||||
uint16_t result = (dst_value & src_value) & (word_mode ? 0xff : 0xffff);
|
uint16_t result = (dst_value & src_value) & (word_mode ? 0xff : 0xffff);
|
||||||
|
|
||||||
setPSW_n(SIGN(result, word_mode));
|
setPSW_flags_nzv(result, word_mode);
|
||||||
setPSW_z(IS_0(result, word_mode));
|
|
||||||
setPSW_v(false);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -538,11 +540,8 @@ bool cpu::double_operand_instructions(const uint16_t instr)
|
||||||
|
|
||||||
uint16_t result = b->read(a, word_mode, false) & ~src_value;
|
uint16_t result = b->read(a, word_mode, false) & ~src_value;
|
||||||
|
|
||||||
if (put_result(a, dst_mode, dst_reg, word_mode, result)) {
|
if (put_result(a, dst_mode, dst_reg, word_mode, result))
|
||||||
setPSW_n(SIGN(result, word_mode));
|
setPSW_flags_nzv(result, word_mode);
|
||||||
setPSW_z(IS_0(result, word_mode));
|
|
||||||
setPSW_v(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -552,11 +551,8 @@ bool cpu::double_operand_instructions(const uint16_t instr)
|
||||||
|
|
||||||
uint16_t result = b->read(a, word_mode, false) | src_value;
|
uint16_t result = b->read(a, word_mode, false) | src_value;
|
||||||
|
|
||||||
if (put_result(a, dst_mode, dst_reg, word_mode, result)) {
|
if (put_result(a, dst_mode, dst_reg, word_mode, result))
|
||||||
setPSW_n(SIGN(result, word_mode));
|
setPSW_flags_nzv(result, word_mode);
|
||||||
setPSW_z(IS_0(result, word_mode));
|
|
||||||
setPSW_v(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -777,11 +773,8 @@ bool cpu::additional_double_operand_instructions(const uint16_t instr)
|
||||||
set_flags = a != ADDR_PSW;
|
set_flags = a != ADDR_PSW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_flags) {
|
if (set_flags)
|
||||||
setPSW_n(vl & 0x8000);
|
setPSW_flags_nzv(vl, false);
|
||||||
setPSW_z(vl == 0);
|
|
||||||
setPSW_v(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -837,9 +830,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_flags) {
|
if (set_flags) {
|
||||||
setPSW_n(v & 0x80);
|
setPSW_flags_nzv(v, true);
|
||||||
setPSW_z((v & 0xff) == 0);
|
|
||||||
setPSW_v(false);
|
|
||||||
setPSW_c(false);
|
setPSW_c(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -884,9 +875,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
else
|
else
|
||||||
v ^= 0xffff;
|
v ^= 0xffff;
|
||||||
|
|
||||||
setPSW_n(SIGN(v, word_mode));
|
setPSW_flags_nzv(v, word_mode);
|
||||||
setPSW_z(IS_0(v, word_mode));
|
|
||||||
setPSW_v(false);
|
|
||||||
setPSW_c(true);
|
setPSW_c(true);
|
||||||
|
|
||||||
setRegister(dst_reg, false, v);
|
setRegister(dst_reg, false, v);
|
||||||
|
@ -903,9 +892,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
bool set_flags = a != ADDR_PSW;
|
bool set_flags = a != ADDR_PSW;
|
||||||
|
|
||||||
if (set_flags) {
|
if (set_flags) {
|
||||||
setPSW_n(SIGN(v, word_mode));
|
setPSW_flags_nzv(v, word_mode);
|
||||||
setPSW_z(IS_0(v, word_mode));
|
|
||||||
setPSW_v(false);
|
|
||||||
setPSW_c(true);
|
setPSW_c(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,9 +1087,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
case 0b000101111: { // TST/TSTB
|
case 0b000101111: { // TST/TSTB
|
||||||
uint16_t v = getGAM(dst_mode, dst_reg, word_mode, false);
|
uint16_t v = getGAM(dst_mode, dst_reg, word_mode, false);
|
||||||
|
|
||||||
setPSW_n(SIGN(v, word_mode));
|
setPSW_flags_nzv(v, word_mode);
|
||||||
setPSW_z(IS_0(v, word_mode));
|
|
||||||
setPSW_v(false);
|
|
||||||
setPSW_c(false);
|
setPSW_c(false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1331,11 +1316,8 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_flags) {
|
if (set_flags)
|
||||||
setPSW_z(v == 0);
|
setPSW_flags_nzv(v, false);
|
||||||
setPSW_n(SIGN(v, false));
|
|
||||||
setPSW_v(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// put on current stack
|
// put on current stack
|
||||||
pushStack(v);
|
pushStack(v);
|
||||||
|
@ -1384,11 +1366,8 @@ bool cpu::single_operand_instructions(const uint16_t instr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_flags) {
|
if (set_flags)
|
||||||
setPSW_z(v == 0);
|
setPSW_flags_nzv(v, false);
|
||||||
setPSW_n(SIGN(v, false));
|
|
||||||
setPSW_v(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
1
cpu.h
1
cpu.h
|
@ -114,6 +114,7 @@ public:
|
||||||
void setPSW_n(const bool v);
|
void setPSW_n(const bool v);
|
||||||
void setPSW_spl(const int v);
|
void setPSW_spl(const int v);
|
||||||
void setBitPSW(const int bit, const bool v);
|
void setBitPSW(const int bit, const bool v);
|
||||||
|
void setPSW_flags_nzv(const uint16_t value, const bool word_mode);
|
||||||
|
|
||||||
uint16_t getPSW() const { return psw; }
|
uint16_t getPSW() const { return psw; }
|
||||||
void setPSW(const uint16_t v, const bool limited);
|
void setPSW(const uint16_t v, const bool limited);
|
||||||
|
|
Loading…
Add table
Reference in a new issue