flat assembler
Message board for the users of flat assembler.

Index > Main > [solved] Invalid compilation: OR ecx, 0x10000

Author
Thread Post new topic Reply to topic
GrayFace



Joined: 07 Mar 2015
Posts: 4
GrayFace
The input file consists on 1 line:
or ecx, 0x10000
The output I get is (when decompiled):
or cx, 0
(2 bytes of garbage after that)

What is going on? Maybe FASM dafults to some wacko DOS model of 2-byte registers?
In any case it's going crazy, writing 2 high-order bytes of the operand number as new instruction. I thought a popular assembler wouldn't break in one of the first tests I run.

P.S. Windows, 32 bit, fasm versions tested: 1.71.22 and 1.71.37
Post 07 Mar 2015, 04:17
View user's profile Send private message Reply with quote
GrayFace



Joined: 07 Mar 2015
Posts: 4
GrayFace
And
or ax, 0x8000
turns into
or eax, 0x????8000
Fantastic!
Post 07 Mar 2015, 05:09
View user's profile Send private message Reply with quote
GrayFace



Joined: 07 Mar 2015
Posts: 4
GrayFace
Appending use32 at the beginning have solved the problem.
So, 32/16 bit operation codes are actually swapped in 16-bit mode?
Post 07 Mar 2015, 05:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17717
Location: In your JS exploiting you and your system
revolution
GrayFace wrote:
So, 32/16 bit operation codes are actually swapped in 16-bit mode?
Yes. There is the operand size and address size prefixes. It is all explained in the Intel/AMD manuals.
Post 07 Mar 2015, 07:32
View user's profile Send private message Visit poster's website 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 GitHub, YouTube, Twitter.

Website powered by rwasa.