1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-05 08:55:36 +00:00

Don't trample on X before use.

This commit is contained in:
Thomas Harte 2022-10-17 22:19:35 -04:00
parent 8148397f62
commit 555250dbd9

View File

@ -435,20 +435,22 @@ template <Operation operation, typename IntT, typename FlowController> void rox(
} else { } else {
switch(operation) { switch(operation) {
case Operation::ROXLb: case Operation::ROXLw: case Operation::ROXLl: case Operation::ROXLb: case Operation::ROXLw: case Operation::ROXLl:
status.carry_flag = status.extend_flag = Status::FlagT((destination >> (size - shift)) & 1); status.carry_flag = Status::FlagT((destination >> (size - shift)) & 1);
destination = IntT( destination = IntT(
(destination << shift) | (destination << shift) |
(IntT(status.extend_flag ? 1 : 0) << (shift - 1)) | (IntT(status.extend_flag ? 1 : 0) << (shift - 1)) |
(destination >> (size + 1 - shift)) (destination >> (size + 1 - shift))
); );
status.extend_flag = status.carry_flag;
break; break;
case Operation::ROXRb: case Operation::ROXRw: case Operation::ROXRl: case Operation::ROXRb: case Operation::ROXRw: case Operation::ROXRl:
status.carry_flag = status.extend_flag = Status::FlagT(destination & (1 << (shift - 1))); status.carry_flag = Status::FlagT(destination & (1 << (shift - 1)));
destination = IntT( destination = IntT(
(destination >> shift) | (destination >> shift) |
((status.extend_flag ? top_bit<IntT>() : 0) >> (shift - 1)) | ((status.extend_flag ? top_bit<IntT>() : 0) >> (shift - 1)) |
(destination << (size + 1 - shift)) (destination << (size + 1 - shift))
); );
status.extend_flag = status.carry_flag;
break; break;
} }
} }