![]() |
quick question
If I write the same exact program in these three asm translators : nasm, fasm, masm, will the executable code generated by the assembler be the same? (and they're all assembled on the same platform, same processor)
|
You should try it and see for yourself using a hex editor :)
|
Unless it's an extremely trivial program, I wouldn't count on it. But this is easily testable.
|
Why not? Isn't asm little more than a set of mnemonics for machine language (or as most retards call it, "binary")? How could it be translated in different ways by different assemblers?
By the way, the exact same source text wouldn't even be assembled by each of those assemblers, I assume you meant that you would write a NASM, TASM and MASM version of the same program. |
The assembler specifics would have to be different but the code itself would be different. Golden was asking if that would produce identical executables.
|
It isn't a simple yes-or-no answer, even though the OP specified the assemblers to consider and that the platforms and processors were identical. Consider that it's a Pentium processor but that one of the assemblers is set to produce code that will run on an 8086 while another is not. In some instances, simple code would produce identical outputs; in others, it would not.
|
thanks for all of your input.
I'd like to concentrate on learning nasm, but would it work on windows? Through some reading im under the impression that asm langs are specific to processors and the OS shouldn't matter? |
You need some more in-depth study. If you want your apps to work under Windows, regardless of the language you use to produce them, you have to interface with all that OS code that makes the system run. One can write directly for a platform/processor just about however they want, but you won't see much without a hell of a lot of work. If you want to mesh with an OS (whatever it is) to take advantage of the lebenty-zillion things they already did FOR you, then you play by their rules (or figure out how to break them without ill effects).
|
meaning id have to concentrate on the operating system's api almost as much as the assembly language?
does it matter which asm language i choose, i also read that its just up to ones preference and that as far as capabilities are concerned, they arent really different from each other. |
If you're into learning bare-bones assembly and not being constrained by an OS, buy an SBC, add an LED display and a 10-key pad. I don't know what you mean by "not different". At the simplest level, assembly language is a set of mnemonics representing the patterns of binary signals that trigger the hardware logic associated with the operations of the CPU. Sometimes, there's microcode involved, also. The bit patterns (bit meaning 'binary digit') that cause a particular operation (load a register with an immediate value, say) are rarely the same between microprocessors simply because the circuitry is laid out differently.
A modern, desktop OS is organizing the use of the CPU, providing interface capabilities, managing memory, and tons of other things that you have to work to get past if you want the lowest level of interaction with the CPU. Otherwise, you have to accomodate it or risk triggering destructive effects who's severity varies widely. Incidentally, as you can see from the source of the word, 'bit', it isn't really retarded to refer to machine language as 'binary.' ;) |
| All times are GMT -5. The time now is 12:49 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC