Author Topic: character values?  (Read 12089 times)

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: character values?
« Reply #15 on: June 22, 2012, 12:04:41 AM »
it could probably be MOVZX, in the case of WM_LBUTTONDOWN type messages
as i recall, they can be negative for WM_MOUSEMOVE, though

jannes braet

  • Guest
Re: character values?
« Reply #16 on: June 22, 2012, 01:16:45 AM »
Code: [Select]
word ptr lParamwhat does it mean i have never seen something like this. probably i am just following a bad tutorial. can someone tell me a nice tutorial to learn asm?

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: character values?
« Reply #17 on: June 22, 2012, 02:39:58 AM »
the MOVSX and MOVZX instructions sign-extend or zero-extend a word or byte into a dword register
in the case of wParam and lParam, these parameters are defined as dword's (or dword size, at least)
so - if you want a word from one of those parms, you have to tell the assembler to over-ride the size
Code: [Select]
        movsx     eax,word ptr wParam      ;sign-extends the low word of wParam into EAX
        movzx     eax,word ptr wParam+2    ;zero-extends the high word of wParam into EAX
otherwise, you will get an error like "operand sizes must match" or "invalid operand"

if the parameter or variable is defined as a word or byte, then you do not need the "ptr" operator
the assembler knows which form of the instruction to use