flat assembler
Message board for the users of flat assembler.

Index > Main > Can't assemble certain "hybrid" instructions!

Author
Thread Post new topic Reply to topic
Cas



Joined: 26 Feb 2004
Posts: 82
Location: Argentina
Cas
I've realized that there are certain instructions (that I never use myself) do not seem to assemble with FASM. For example, with DOS DEBUG, you have a difference between these two instructions, but FASM only has one. See, if you assemble this with DOS DEBUG:

cmp word ptr [0100h],1

you get

cmp word ptr [0100h],+1

which is opcode 83 3e 00 01 01

If I attempt to assemble the same thing in FASM, with the proper syntax, that is:

cmp word [0100h],1

I get opcode 81 3e 00 01 01 00

In DOS DEBUG, we can force such an opcode by assembling:

cmp word [0100h], word 1

So I understand that FASM makes default in "word" for this instruction. But when I try to assemble this in FASM:

cmp word [0100h],byte 1

I get an error message telling me that operator sizes mismatch.

HOW CAN I GET THAT INSTRUCTION ASSEMBLED WITH FASM????? Sad[/i]

_________________
«Earth is my country; science is my religion» - Christian Huygens
Post 28 Apr 2006, 07:39
View user's profile Send private message Yahoo Messenger MSN Messenger Reply with quote
vbVeryBeginner



Joined: 15 Aug 2004
Posts: 884
Location: \\world\asia\malaysia
vbVeryBeginner
i tried,
Code:
cmp byte [0100h],1
    

and i got
80 3E 00 01 01 --- CMP BYTE PTR [0100],01
in debug.
Post 28 Apr 2006, 08:45
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
vbVeryBeginner, but that is not the same, you are comparing just one byte against 1 instead of a word against 1.

Anyway with "cmp word [0100h], 1" I get

83 3E 00 01 01 CMP WORD PTR [0100],+01

I'm using FASM 1.65.21
Post 28 Apr 2006, 10:39
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7755
Location: Kraków, Poland
Tomasz Grysztar
Yes, "cmp word [0100h],1" makes:
83 3E 00 01 01
unlike what Cas wrote.

And it's "cmp word [0100h],word 1" that makes:
81 3e 00 01 01 00
Post 28 Apr 2006, 13:44
View user's profile Send private message Visit poster's website Reply with quote
Cas



Joined: 26 Feb 2004
Posts: 82
Location: Argentina
Cas
You're right. I'm using an older version of FASM! I'll try the new one

Anyway, now that I'm here, let me give you a different example:

what about:

add sp,+1

where +1 is stored as a byte in DEBUG? I have not tested this one in FASM, but I expect the same as with the other one. I am going to test both with the new one. If it works fine with FASM 1.65.21, please ignore my post.

I appreciate you help very much, guys.
Post 29 Apr 2006, 04:00
View user's profile Send private message Yahoo Messenger MSN Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7755
Location: Kraków, Poland
Tomasz Grysztar
Even with older versions of fasm it was exactly the same way - you must have done something wrong if you've got different result.
The "add sp,1" makes shorter form, while "add sp,word 1" forces the longer one. See fasm's manual, section 1.2.6.
Post 29 Apr 2006, 08:59
View user's profile Send private message Visit poster's website Reply with quote
Cas



Joined: 26 Feb 2004
Posts: 82
Location: Argentina
Cas
You're right. I've found what I did wrong.Sorry for the false alarm, and thank you so much for your assistance!
Post 04 May 2006, 05:22
View user's profile Send private message Yahoo Messenger MSN Messenger 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.