Is it true that tasm is faster than masm? The only advantage i can see it having would be speed, but i can't think of why. Instead of using invoke in masm can I push the parameters and then call the function instead? And instead of using .if can i just test/cmp and then jz..etc? Btw, is it test or cmp you use for that?? I haven't seen compare used in a while. Are they the same? is test a pseudo-command? I like pushing and calling instead of invoking and i don't like to use .if etc.. I want to get better with asm before i start doing that.. matt the perpetually confused
Hi, from my knowledge about basic ASM (sorry I can't look it up yet, I am not on my home PC) I think the difference between test and cmp is that cmp has three letters and test ... NO, forget about that :) I think I can remember that test and cmp tackle the ZERO FLAG differently.
So if the test is successful (the values are equal) then the ZERO Flag is set and the JZ (Jump if zero) reacts. I think CMP does it differently.
test al,al jz Some_Location
So it uses another condition. I know this is somehow not structured but I am tired and I go to bed now. Maybe another guru *lol* can explain that again.
cmp al,al je Some_Location
Instead of using invoke in masm can I push the parameters and then call the function instead? And instead of using .if can i just test/cmp and then jz..etc?Yes, you can. But I don't see any advantage in doing that except when you desperately want to optimize several calls in succession. "invoke" translates directly to "call": there is no overhead. invoke GetModuleHandle,0 is translated to: push 0 call GetModuleHandle ".if" is translated to "cmp" instruction combined with "jz/jnz".
Btw, is it test or cmp you use for that?? I haven't seen compare used in a while. Are they the same? is test a pseudo-command?"test" is a CPU instruction: it's not a macro.
Ok, i think cmp ah, al would 'subtract' al from ah and set the flags accordingly. So after that if they were equal you would jz*. And I think I remember from when I unsucessfuly tried to learn to 'crack' there were a lot of test your-password, expected-password.. and then je's. After supper I'll try and find the answer. Does anybody know if there is a speed difference between Tasm and Masm? Masm has waay more support and better (imho) include files.. (headers??) So then my reasoning is the one that doesn't seem as good must be faster..;) I think i read in a dos asm book i had that a pseudo-command is something the assembler translates into something else. Like invoke into call.. I guess *shrug*. Matt, new to asm! * I'm aware that jz isn't a verb :p This message was edited by matthew, on 5/2/2001 8:33:12 PM
Matt, ------------------------------------------ Is it true that tasm is faster than masm? ------------------------------------------ In a word, no, at close range with instructions, there is no difference, a push is a push, in MASM or TASM, same with any other instruction. The pseudo high level syntax that both MASM and TASM have available are in most instances as fast as manually constructing the comparisons but a LOT clearer to code and with a lot less errors. What I would recommend is use the pseudo high level constructions first to get your code up and going and then on a needs basis, change what you think may be speed critical to manual comparisons. In relation to the choice of CMP against TEST, CMP is more flexible and it also pairs better than TEST which is important when you are writing speed critical code. The choice of which assembler you use in win32 is straight forward enough on technical grounds, MASM builds COFF format files where TASM still uses the older OMF file format so almost exclusively, MASM builds smaller EXE files and DLLs than TASM. MASM can easily handle much larger include files than TASM, it does not have restrictions on the names of structure members and it is a current assembler that is simply a lot more powerful than TASM while building smaller files. What you will find Matt is that there is a lot of folklore attached to writing assembler and it comes from the old devotees of TASM who have failed to adapt to the more powerful capacity of MASM. Hard objective comparison tells the story, you can play with TASM but with MASM you can write working applications within a reasonable timeframe. Regards, firstname.lastname@example.org
TEST is just like AND, except that it doesn't change the operands. It only changes the flags. =)
------------------------------------------ Is it true that tasm is faster than masm? ------------------------------------------ YES YES YES it is very much faster... In my big RTS game project a compile with MASM takes about 2 minutes to complete and a compile with TASM takes about 1-2 seconds :) !!!!! this saves out team a lot of time every day because we compile a lot (100 times at day at least) to keep everything working ;) of course the generated code work pretty much at the same speed :) when they say TASM is faster they speak of "compile time" not "execution time" for INVOKE ...well in tasm tou can use "CALL" in the same way as INVOKE :) no push just a: CALLL MessageBoxA,param1,param2,param3 etc Also .IF .ENDIF .ELSE .WHILE work in TASM 5.0 just like in MASM therea are some OOP stuff in TASM also that MASM dosent have...but i never used them ... (only now started to check it out ;) ) the only problem in TASM is with outdated include files for DirectX and stuff but one can easy recreate them from the MASM ones ;)... and some stupid fact in structures : you can not use the same name again for o structure member ... i belive...so in include files you will offten see structure member prefixed with structure name to make them unique.. (i like that)
The difference between TEST and CMP and all logic opcodes. The short of the long here is that TEST is to AND is CMP is to SUB. How I will explain. Any instruction that modifys the flags via a logic or arthmitic operation (Im not talking about a BTC or POPF instructions here) use a simple, extremly well throught out method that makes up part of what Intel Archtechure is. Whenever you CMP something, what happens? The CPU obviously doesn't make a bit to bit comparasion, so how does it know which flags to set. Its actualy quite simple, it performs a subtract operation, but does not update the destination operand. For example:
cmp eax,10 je @F
are exactly the same in every respect except subtract will actualy subtract 10 from eax. Check it out: IF eax==10, SUB EAX,10 ZF=1 IF eax!=10, SUB EAX,10 ZF=0 And then if you look at the condition jumps, je, is jump if ZF=1. Simple, just like that. The way a Instruction like TEST or AND etc, works, is that it performs the operation, the computes the SUB of the result from 0 and updates the flags. e.g.
sub eax,10 je @F
and eax,10 jz @F
Are very much the same. And getting on to TEST, TEST works the same way as AND except it doesnt update the destintion, in the same way CMP doesn't update the destination while sub does. So if you think about this, that is why OR EAX,EAX is equal to CMP EAX,0
and eax,10 sub eax,0 jz @F
1) A pseudo-command is also called a pseudo-op or a directive. The Intel assemblers (MASM and TASM) call them directives. The primary characteristic is that they don't produce code. Examples of directives: MACRO, END, ASSUME, ORG, STRUCT, PROC, PROTO. 2) TEST sets conditions codes by doing an AND. CMP sets condition codes by doing a SUB. There are differences in the carry and overflow flags.
Well, I have to stand by TASM (after all I bought it!)... One thing about MASM - it seems it is free, but the license says ONLY to develop apps for Windoze! Right now, this seems ok (to many of you folks I guess) but I am an declared adversary of MS (and somehow a fan of Apple and others), so I wouldn't like MS to come and close my license when I am @ 80% completion with a Project! And what about developing your own OS (even just for fun) or going towards Linux(i386)? The rest I think is about style and the way you adjust to your tools & ...; But the legal considerations must be taken into account. That's all for know.
cristio: One thing about MASM - it seems it is free, but the license says ONLY to develop apps for Windoze!How will MS know that you use masm to create app for other OS? They're going to decompile your source?