flat assembler
Message board for the users of flat assembler.

Index > Main > Incompatibilities

Author
Thread Post new topic Reply to topic
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Hi,

Im new to Assembler, and a friend recomended me this assembler, FASM. So to try it I looked for an example, and I found that one (http://www.grifo.com/EXAMPLES/ASM/GPC_F2/uk_S1deb1.txt). So I compiled and it shows me an error: ERROR: INVALID OPERAND.

So I didnt understand which was the matter so I downloaded another compiler(MASM), and it worked with the example.

Do you know what is happening? Is maybe an incompatibility?

Thanks a lot and excuse me for my english!
Post 06 Jul 2010, 20:07
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Yes, every assembler has its own syntax (although their share a lot in common most of the time, but not all! Wink). Note also that I'm talking only about x86 architecture, if we include other architectures (ARM, PIC, Power, MIPS, etc, etc, etc), then of course you'll find lots of incompatibilities with each other.

The example code you linked doesn't seems to be for an x86 processor. Are you sure you actually managed to compile it with MASM? Where did you run the binary to confirm it actually worked?
Post 06 Jul 2010, 20:33
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Some assemblers even have more than one dialect. Tasm has Masm compatibility mode and Ideal mode. Fasm is like Tasm's Ideal mode.
Post 06 Jul 2010, 20:38
View user's profile Send private message Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Yes, I compiled with MASM, If you want I can show you a ScreenShoot. So I dont know what to do, Im sure that i wont use any assembler for windows, thats clear.

The problem is that I bought a book of learning assembler (x86) and they recommend me MASM. So my question is if I wil have any incompatibility while learning with the book. Shall I use for learning MASM and then go to FASM so I will be able to study his syntax (the user manual dont explains assembler for beginers, i thing it only explains his syntax)

Thanks a lot for your collaboration, LocoDelAssembly and Tyler!

PD: Maybe the example is not written for x86 but MASM compiled it well without any problems...
Post 06 Jul 2010, 21:02
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
After searching one of the instructions I've found this: http://www.keil.com/support/man/docs/is51/is51_sjmp.htm

It is a program for the Intel 8051/MCS 51 architecture (not x86 compatible). I don't know if MASM has any support for this architecture (note that by MASM I mean the Microsoft Macro Assembler, maybe you mean something else?).

If you plan to follow that book then stick to MASM while learning, I think you'll grasp the book better that way (but follow your friend's suggestion afterward! Wink)

BTW, are you learning Assembly to program computers or electronic boards?
Post 06 Jul 2010, 21:48
View user's profile Send private message Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Thanks a lot for your help!

Yep, I will code with Masm32(excuse me, when i said masm i what refered to masm32.com). Then i will go to Fasm(dont worry, i will go to fasm,it seems better)
Im a very young web developer(15 yrs) and i need it because i need speed for a php big project (well i know some languages: php sql javascript css html) the assembler i think is for a library that will recive the parameters and will send to php. The other problem is i havent found anything about making a library with asm...

Thanks a lot and excuse me the language. Im writting from and ipod so it is a little dificult. Tomorrow i will study better the link you gave me. Thanks a lot (are you spanish?)
Post 06 Jul 2010, 22:13
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quote:

are you spanish?

No, Argentinian Wink I do speak Spanish though (well, Castilian to be more -but maybe not fully- precise).
Post 06 Jul 2010, 23:48
View user's profile Send private message Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
I red MASM32 Is the same that MASM, only that the first includes a IDE, and the 2th is by command.

