flat assembler
Message board for the users of flat assembler.

Index > Windows > Bug in tutorial code

Author
Thread Post new topic Reply to topic
casey



Joined: 18 Aug 2005
Posts: 35
casey
When I copied Sulaiman Chang's version of Iczelion's
the Mouse Input tutorial 7 it failed to work.

I tracked the problem down, as shown below, in case
Sulaiman wants to correct it.

...

wmLBUTTONDOWN:
;low order lParam = x
;high order lParam = y
mov eax,[lParam]
add eax,0xFFFF
^^^

should be,

and eax,0xFFF
^^^

Regards,

John Casey

email: jgkjcasey at yahoo.com.au
Post 21 Sep 2005, 06:45
View user's profile Send private message Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
hi casey,
sorry for the bug.
i just correct it. thank you
Post 21 Sep 2005, 09:55
View user's profile Send private message Visit poster's website Reply with quote
snifit



Joined: 10 Dec 2004
Posts: 12
Location: Sweden
snifit
If you have lParam (32 bits) and want the lower 16 and the higher 16 bits, then you can also do it this way:

Code:
virtual at lParam
  lParamlow dw ? ; The lower 16 bits
  lParamhiw dw ? ; The higher 16 bits
end virtual    


No idea which method that is fastest though, but doing it this way does however save you some code.
Post 07 Oct 2005, 15:26
View user's profile Send private message Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
In such code of window procedures speed actually dones't matter. You can also write:

Code:
movzx eax,word[lparam]    ; get low word
movzx eax,word[lparam+2] ; get hi word    
Post 07 Oct 2005, 15:38
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.