I'm writing a free tool for studying JCC and FLAGS.
Not sure when it's finished (I still have not decided on UI).
But during a process I come to some solutions wich might be fresh
(? not sure of course, anyway I haven't seen them yet, and
it does no harm anyway)
Seems they might be published here for discussion.


S = straight comparing cmp X,Y
R = reverse comparing cmp Y,X to check S condition
N= !(S)

S R N
> < <=
< > >=
<= >= >
>= <= <
= = <>
<> <> =



IF cmp X,Y (S cond) then cmp Y,X (R) not cmp X,Y (n)

S R= S xor 100 N = R xor 011
----------------------------------------------------------
010 > 110 < 101 <=
110 < 010 > 001 >=
101 <= 001 >= 010 >
001 >= 101 <= 110 <
;---------------------------------------------------------

000 = 100 = 011 <> ;000 and 100 for =
011 <> 011 <> 000 =

codes for condcode
000 =
001 >=
010 >
011 <>
101<=
110 <
condifo struct
condcode db ?
...... any other info members : strings pointer, mnem tbls addr etc.
ends
.data
;offset datarecords with info for each condition
;7 dwords not 6!
cortbl offset eq,offset eqg,offset g,offset neq,offset eq,offset leq, offset l
.code
if some condcode in eax for example
then dword ptr [eax*4][cortbl] = offset of S condition desc.
xor eax,100b ;[eax*4][cortbl] = offset of R condition desc
xor eax,011b ;[eax*4][cortbl] = offset of N condition desc

Posted on 2002-04-07 17:01:50 by The Svin