News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

what is .if !

Started by ic2, August 04, 2008, 10:54:59 PM

Previous topic - Next topic

ic2

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


hutch--

It may be too early in the morning but it looks like an "IF NOT".
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ic2

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

ragdog

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

ic2

!=           Not equal

I found a few list on google but NOTHING but nothing had that statement.

Thanks ragdog

ragdog

can you post this link?

jj2007

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

ic2

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

hutch--

ic2,

Cheat, write the .IF ! code then disassemble it.  :bg
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

GregL


ic2

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

jj2007

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"



japheth


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?




jj2007

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

japheth

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