1
0
mirror of https://github.com/mre/mos6502.git synced 2024-12-22 12:29:31 +00:00

fix panic

This commit is contained in:
Sam M W 2022-10-23 07:01:26 +01:00
parent bf543e2fbe
commit 2bcbfa63b5

View File

@ -629,7 +629,8 @@ impl CPU {
let over =
((nc == 0 && value < 0) || (nc == 1 && value < -1)) && a_before >= 0 && a_after < 0;
let under = (a_before < 0) && (-value - nc < 0) && a_after >= 0;
let under =
(a_before < 0) && (0i8.wrapping_sub(value).wrapping_sub(nc) < 0) && a_after >= 0;
let did_overflow = over || under;