flat assembler
Message board for the users of flat assembler.

Index > Main > How To Conveter A 8/16(fx ah/dx) to a 32(fx esi)

Author
Thread Post new topic Reply to topic
gumletis



Joined: 18 Dec 2004
Posts: 128
gumletis
Hi, im working with both, microsoft system and dos, i wanna know how to conveter a 8/16 bit register to a 32 bit... how??? please help
thanks - best regards

_________________
LOOOL
Post 21 Jan 2005, 08:55
View user's profile Send private message Reply with quote
beppe85



Joined: 23 Oct 2004
Posts: 181
beppe85
Depends if the number is signed or not.

Code:
Signed:
movsx eax, al ; move sign-extended

Unsigned:
movzx eax, al ; move zero-extended    


Note that both source and dest registers can be (part of) the same.
Post 21 Jan 2005, 10:33
View user's profile Send private message Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 604
Location: Germany
MCD
for signed registers, you should better use
Code:
cbw
cwde
    
since movsx always fills the operand up with "1"s, ignoring if source operand was actually positive or negative.

Note that these instructions only work for the accumulators. You will have use additional move instructions if you want the result in other registers.
Post 24 Jan 2005, 16:55
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:

since movsx always fills the operand up with "1"s, ignoring if source operand was actually positive or negative.


really?!? i can't believe that. Too bad i can't try now
Post 24 Jan 2005, 22:58
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mike.dld



Joined: 03 Oct 2003
Posts: 235
Location: Belarus, Minsk
mike.dld
Calm down, man Wink movsx fills higher part with source operand' sign bit
See Intel's manual "Volume 1: Basic architecture", Chapter 7.2.1.4, Figure 7-6
Post 24 Jan 2005, 23:14
View user's profile Send private message Visit poster's website ICQ Number 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.