flat assembler
Message board for the users of flat assembler.

Index > Windows > Bug with 64-bit dword registers in proc64.inc / fastcall?

Author
Thread Post new topic Reply to topic
KingDemon



Joined: 16 Oct 2006
Posts: 21
Location: Somewhere in Romania
KingDemon 18 Feb 2014, 19:09
Hi, I'm getting "Error: operand sizes do not match" on this line of code:
Code:
invoke  wsprintf, rdi, msg, r12d    

I also tried adding the dword size modifier, but still get the error:
Code:
invoke  wsprintf, rdi, msg, dword r12d    

The fastcall macro translates the last parameter to "mov r8b, r12d":
Code:
        else if size@param = 1
         if ~ param eq r8b
          mov r8b,param
         end if
        end if     

I then tracked it down to where size@param was being set:
Code:
        virtual
         origin = $
         inc param
         load opcode byte from origin
         if opcode = 67h; | opcode = 41h
          load opcode byte from origin+1
         end if
         if opcode and 0F8h = 48h
          size@param = 8
         else if opcode = 66h
          size@param = 2
         else if opcode = 0FFh
          size@param = 4
         else
          size@param = 1
         end if
        end virtual    


The commented-out part is my addition to fix the problem. For some reason, the "inc r12d" instruction in this case gets encoded with the 0x41 prefix-opcode added to it.

_________________
Don't mind me! I'm just a crazy next-door neighbor.
Post 18 Feb 2014, 19:09
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 18 Feb 2014, 19:55
You are using an outdated version of fasmw package. This bug had been fixed a few months ago.
Post 18 Feb 2014, 19:55
View user's profile Send private message Visit poster's website Reply with quote
KingDemon



Joined: 16 Oct 2006
Posts: 21
Location: Somewhere in Romania
KingDemon 19 Feb 2014, 20:50
Thanks... I had 1.70.03. Time to update.
Post 19 Feb 2014, 20:50
View user's profile Send private message 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.