وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

Flags and Conditional Jumps


Flags and Conditional Jumps   ..



The Flags Register


The Flags Register is a particular Register that indicates the different states of CPU.  Meaningful bits of this register are:


__| __| __| __| OF| DF| IF| TF| SF| ZF| __| AF| __| PF| __| CF|


where the meaning of set bits are:


OF > Overflow of math integer operation

DF > Direction Flag (set by STD)

IF  > Interruption Flag

TF > Trap Flag

SF > Sign Flag (set by a negative result of integer Math operation)

ZF > Zero Flag (or Equal Flag)

AF > Auxiliary Carry Flag

PF > Parity Flag

CF > Carry Flag



Table Conditional Jumps


They are all these 'j..' jmps following a comparison (cmp or test). The execution depends on the state of the Flags Register:


Flags: O S Z P C

Simple Flags tests Instructions:

je / jz . . 1 . .

jne / jnz . . 0 . .

jno 0 . . . .

jnp / jpo . . . 0 .

jnz . 0 . . .

jo 1 . . . .

jp / jpe . . . 1 .

je . 1 . . .

Unsigned Math Instructions:

jb / jnae / jc . . . . 1

jbe / jna . . 1 . 1   (both ZF and CF set on)

jnb / jae / jn . . . . 0

jnbe / ja . . 0 . 0   (both ZF and CF set off)

Signed Math Instructions:

jl / jnge A B . . .    (NOT  (A=B))

jle / jng A B 1 . .    (NOT  (A=B))  OR  ZF

jnl / jge A B . . .    (A=B)

jnle / jg A B 0 . .


Read  j  as 'jump', e  as 'equal',  z  as  'Empty',  n  as 'not',  o  as 'overflow,  p as 'parity',  a  as 'above',  c  as 'carry',  b  as 'below',  g  as 'greater',  l  as 'lower'


~~~~~~~