| 
                  asmgges
                  
 
 Joined: 17 Jun 2003
 Posts: 86
 Location: France
 | Hi!     
new hll .on
 
.on v1 cond v2, instruction
 
.on cond, instruction
 
If condition is TRUE, instruction after the comma IS executed
 
And program continues in the following line
 
If condition is FALSE, instruction after the comma is NOT executed
 
Program continues in the following line
 
" .on " replace on a single line the macro ".if / .endif" on three lines:
 
.if v1 cond v2
 
    Instruction
 
.endif
 
Or
 
.if cond
 
    Instruction
 
.endif
     
;==========================================================================
; Hll .on
; AsmGges @2005
; .on replace on a single line the macro .if/.endif on three lines:
;   
; If condition is true, instruction after the comma IS executed
; And program continues in the following line
;
; If condition is false, instruction after the comma is NOT executed
; Program continues in the following line
;
; instruction: instruction op1,op2
;              instruction op
;              stdcall proc,param1,param2,....
;              call ....
;              invoke .....
;              ect.....
;Example:
;
;  invoke CreateWindowEx,0,ClassName,WinCaption,WS_POPUP+WS_VISIBLE,\
;                        0,0,0,0,0,0,[hinstance],0
;  .on eax = 0, stdcall ErrorProgram,MsgCreateWinError
;   mov [hWnd],eax
;
;==========================================================================
; UNSIGNED
; .on v1 = v2,   instruction
; .on v1 <> v2,  instruction
; .on v1 > v2,   instruction
; .on v1 >= v2,  instruction
; .on v1 < v2,   instruction
; .on v1 <= v2,  instruction
; SIGNED
; .on v1 s< v2,  instruction
; .on v1 s<= v2, instruction
; .on v1 s> v2,  instruction
; .on v1 s>= v2, instruction
; REGISTER
; .on reg,   instruction
; .on [reg], instruction
; VARIABLE
; .on [var], instruction
;==========================================================================
macro .on [args]
{   common
    local ..on
    __ON equ ..on
    match =ARGS v1=s>==v2 =, inst, ARGS args  ; .on v1 s>= v2, instruction
    \{  cmp v1,v2
        jl __ON
        inst
        ARGS equ  \}
    match =ARGS v1=s<==v2 =, inst, ARGS args  ; .on v1 s<= v2, instruction
    \{  cmp v1,v2
        jg __ON
        inst
        ARGS equ  \}
    match =ARGS v1=s<v2 =, inst, ARGS args    ; .on v1 s< v2, instruction
    \{  cmp v1,v2
        jge __ON
        inst
        ARGS equ  \}
    match =ARGS v1=s>v2 =, inst, ARGS args    ; .on v1 s> v2, instruction
    \{  cmp v1,v2
        jle __ON
        inst
        ARGS equ  \}
    match =ARGS v1>==v2 =, inst, ARGS args    ; .on v1 >= v2, instruction
    \{  cmp v1,v2
        jb __ON
        inst
        ARGS equ  \}
    match =ARGS v1<==v2 =, inst, ARGS args    ; .on v1 <= v2, instruction
    \{  cmp v1,v2
        ja __ON
        inst
        ARGS equ  \}
    match =ARGS v1==v2 =, inst, ARGS args     ; .on v1 = v2, instruction
     \{ cmp v1,v2
        jne __ON
        inst
        ARGS equ  \}
    match =ARGS v1<>v2 =, inst, ARGS args     ; .on v1 <> v2, instruction
    \{  cmp v1,v2
        je __ON
        inst
        ARGS equ
         \}
    match =ARGS v1>v2 =, inst, ARGS args      ; .on v1 > v2, instruction
    \{  cmp v1,v2
        jbe __ON
        inst
        ARGS equ  \}
    match =ARGS v1<v2 =, inst, ARGS args      ; .on v1 < v2, instruction
    \{  cmp v1,v2
        jae __ON
        inst
        ARGS equ  \}
    match =ARGS v =, inst, ARGS args  ; .on reg/var, instruction
   \{  if v eqtype 0
           if ~ v
              jmp __ON
           end if
        else if v eqtype eax
           test v,v
           jz __ON
        else
           cmp v,0
           je __ON
        end if
        inst
        ARGS equ  \}     
    __ON:
    restore __ON
    restore ARGS   }   
;==========================================================================
    
Friendly...AsmGges
 Last edited by asmgges on 24 Dec 2005, 09:13; edited 2 times in total
 |