News:

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

Need help getting started.

Started by Blue Bird, February 15, 2006, 12:01:10 PM

Previous topic - Next topic

Blue Bird

Hello. I have just recently started learning Assembly at university and thought it would be a nice idea to be able to write Assembly programs in my laptop.

So I got MASM32 and installed it on my computer.

However, at school they have Linux, and over there all I have to do is write the code, save it as a .asm file, and then do the following on the command line:

nasm -f elf file.asm
ld -s -o file file.o

And then an executable is created. Simple.

This is probably very easy, but I've been mucking about with it for hours now and I still can't figure out what to do in order to get a .asm to become an executable using MASM32. Could someone please point me in the right direction please?

hutch--

If your UNI is using NASM under Linux, that is the best direction for you to go in. MASM32 is a good project but its tuned for Windows and does not run on Linux normally. There are a few other Linux capable assemblers but there is nothing wrong with NASM, its a Unix industry standard.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Blue Bird

Oh no I'm not looking to use the ones on the Uni computers. Well, at least not exactly. I was kind of hoping that I would be able to write the code with my laptop, and then test it using MASM32, and then I could take the code to school and use it there. Is that possible, or should I really look into getting Linux?

Tedd

Nasm is available for windows, so you could use that. Though you'll need to find an alternative linker (to "ld") - the masm one should be okay.
Masm and nasm code aren't directly compatible, so if you do try that you'll have to do a fair amount of conversion to get one piece of code working with the other.
The other problem is that straight x86 asm is okay between linux and windows, but system/api calls are entirely different - so the code will work on one and not the other again ::)
No snowflake in an avalanche feels responsible.

PBrennick

You will use NASM at school because that is what they have but remember that it is a dead language so don't put in any more effort than you are forced to.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

arafel

PBrennick,

It's dying only in the Windows environment. In Linux world it's actually pretty prospering. AFAIK almost every second Linux distribution has NASM included in default install.

PBrennick

Maybe so, but it is not being developed any longer.  It's been pulled from SourceForge.  It is being included in the distros because it is free.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

Synfire

Quote from: Blue Bird
Hello. I have just recently started learning Assembly at university and thought it would be a nice idea to be able to write Assembly programs in my laptop.

So I got MASM32 and installed it on my computer.

However, at school they have Linux, and over there all I have to do is write the code, save it as a .asm file, and then do the following on the command line:

nasm -f elf file.asm
ld -s -o file file.o

And then an executable is created. Simple.

This is probably very easy, but I've been mucking about with it for hours now and I still can't figure out what to do in order to get a .asm to become an executable using MASM32. Could someone please point me in the right direction please?

1.) Executables on Linux and Windows are not the same, Windows executables use the PE or MZ format while Linux uses the ELF format. To build Nasm code on Windows you need to use something like this (i use alink as the linker)...

nasm -fobj file.asm
alink -oPE file.obj

2.) Different operating systems have different API's. On Windows you will generally use call's to routines stored in dynamically linked libraries rather than using interrupts setup by the OS. This is done because Window's internal interrupts are different for each build of Windows. Therefore, while you can do most of your calls through int 0x80, you won't have that in Windows.

Quote from: Blue Bird
Oh no I'm not looking to use the ones on the Uni computers. Well, at least not exactly. I was kind of hoping that I would be able to write the code with my laptop, and then test it using MASM32, and then I could take the code to school and use it there. Is that possible, or should I really look into getting Linux?

1.) Nah, you can't do that exactly, as I mentioned above things are handled differently in Windows than on Linux, and unless you are working with an Emulator you probably won't be doing much testing on your windows laptop.

A side note, with NASM and ALINK on windows you can actually build the Linux binary files, but you can't run them.

2.) Yea, I would say get a copy of Linux, if that is a burden on you (say you use your laptop for other things) then look into LiveCD distros such as Knoppix or PHLAK.

Quote from: Tedd
Though you'll need to find an alternative linker (to "ld")

Actually, you can get LD for windows via the MinGW C package. MingWC is used by DevC++ or can be downloaded seperately from it's homepage.

Another option would be to use ALINK, which comes with most nasm packages, which also supports ELF output files.

Quote from: PBrennick
but remember that it is a dead language

I hardly think of Nasm as a dead language, but maybe that's just because I program nearly all of my applications using Nasm, and so do many many other people. I was kinda upset that it's no longer being updated, but that won't keep me from using it (and making advancements on my own copy). I doubt Nasm will die out any time soon. I mean think about it, I remember when Borland said they were no longer going to support TASM, literally took it off the web for almost a year, but it made a comeback. :U

Regards,
Bryant Keller

Tedd

Nasm doesn't look like it's in development any longer. However, Yasm is very much in development and aims for direct compatibility with nasm.
So I wouldn't consider it a dead 'language' (even if nasm itself is dead.)

http://www.tortall.net/projects/yasm/wiki
No snowflake in an avalanche feels responsible.

farrier

I would recommend FASM, The Flat ASseMbler at Flatassembler.net

Fasm is under very active developement, has versions that will run on Windows, DOS, and Linux/other nixes.  8-bit, 16-bit, 32-bit, and 64 bit.

And each version can assemble code to run on the other platforms.  So running the Windows version on your laptop, you can develop apps for Windows, DOS, or Linux.  Of course you can't run the apps for Linux, but you can take that same code and copy it to the Linux machine and get the same executable.

I started with MASM32 and now do all my new projects using RadASM and FASM and love it.

hth,

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

Synfire

Quote from: Synfire
I hardly think of Nasm as a dead language, but maybe that's just because I program nearly all of my applications using Nasm, and so do many many other people. I was kinda upset that it's no longer being updated, but that won't keep me from using it (and making advancements on my own copy). I doubt Nasm will die out any time soon. I mean think about it, I remember when Borland said they were no longer going to support TASM, literally took it off the web for almost a year, but it made a comeback. ThumbsUp

wow, nasm made a comeback sooner than I thought, seems they just moved the host ;)

http://sourceforge.net/projects/nasm

Regards,
Bryant Keller