flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Main > MOVZX AX, BX

Author
Thread Post new topic Reply to topic
l4m2



Joined: 15 Jan 2015
Posts: 570
MOVZX AX, BX
In fasm MOVZX AX,BX compiles error but
In c32asm can get (16B)

Code:

0FB7C3 MOVZX AXBX
0FBFC3 MOVSX AXBX
8BC3   MOV   AXBX
89D8   MOV   AXBX



Do they do the same thing?
Post 06 Jan 2017, 04:34
View user's profile Send private message Reply with quote
Mikl___



Joined: 30 Dec 2014
Posts: 54

Code:
660FB7C3 MOVZX AX,BX
0FB7C3   MOVZX EAX,BX
8D03     LEA EAX,[EBX]=MOV EAX,EBX
678D07   LEA EAX,[BX]=MOVZX EAX,BX
660FBFC3 MOVSX AXBX
0FBFC3   MOVSX EAX,BX

Post 06 Jan 2017, 06:43
View user's profile Send private message Reply with quote
nop



Joined: 01 Sep 2008
Posts: 167
Location: right here left there
movzx & movsx only makes sense if 1st operand has more bits than last operand like movzx eax,bx
Post 06 Jan 2017, 06:46
View user's profile Send private message Reply with quote
Mikl___



Joined: 30 Dec 2014
Posts: 54
nop,
if you write

Code:
db 66h
movzx eax,bx

then you will get

Code:
movzx ax,bx

Post 06 Jan 2017, 06:57
View user's profile Send private message Reply with quote
nop



Joined: 01 Sep 2008
Posts: 167
Location: right here left there
but im saying why would you want movzx ax,bx in the first place? why try to zero extend bits that dont exist Rolling Eyes maybe thats why fasm wont accept it
Post 06 Jan 2017, 19:29
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 6310
Location: Kraków, Poland
Such combination of operands was never listed in Intel manuals, the only ones listed for 32-bit processors were:

Code:
MOVZX r16,r/m8 Move byte to word with zero-extension
MOVZX r32,r/m8 Move byte to doublewordzero-extension
MOVZX r32,r/m16 Move word to doublewordzero-extension

You should be careful with over-interpreting combinations of operands that are not officially defined for instructions, though encodable. For example LDS/LES instructions have only "r,m" combinations defined, though you could theoretically encode "r,r" with the same instruction code. But such combination was never officially defined and years later Intel used the sequences of codes that would correspond to theoretical "LDS r,r" instruction for a very different purpose: these codes are now part of the VEX prefix space for AVX instructions.
Post 06 Jan 2017, 19:48
View user's profile Send private message Visit poster's website Reply with quote
nop



Joined: 01 Sep 2008
Posts: 167
Location: right here left there
yes a very wise precaution tomasz Wink
Post 06 Jan 2017, 20:03
View user's profile Send private message Reply with quote
l4m2



Joined: 15 Jan 2015
Posts: 570

Tomasz Grysztar wrote:


So they behave same now but not later?
p.s. I remember debug.com uses les sp,ax(or anything, i forgot) to have an interrupt?
Post 07 Jan 2017, 02:10
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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.