flat assembler
Message board for the users of flat assembler.

Index > Windows > Message procedure

Author
Thread Post new topic Reply to topic
Da Vinci



Joined: 31 Jul 2005
Posts: 1
Da Vinci 31 Jul 2005, 11:03
Original Masm32 code:
.WHILE TRUE
INVOKE GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
INVOKE TranslateMessage, ADDR msg
INVOKE DispatchMessage, ADDR msg
.ENDW

FASM code:
.while TRUE <--------ERROR (Why?)
invoke GetMessage,Msg,NULL,0,0
or eax,eax
je .exit
invoke TranslateMessage,Msg
invoke DispatchMessage,Msg
.endw
.exit:
Why does not work?
Please, give me examples!!!!
Post 31 Jul 2005, 11:03
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 31 Jul 2005, 15:28
Remove TRUE, the .endw will generate a jump to "invoke GetMessage" giving you an infinite while loop

Code:
.while

  invoke GetMessage,Msg,NULL,0,0
  or eax,eax
  je .exit
  invoke TranslateMessage,Msg
  invoke DispatchMessage,Msg

.endw
.exit:    
Post 31 Jul 2005, 15:28
View user's profile Send private message Reply with quote
Ancient One



Joined: 28 Feb 2005
Posts: 55
Ancient One 01 Aug 2005, 01:21
Fasm .while is a macro that resolved to testing the argument using asm instruction (i.e cmp).. thats why u cannot use constant as argument.
Post 01 Aug 2005, 01:21
View user's profile Send private message MSN Messenger Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 01 Aug 2005, 01:41
Ancient One wrote:
Fasm .while is a macro that resolved to testing the argument using asm instruction (i.e cmp).. thats why u cannot use constant as argument.


Partially true, if you put a constant on the right it compiles. For example ".while eax=0" works but ".while 0=eax" not (at least in Fasm 6.2 package)
Post 01 Aug 2005, 01:41
View user's profile Send private message Reply with quote
Ancient One



Joined: 28 Feb 2005
Posts: 55
Ancient One 01 Aug 2005, 01:46
i mean a constant by itself.
Post 01 Aug 2005, 01:46
View user's profile Send private message MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 01 Aug 2005, 09:02
I updated the IF.INC to do well also in such case -please try with the latest fasm for Windows package.
Post 01 Aug 2005, 09:02
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.