Hi all,

i want to write (pure-asm) this code  without if statements, i tried but i couldn't...please, tell me what should i do...by the way, my english is not very good, sorry for that :)


.if eax>ebx
.if eax>ecx
jmp eaxMax
.endif
.endif

.if ebx>eax
.if ebx>ecx
jmp ebxMax
.endif
.endif

.if ecx>eax
.if ecx>ebx
jmp ecxMax
.endif
.endif

Posted on 2010-08-25 10:31:16 by oxbo
You should assemble the code as it is, and then open the resulting binary executable in a debugger (or just a disassembler). I would recommend OllyDBG, it's ugly but it's free and works pretty well, and supports "JIT" (Just In Time) debugging, which means that the debugger will open whenever an application crashes or reaches an INT 3 (step breakpoint) instruction.
If it's part of a very big program, just add an INT 3 to the start of this part of the sourcecode, enable JIT in olly, and run your program.

Now look at what the assembler (masm, I suppose) has produced.
There is your 'pure asm' - stare at it, look at how it works, and then modify your sourcecode accordingly.
Now you've learned what the .IF statements are producing, you can do it yourself.
There's not a lot to gain from this, but it is certainly educational, and it's good to know what these 'macros' are really doing.

(Some people would say that's not a macro - it's a highlevel directive - I fail to see any difference.)
Posted on 2010-08-25 10:51:27 by Homer
If you insist on writing it in "pure asm", instead of using the macros, you can write something like this:
MOVD xmm0, eax
MOVD xmm1, ebx
PMAXUD xmm0, xmm1
MOVD xmm1, ecx
PMAXUD xmm0, xmm1
MOVD eax, xmm0

I surmise that learning what the above means will be educational for you, as well as what Homer suggested.
Posted on 2010-08-25 10:57:06 by ti_mo_n

You should assemble the code as it is, and then open the resulting binary executable in a debugger (or just a disassembler). I would recommend OllyDBG, it's ugly but it's free and works pretty well, and supports "JIT" (Just In Time) debugging, which means that the debugger will open whenever an application crashes or reaches an INT 3 (step breakpoint) instruction.
If it's part of a very big program, just add an INT 3 to the start of this part of the sourcecode, enable JIT in olly, and run your program.

Now look at what the assembler (masm, I suppose) has produced.
There is your 'pure asm' - stare at it, look at how it works, and then modify your sourcecode accordingly.
Now you've learned what the .IF statements are producing, you can do it yourself.
There's not a lot to gain from this, but it is certainly educational, and it's good to know what these 'macros' are really doing.

(Some people would say that's not a macro - it's a highlevel directive - I fail to see any difference.)



thanks for your reply, as you said, i want to know what these marcos are really doing, and i learned with your help and i found a bug :) thank you so much :)

with regards,
oxbo
Posted on 2010-08-25 11:14:39 by oxbo