I'm writing a simple simulation of a microprocessor, and, for the JNC instruction, I am unsure if the carry bit is automatically reset after the JNC instruction. Is it (generally, although different cpu architectures might not solve it the same way there are probably trends)?
On normal CPUs, branch instructions only read flags, they don't modify them, as you can see from looking at popular existing ISAs such as
jnc
(https://www.felixcloutier.com/x86/jcc)Just like how add dst, src
or mov dst, src
doesn't zero the source.
A pure branch instruction only writes the program counter, no other side-effects. Some ISAs with FLAGS may also have a sub-and-branch instruction like x86's loop
, although that doesn't use CF at all.