Search   
Home  Print View  

 

Electronics

Branch Content

Flags implementation

The flags register F is actually a set of individual flip-flops that can be set or cleared independently.

Flag are set or reset directly from registers A, B, C, D, IX, SP, at the time they are latched, incremented or decremented, according to the following logic:

After latched, incremented or decremented, if the content of the register resulted in zero, the Z flag is set, otherwise, Z is reset.

If bit 11 is one, then flag N is set. Otherwise, N is reset.

If an increment or decrement operation resulted in count roll-over (remember that registers are implemented with counter chips) then flag V is set. Otherwise, V is reset.

Flag C is set by the ALU when an arithmetic or logic operation results in an arithmetic or logical carry, reset otherwise.

Instructions that do not affect flags (for example, writing to memory), reset all four flags automatically. This is done by the Exec Sequencer circuit.

Instructions that test flags (for example, conditional jump) do reset all four flags after using them.


Powered by HelpBooks version 0.86, running at: melissa