News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to start. (x64 Win/Linux)

Started by deitysou, July 17, 2008, 09:23:02 PM

Previous topic - Next topic

deitysou

Hi,

within the last years I tried to learn Assembler... but I had no time to investigate enough time.
But now the time has come.  :cheekygreen:

I've got a few questions 'cause I need to start from the scratch.
1. Which Assembler:
  MASM?
  NASM?
  I want to develope software for Windows and Linux. I guess (and that's what I've read) MASM is only supported for Windows?
  Please tell me if I'm wrong.
  So I should prefere NASM? Also I'm a practiced Delphi programmer? Shall I use TASM? 
2. Tools:
  Can you suggest some tools I should use? (Win/Lin)
3. Tutorials:
  I need alot of them =)
  Also for Windows and Linux

Kind regards

(Sorry for my english but I'm not a native speaker. Please correct my grammatical mistakes.)

japheth


> 1. Which Assembler:
>   MASM?
>   NASM?
>   I want to develope software for Windows and Linux. I guess (and that's what I've read) MASM is only supported for Windows?
>  Please tell me if I'm wrong.
>  So I should prefere NASM?

Yes.

> 2. Tools:
>  Can you suggest some tools I should use? (Win/Lin)

I don't know ... an editor to write the assembly source perhaps? ... and a linker to link your programs?

> 3. Tutorials:
>   I need alot of them =)
>   Also for Windows and Linux

Why not start with the docs and samples supplied with NASM?


1rDirEctoALgran0

Keep in mind that there is NASM clone like YASM. (Far better than NASM)
Take a look also on GoAsm, GoRC and GoLink (They are my favorites, but Windows only...)
Do you want absolutely a multi-platform assembler ? (The most can be the worst)

Patrick

dsouza123

A very good choice is FASM, from the site: http://flatassembler.net/

"... the flat assembler - the open source assembly language compiler for x86 and x86-64 processors
(this includes the AMD64 and Intel EM64T architectures). Packages for DOS, Windows, Linux and Unix with C library are available.

The flat assembler is a fast and efficient self-assembling 80x86 assembler for DOS, Windows and Linux operating systems. Currently it supports all 8086-80486/Pentium instructions with MMX, SSE, SSE2, SSE3 and 3DNow! extensions and x86-64 (both AMD64 and EM64T) instructions, can produce output in binary, MZ, PE, COFF or ELF format. It includes the powerful but easy to use macroinstruction support and does multiple passes to optimize the instruction codes for size. The flat assembler is self-compilable and the full source code is included.

The only difference between the various flat assembler packages is the operating system on which they can be executed. From given source each version will generate exactly the same output file, so with each of the following releases you can compile programs for any operating system."

There is extensive documentation, tutorials and an active forum.
FASM syntax is most similar to Borland's Turbo assembler, TASM, in Ideal mode.

There are FASM (constructs/macros) that allow some MASM code to be assembled with minor changes, FASM uses [] around variables.
FASM doesn't support MASM's macro system, so MASM code with macros would have to be changed.
--------------------------------------
To do the reverse, assemble FASM code using MASM is more involved but not that hard.
FASM supports sub labels, MASM doesn't, so the labels have to be modified and checked
to make sure they are unique.

In invoke statements ADDR (or OFFSET) has to be added if the address
rather than the value of a variable is being pushed

buffer rb 2000h  becomes  buffer db 2000h dup (?)

MASM uses <> after variables that are STRUCTs

FASM has a detailed imports section listing the API functions called,
MASM has the list includes and includelibs.

FASM normally has the resource in the assembly file, MASM normally uses a separate rsrc.rc

There are other issues, FASM has some other constructs and the MACRO system is different.

japheth

Quote from: 1rDirEctoALgran0 on July 19, 2008, 11:20:58 AM
Keep in mind that there is NASM clone like YASM. (Far better than NASM)

Could you please elaborate why Yasm is "far better" than Nasm! IIRC Yasm doesn't even support OMF output format, which is still a must for an assembler IMO.

deitysou

I missed to write a reply on this topic but I say thanks to all of you.
I'll check all your suggestions.  :bg