flat assembler
Message board for the users of flat assembler.
Index
> Windows > IF in Tasm to FASM |
Author |
|
Vortex 21 Feb 2004, 11:22
Did you check Privalov's "if" and other style macros? They come with the Fasmw package:
Code: ; macroinstructions for HLL-style conditional operations macro .if v1,c,v2 { __IF equ local ..endif __ENDIF equ ..endif local ..else __ELSE equ ..else if v2 eq & c eq cmp v1,0 je __ELSE else cmp v1,v2 jn#c __ELSE end if } macro .else { jmp __ENDIF __ELSE: restore __IF __IF equ , } macro .elseif v1,c,v2 { local ..else jmp __ENDIF __ELSE: restore __ELSE __ELSE equ ..else if v2 eq & c eq cmp v1,0 je __ELSE else cmp v1,v2 jn#c __ELSE end if } macro .endif { if __IF eq __ELSE: end if __ENDIF: restore __ELSE restore __ENDIF restore __IF } macro .while v1,c,v2 { local ..while __WHILE equ ..while local ..endw __ENDW equ ..endw __WHILE: if v2 eq & c eq cmp v1,0 je __ENDW else cmp v1,v2 jn#c __ENDW end if } macro .endw { jmp __WHILE __ENDW: restore __ENDW restore __WHILE } macro .repeat { local ..repeat __REPEAT equ ..repeat __REPEAT: } macro .until v1,c,v2 { if v2 eq & c eq cmp v1,0 je __REPEAT else cmp v1,v2 jn#c __REPEAT end if restore __REPEAT } jnne equ je jnna equ ja jnnb equ jb jnng equ jg jnnl equ jl jnnae equ jae jnnbe equ jbe jnnge equ jge jnnle equ jle _________________ Code it... That's all... |
|||
21 Feb 2004, 11:22 |
|
LAS3R 21 Feb 2004, 11:50
Ah thank you!
*Some while later* Hmm can't get it work, compiles correct but program won't run correct, just loop forever and i have to kill it with taskmanager! can u give example how to convert that exempel i gave in first post? *5Min later* Found solution for problem, taken from tasm, if can't get macro work like u want then use this trick! proc DialogProc,hwndDlg,uMsg,wParam,lParam enter push ebx esi edi mov ax,word [uMsg] ; convert to word from dword! cmp ax,WM_COMMAND ;Compare if ax is WM_COMMAND jne IfClose ; No? then jump to next check jmp WMCommand ;Yes? then jump to WMCommand IfClose: cmp ax,WM_CLOSE jne IfInitDialog jmp WMClose IfInitDialog: cmp ax,WM_INITDIALOG jne IfDestroy jmp WMInitdialog IfDestroy: cmp ax,WM_DESTROY jne IfFinish jmp WMClose IfFinish: xor eax,eax jmp Finish This solution will make change appear instant , instead of using button or similar "trigger" function to get result, this trick is useful when u got textbox and want text in it be processed soon as user enter something in textbox! |
|||
21 Feb 2004, 11:50 |
|
Vortex 23 Feb 2004, 10:52
Code:
cmp ax,WM_COMMAND
Code: Masm syntax: .if ax==WM_COMMAND Fasm syntax: .if ax,e,WM_COMMAND _________________ Code it... That's all... |
|||
23 Feb 2004, 10:52 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.