flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > if macro changes |
Author |
|
farrier 06 Oct 2006, 22:07
madmatt,
You can use: Code: .if eax, l, 250 ... .endif where l is the equivalent of less than and is converted to jnl to skip over the code between the .if and the .endif Then use a and b (for ja and jb) for unsigned comparisons and l and g (for jl and jg) for signed comparisons This code: Code: include 'win32ax.inc' start: mov eax, 251 .if eax, a, 250 invoke MessageBeep, 0 .endif ret .end start Gets assembled to: Code: 00401000 > B8 FB000000 MOV EAX,0FB 00401005 3D FA000000 CMP EAX,0FA 0040100A 76 08 JBE SHORT TestIF.00401014 0040100C 6A 00 PUSH 0 0040100E FF15 3C204000 CALL DWORD PTR DS:[<&USER32.MessageBeep>>; USER32.MessageBeep 00401014 C3 RETN Or use: Code: .if signed eax > 256 ... .endif hth, farrier _________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||
06 Oct 2006, 22:07 |
|
madmatt 06 Oct 2006, 22:55
hmmmm, looks like ".if signed eax > 256" is what I'm looking for, I'll give it a try.
many thanks, farrier [EDIT] It works, but how would I get it to default to signed comparisons? So I won't have to use the signed parameter |
|||
06 Oct 2006, 22:55 |
|
LocoDelAssembly 06 Oct 2006, 23:51
Not sure but try this
Code: ; after including the "standard" macros macro .if [args] { .if signed args } |
|||
06 Oct 2006, 23:51 |
|
farrier 07 Oct 2006, 03:03
madmatt,
You could look at the: Fasm\INCLUDE\MACRO\IF.inc file, and see how the signed argument is used. You could "roll your own" IF.inc and change it so that you would have to use "unsigned" instead of signed to specify an unsigned comparison. It feels wrong to me to change something like this, but that's just me. Something like what locodelassembly suggested would be better, where you would leave the "source" alone and add a macro in your own madmatt.inc file. farrier _________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||
07 Oct 2006, 03:03 |
|
dead_body 07 Oct 2006, 11:12
to locodelassembly:
in your code you miss "common" directive. |
|||
07 Oct 2006, 11:12 |
|
madmatt 12 Oct 2006, 09:58
locodelassembly:
The macro doesn't work for this: .if eax, e, WM_USER |
|||
12 Oct 2006, 09:58 |
|
LocoDelAssembly 12 Oct 2006, 13:52
And doesn't works with things like ".if eax > ebx & ecx < edx" because the "ecx < edx" is a unsigned comparison. Sorry, I don't know how to do this without modifying if.inc
|
|||
12 Oct 2006, 13:52 |
|
madmatt 14 Oct 2006, 07:42
I'll have another look at the macro and see what I can do. The macro is quite complex though (in my opinion).
|
|||
14 Oct 2006, 07:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.