Double Negation  ...



RosAsm can do:  'double negative conditionals'. What's that ?


Let us suppose you want some 'DO / Loop_Until' Macro. In order to handle this negative case (we loop until the given condition is NOT true), you would usually have to organize your macro like this:


[Do | D0:]   [Loop_Until | cmp #1 #3 | j#2 D1> | jmp D0<< | D1:]


Do

     ;

     ; some instructions

     ;

Loop_Until eax ne 0


>>>>  D0:

                                     ; some instructions

cmp eax 0 | jne D1>    ; double jumps just like

jmp D0<<                    ; in Local_Labels  Select_Case example

D1:



With double negation of condition, you can now write the more accurate:


[Do | D0:]   [Loop_Until | cmp #1 #3 | jn#2 D0<<]


Do

     ;

     ; some instructions

     ;

Loop_Until eax ne 055


>>>>  D0:

   ; some instructions

cmp eax 055 | jnne D0<<    ; (jnne = je) <<<<<< This is double negation <<<<<<



(Double negation is not a feature of the macros parser. It is a simple addition at beginning of the 'tttn Bits' conditions parser).


So, the upper Select_Case example given in Local_Labels section now becomes  clean and still handles the negative cases:


;...

[Case | Jmp C9>> | C2: | cmp D§Select_Val #2 | jn#1 C2>]

;...


And the clean unfolding:


; ...

C2:      cmp D§Select_Val 0 | jne C2>

             ; ...

             ; some code lines

             ; ...

             jmp C9>>

C2:      cmp D§Select_Val 1 | jne C2>

     ; ...

     ~~~~~~~