Hello everybody
what is .if !
I google and turn up nothing. I been thinking it mean... if question or if error. I want to convert it to cmp but I don't know what it is and don't want to fool myself :( Thanks in advance for any info about this.
.if !NoRect
push edx
push offset RECT
Call GetClientRect
.endif
........................
cmp eax, NoRect
jxx
It may be too early in the morning but it looks like an "IF NOT".
It's getting late here in COLT's city... 7:10pm I had the code backward...
NOT is a big word -- heavy math to me. Thanks a lot, This going to be fun tonight.
.if !NoRect
push offset RECT
push edx
Call GetClientRect
.endif
Here is a small list of operator
Operator Meaning
== Equal
!= Not equal
> Greater than
>= Greater than or equal to
< Less Than
<= Less than or equal to
& Bit test
! Logical NOT
&& Logical And
|| Logical OR
i hope its all correct :lol
greets,
ragdog
!= Not equal
I found a few list on google but NOTHING but nothing had that statement.
Thanks ragdog
can you post this link?
Equivalent to .if NoRect == 0
Test yourself...
include \masm32\include\masm32rt.inc
.data
NoRect dd 0
.code
IsNot db "Is Not", 0
IsElse db "Second branch", 0
AppName db "Test IsNot:", 0
start:
mov NoRect, -1
.if !NoRect
invoke MessageBox, NULL, addr IsNot, addr AppName, MB_OK
.else
invoke MessageBox, NULL, addr IsElse, addr AppName, MB_OK
.endif
mov NoRect, 0
.if !NoRect
invoke MessageBox, NULL, addr IsNot, addr AppName, MB_OK
.else
invoke MessageBox, NULL, addr IsElse, addr AppName, MB_OK
.endif
mov NoRect, 1
.if !NoRect
invoke MessageBox, NULL, addr IsNot, addr AppName, MB_OK
.else
invoke MessageBox, NULL, addr IsElse, addr AppName, MB_OK
.endif
exit
end start
I been re--searching the minute you posted and I can't find it. I saw it at two places that was missing NOT ! for sure ...
It was on google or yahoo within the first 7 pages. I hit it on my 5th click... I only used these and went no where else. Npw I can't even find it.
.if ".if !"
and
.if
These don't have it but is interesting
http://www.w3schools.com/JS/js_if_else.asp
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/if.html&http://www.google.com/search?hl=en&ie=ISO-8859-1&q=.if+%21&btnG=Google+Search
http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/chap03/nest-if.html
When I find it I will post it.
Anyway how do I tranlate a Logical NOT to cmp ... I'll be searching for that now, anyway, this way I might run into thoses pages again before mid-night. It sitting near ... I knew this night was going to be fun and educational :) math
ic2,
Cheat, write the .IF ! code then disassemble it. :bg
Operator ! (http://msdn.microsoft.com/en-us/library/dfstsw6t(VS.71).aspx)
I founded out what the jxx was for .WHILE, .REPETE, UNTIL question
last year or two. I was amazed. I got that from you with out the
word cheat. That was the first and near last time I played with the
de-asemmbler. Why? I don't have a clue. Just silly at times I
guest.
Wow... Thanks for the reminder hutch
QuoteEquivalent to .if NoRect == 0
Test yourself...
Just that simple. The kind of math I know and enjoy :) Now that I got kick back to the right track I'm going to be alright again. I'm crazy about those jxx loops like most of us who enjoy assembler. I still stuck on the baby stuff but hey it beats the rest ...
Thanks jj2007
PS: It is ashame that even google don't have a ton worth of Operators for (.if) I am happy I choose Delphi than jumped into ASM. Anytime HOT and simple C Operators can't be founded on the .NET there nothing left but .NEXT to confuss the next generation of coder, all over again. Greg every time I got to that sight I get nothing but a half of page, with no strolling. My machine or , ISP connect must be jack-up for me only. 3 machines, same results.
I will find all hidden pages, with code and why. :)[/size]
The best to you ALL
Quote from: ic2 on August 05, 2008, 01:50:45 AM
QuoteEquivalent to .if NoRect == 0
Test yourself...
Just that simple. The kind of math I know and enjoy :)
Just not that simple. .: check the third branch:
mov NoRect, 1
.if !NoRect
Masm says no, condition not true - so this is not the binary
not operator, which would yield -2 aka "condition is true"
Hi,
ok, the question "what is .if !" has been answered, but another question still is open: "what is .if <nothing>?"
Because, this code
.if
mov eax,1
.endif
.while
mov eax,1
.endw
assembles without error, but it is unclear what Masm thinks about the void behind the hll directive. Because the instruction between .if/.endif is generated and will be executed, so <void> is similar to 1 here. However, the instruction between .while/.endw, is never executed, so apparently <void> here means 0?
Quote from: japheth on August 05, 2008, 08:29:56 AM
Because the instruction between .if/.endif is generated and will be executed, so <void> is similar to 1 here. However, the instruction between .while/.endw, is never executed, so apparently <void> here means 0?
See below. I put
mov eax, eax dummies to make reading easier. Basically, Masm ignores the empty .if and .while, which means:
- the .if branch is taken until the .else is encountered
- the .While is not taken, because by design a .While loop starts with a jmp to the end.
mov NoRect, 1 ; MOV DWORD PTR DS:[403000],1
; CMP DWORD PTR DS:[403000],0
.if !NoRect ; JNE ..
inc esi ; first branch
.else
dec esi ; second branch
.endif
mov eax, eax ; dummy for Olly
.if
inc esi
.else
dec esi
.endif
mov ebx, ebx ; dummy for Olly
mov ecx, ecx ; dummy for Olly
.While
inc esi
.endw
mov edx, edx ; dummy for Olly
pop esi
exit
end start
C705 00304000 MOV DWORD PTR DS:[403000],1
833D 00304000 CMP DWORD PTR DS:[403000],0
75 03 JNE SHORT 004010BA
46 INC ESI
EB 01 JMP SHORT 004010BB
4E DEC ESI
8BC0 MOV EAX,EAX
46 INC ESI
EB 01 JMP SHORT 004010C1
4E DEC ESI
8BDB MOV EBX,EBX
8BC9 MOV ECX,ECX
EB 01 JMP SHORT 004010C8
46 INC ESI
8BD2 MOV EDX,EDX
Quote from: jj2007 on August 05, 2008, 09:06:23 AM
See below. I put mov eax, eax dummies to make reading easier. Basically, Masm ignores the empty .if and .while, which means:
- the .if branch is taken until the .else is encountered
- the .While is not taken, because by design a .While loop starts with a jmp to the end.
Thanks! That helped a lot. Didn't know that anything in Masm is implemented "by design". :U
Quote from: japheth on August 05, 2008, 10:12:47 AM
Didn't know that anything in Masm is implemented "by design". :U
mov esi, 4
.While esi<3
inc esi
.Endw
...translates to:
mov esi, 4
jmp L2
L1: inc esi
L2: cmp esi, 3
jb L1
Show me how to make it shorter and/or more efficient.
Quote from: jj2007 on August 05, 2008, 10:22:31 AM
mov esi, 4
jmp L2
L1: inc esi
L2: cmp esi, 3
jb L1
Show me how to make it shorter and/or more efficient.
Perhaps this way?:
mov esi, 4
jmp L2
L1: inc esi
cmp esi, 3
jb L1
L2:
Why do you ask?
Quote from: japheth on August 05, 2008, 11:10:57 AM
Perhaps this way?:
mov esi, 4
jmp L2
L1: inc esi
cmp esi, 3
jb L1
L2:
Will work perfectly but requires an intelligent compiler knowing in advance that the loop will never be touched :toothy
Quote
Why do you ask?
> Didn't know that anything in Masm is implemented "by design"
Because you expressed doubts on the ability of Masm authors to design their tool. Remember it was invented a long time before the BloatOS era. Those guys still had control over their code.
> Because you expressed doubts on the ability of Masm authors to design their tool.
> Remember it was invented a long time before the BloatOS era. Those guys still had control over their code.
Yes, but be aware that Masm exists since 1981. It might have been "well-designed" in the beginning, but if you are experienced in software development you will know that quality of a project's software tends to decrease and it might become a mess eventually, virtually unmaintainable.
Still can't find any kind of listing but ...
operator (!) is a Logical NOT
http://www.google.com/search?q=Logical+NOT&hl=en&btnG=Search
QuoteStill can't find any kind of listing but ...
Well, I gave you the link, but you said you couldn't load it. Here's what it says:
Microsoft Macro Assembler Reference
operator !!expressionLogical negation. Used only within .IF, .WHILE, or .REPEAT blocks and evaluated at run time, not at assembly time.
No. I was looking for the list that ragdog requested. I lost the only two links that I did find last night during the heat of my seach before posting. Nither had what I was looking for (!) so I keep seaching.
I think I see now. In masm it's represent Logical negation. In java or C it represent Logical NOT. That's why jj said *NOT is not a NOT*.QuoteMasm says no, condition not true - so this is not the binary not operator, which would yield -2 aka "condition is true"
Time to test all of above than go find me a new Service Provider
Quote from: ic2 on August 05, 2008, 05:39:12 PM
Still can't find any kind of listing but ...
operator (!) is a Logical NOT
Download the Programmer's Guide (http://www.masm32.com/board/index.php?topic=5433.msg70110#msg70110), go to Chapter 7, and find this:
Expression OperatorsThe binary relational operators in MASM 6.1 are the same binary operators used in C. These operators generate MASM compare, test, and conditional jump instructions. High-level control instructions include:
Operator Meaning
== Equal
!= Not equal
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
& Bit test
! Logical NOT
&& Logical AND
|| Logical OR
To make it crystal clear: Logical not means "take the first branch if the operand is zero". I prefer the syntax
.if operand==0, also because it is easy to overlook a
! in .if !operand