flat assembler
Message board for the users of flat assembler.

Index > Main > Problem with 16/32 bit mode code

Author
Thread Post new topic Reply to topic
faser



Joined: 03 Oct 2010
Posts: 4
faser 03 Oct 2010, 13:18
Hello,

I've downloaded the DLL version of FASM and fired up the ASM demo program.
When I encode: "xor eax, eax" I get "66 31 C0" which is "xor ax, ax"!

Am I missing something or is this a major bug?

Thank you.
Post 03 Oct 2010, 13:18
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20445
Location: In your JS exploiting you and your system
revolution 03 Oct 2010, 13:32
Code:
use32
xor eax,eax ;31 C0
xor ax,ax ;66 31 C0
use16
xor eax,eax ;66 31 C0
xor ax,ax ;31 C0    
By default fasm starts in 16 bit mode. Which you will need to change to 32 bit mode if that is what you need.
Post 03 Oct 2010, 13:32
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4353
Location: Now
edfed 03 Oct 2010, 13:43
revolution wrote:
Code:
use32
xor eax,eax ;31 C0
xor ax,ax ;66 31 C0
use16
xor eax,eax ;66 31 C0
xor ax,ax ;31 C0    
By default fasm starts in 16 bit mode. Which you will need to change to 32 bit mode if that is what you need.


this is due to the PC compatible, it start by default in 16 bit mode, then, fasm too is in 16 bit mode by default.
Post 03 Oct 2010, 13:43
View user's profile Send private message Visit poster's website Reply with quote
faser



Joined: 03 Oct 2010
Posts: 4
faser 03 Oct 2010, 13:46
Thanks a lot for your help.
Post 03 Oct 2010, 13:46
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.