Sign in to follow this  
bla bla

Assembler language

Recommended Posts

hi, I am just starting the assembler language, and I have some issues that I wish you could help me with: 1/ firs of all, I can't understand the compatibility issue. it seems that an assembler language depends on the CPU, but then would I have to write a different code for each CPU? and what is the interest of the assembler language when my application could work on just a specific group of computers?? 2/ the second issue is that there are a whole lot of compilers, (there's MASM, FASM, NASM, ......), so I don't know which one to pick nor the difference. so I woush someone could help me on this, I am so confused, and I need a little push. thanks.

Share this post


Link to post
Share on other sites
Assembly languages are very specific to the processor, because they correspond exactly with that processor's machine code. That's also why you'd usually program in higher level languages. For example, in C++ compilers you can compile the same code for different processors, assuming that you're not using platform specific libraries. That and the fact that Assembly is just plain painful to work with are why you're better off only using Assembly for optimization. If you know what you're doing in Assembly, it can be very fast, but you really, really need to know what you're doing. As to the second question... I don't know from experience, but there shouldn't be much of a difference, excepting perhaps what processor they'll produce an executable for. The term is assembler in this case, not compiler. That's also why there shouldn't be a lot of difference... Assembly code already corresponds exactly with machine code, so as far as I understand it anyway, all an assembler actually does is convert it from ascii text to machine code. Given that, I can't imagine any of those assemblers would be much better to use than any other.

Share this post


Link to post
Share on other sites
Addressing your first question: All CPUs that work with PC computers follow the same architecture (x86). This means that anything written for an Pentium 3 will work for a Duron as long as no special features that only a pentium 3 would have are used.
When it comes to compilers: Use what you can get and what you like...Use different things ang choose which you prefer. Good luck [wink]!

Share this post


Link to post
Share on other sites
In answer to you first question, people use it because if used properly and in the right places, it can speed up your program, but it's likely you'll have to write the code several different ways if you use any advanced features that are not generally supported. Also, compilers are generally pretty good, so getting a benefit requires you to really know what you're doing.

tj963

Share this post


Link to post
Share on other sites
Quote:

1/ firs of all, I can't understand the compatibility issue. it seems that an assembler language depends on the CPU, but then would I have to write a different code for each CPU? and what is the interest of the assembler language when my application could work on just a specific group of computers??


95% of computer users are using an AMD or Intel processor, which covers pretty much every instruction you're likely to come across. This is 'standard' x86 assembly, though there have been many extensions over the years (SSE, SSE2, MMX, etc.)

Quote:

2/ the second issue is that there are a whole lot of compilers, (there's MASM, FASM, NASM, ......), so I don't know which one to pick nor the difference.


MASM is good, though honestly...writing code PURELY in ASM is usually an exercise in frustration. ASM works best when mixed with other, higher level languages, like C/C++.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this