emu8051 icon indicating copy to clipboard operation
emu8051 copied to clipboard

Incorrect setting of AC flag

Open saur0n opened this issue 5 months ago • 0 comments

https://github.com/jarikomppa/emu8051/blob/5dc681275151c4a5d7b85ec9ff4ceb1b25abd5a8/opcodes.c#L138

From my understanding of the datasheet, it is incorrect. AC is set when there is a carry from low nibble to high nibble. I propose to rewrite this line in the following way:

bool auxcarry = ((value1 & 15) + (value2 & 15) + carryin) >> 4;

saur0n avatar Sep 09 '24 19:09 saur0n