mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-20 06:25:01 +00:00
Unify TST.
This commit is contained in:
parent
eff9a09b9f
commit
06dbb7167b
@ -234,6 +234,12 @@ template <bool is_extend, typename IntT> void negative(IntT &source, Status &sta
|
|||||||
source = result;
|
source = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename IntT> void test(IntT source, Status &status) {
|
||||||
|
status.carry_flag = status.overflow_flag = 0;
|
||||||
|
status.zero_result = Status::FlagT(source);
|
||||||
|
status.negative_flag = status.zero_result & top_bit<IntT>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <
|
template <
|
||||||
@ -970,23 +976,9 @@ template <
|
|||||||
TSTs: compare to zero.
|
TSTs: compare to zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case Operation::TSTb:
|
case Operation::TSTb: Primitive::test(src.b, status); break;
|
||||||
status.carry_flag = status.overflow_flag = 0;
|
case Operation::TSTw: Primitive::test(src.w, status); break;
|
||||||
status.zero_result = src.b;
|
case Operation::TSTl: Primitive::test(src.l, status); break;
|
||||||
status.negative_flag = status.zero_result & 0x80;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Operation::TSTw:
|
|
||||||
status.carry_flag = status.overflow_flag = 0;
|
|
||||||
status.zero_result = src.w;
|
|
||||||
status.negative_flag = status.zero_result & 0x8000;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Operation::TSTl:
|
|
||||||
status.carry_flag = status.overflow_flag = 0;
|
|
||||||
status.zero_result = src.l;
|
|
||||||
status.negative_flag = status.zero_result & 0x80000000;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Operation::STOP:
|
case Operation::STOP:
|
||||||
status.set_status(src.w);
|
status.set_status(src.w);
|
||||||
|
Loading…
Reference in New Issue
Block a user