1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Fix ABCD when the result has an invalid lower digit.

This commit is contained in:
Thomas Harte 2022-05-11 16:31:27 -04:00
parent 17add4b585
commit a9902fc817

View File

@ -43,7 +43,7 @@ template <
int result = (destination & 0xf) + (source & 0xf) + (status.extend_flag_ ? 1 : 0); int result = (destination & 0xf) + (source & 0xf) + (status.extend_flag_ ? 1 : 0);
if(result > 0x09) result += 0x06; if(result > 0x09) result += 0x06;
result += (destination & 0xf0) + (source & 0xf0); result += (destination & 0xf0) + (source & 0xf0);
if(result > 0x99) result += 0x60; if(result > 0x9f) result += 0x60;
// Set all flags essentially as if this were normal addition. // Set all flags essentially as if this were normal addition.
status.zero_result_ |= result & 0xff; status.zero_result_ |= result & 0xff;