Do you know If the code produced by NASM (http://www.nasm.us/) is fast? I prefer more code and speed that less code but a slowly exe.

Thanks!
Post 07 Jul 2010, 12:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17635
Location: In your JS exploiting you and your system
revolution
farresito wrote:
Do you know If the code produced by NASM (http://www.nasm.us/) is fast?
Erm, what do you mean? In assembly you tell the assembler what code to produce. If the assembled .exe is slow then it is your responsibility to work out how to improve it, the assembler can't help you with that.
Post 07 Jul 2010, 14:37
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
I red MASM32 Is the same that MASM, only that the first includes a IDE, and the 2th is by command.

MASM is compiler by Microsoft. That is basically just one executable. MASM32 is a package of headers, .lib files, examples, tools, etc., by a dude who calls himself "Hutch". MASM32 package includes MASM compiler.
Post 07 Jul 2010, 15:19
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
revolution wrote:
farresito wrote:
Do you know If the code produced by NASM (http://www.nasm.us/) is fast?
Erm, what do you mean? In assembly you tell the assembler what code to produce. If the assembled .exe is slow then it is your responsibility to work out how to improve it, the assembler can't help you with that.


Excuse me, I thought that as some C++ compilers, some assemlers could be better in the exe speed or in the optimization. So, if you code in 2 assemblers with the same code quality, the exe speed is the same?

Thanks Revolution!

PD: Have a look at: http://en.wikipedia.org/wiki/FASM.

As you can read, it says is known for a lot of things. I thought code optimization could have relation with exe speed. (So when it says is know for high speed, is the same as assembling speed, not exe speed?)

Thanks for the time you are taking to reply my posts.

vid wrote:
Quote:
I red MASM32 Is the same that MASM, only that the first includes a IDE, and the 2th is by command.

MASM is compiler by Microsoft. That is basically just one executable. MASM32 is a package of headers, .lib files, examples, tools, etc., by a dude who calls himself "Hutch". MASM32 package includes MASM compiler.

Ok. Thanks, All is clear Wink. I wasnt sure, I only suposed.

Thanks for the time you are taking on it Wink
Post 07 Jul 2010, 18:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17635
Location: In your JS exploiting you and your system
revolution
farresito wrote:
As you can read, it says is known for a lot of things. I thought code optimization could have relation with exe speed. (So when it says is know for high speed, is the same as assembling speed, not exe speed?)
The optimisations provided by fasm do not change the instructions executed, just a few things like choosing the smallest encoding if more than one option is available.

An assembler will never reorder, delete, insert, or in any way change what you write into another form. If you code this:
Code:
mov eax,1
mov eax 2
mov eax,4
mov eax,9
xor eax,eax
inc eax
dec eax    
the assembler will produce precisely those instructions, in the same order, just as you instructed it to.
Post 07 Jul 2010, 18:41
View user's profile Send private message Visit poster's website Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Ok. Thanks revolution. As you may think, Im a total noob, I bought a book and Im learning it.

Thanks!
Post 07 Jul 2010, 19:32
View user's profile Send private message Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Can I create libraries with FASM? I mean, for example, for windows DLLs? And where can I find how to? Thanks a lot! And excuse me for being so stupid^^
Post 08 Jul 2010, 11:43
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Start a new thread for a new question. But since I'm posting I might as well point you to an answer. Smile
http://flatassembler.net/docs.php?article=manual#2.4.2 I should point out that DLLs(or libs in general) are different and more complicated than normal apps.

As for being a noob: You're in good company. There seems to be a continual flow of noobs here. Some stay, some leave after few posts. I stayed. Smile
Post 08 Jul 2010, 11:57
View user's profile Send private message Reply with quote
farresito



Joined: 06 Jul 2010
Posts: 18
farresito
Tyler wrote:
Start a new thread for a new question. But since I'm posting I might as well point you to an answer. Smile
http://flatassembler.net/docs.php?article=manual#2.4.2 I should point out that DLLs(or libs in general) are different and more complicated than normal apps.

As for being a noob: You're in good company. There seems to be a continual flow of noobs here. Some stay, some leave after few posts. I stayed. Smile


Thanks a lot! And yep, I amb a total NOOB, too.

The community can be happy, FASM is the most recommended assembler in ALL forums I have seen Wink. Thats how I arrived here Very Happy. The problem is the book I bought uses MASM syntax so i will need to study it using MASM and then go to FASM Wink
Post 08 Jul 2010, 13:36
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Yeah, Fasm's pretty awesome. I only used it when I was starting out because it had a GUI. That was the only feature I appreciated then. Ironically enough, I only use the command line version now.
Post 08 Jul 2010, 13:56
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.