(N)ASM 32bit linking

Lenovo / 42334dg
December 15, 2009 at 13:31:42
Specs: Windows 7, 2 GHz DualCore/ 2041 MB
Hello, I've been trying to learn assembly language using NASM(Netwide assembler) as compiler. It feels like I've searched the entire net, twice but still can't find anything good. I know basic instructions like mov, add,sub,dec,inc and various interrupts, and I know how to work with the registers(good enough, I believe). Problem is, I've just installed windows 7 64bit on the computer I work with most of the time and I write 16 bit programs with nasm. Win7 64bit can't execute 16 bit programs for some reason I don't know. Anyway I need to know how to compile my 16 bit code to 32 bit PE's. I also need to know how to call a c function from nasm, and not some function like printf, but my own function. I wan't to use the winAPI as little as possible, and I want my programs to be as small as possible(the reason I'm using assembly, it seems even c loads all kinds of crap into the final executable.). Anyhow, the primary question is how to link my 16bit code to 32bit executables. When I try ld(gcc) to link an object file produced by NASM it doesn't work. If I have any interrupts in my code the programs just seems to fail. Why?

Thanks for all help, and feel free to post links to any tutorials for NASM. I'd love to know more on how I can make my programs smaller and faster.

Live the life as you know it
/ Wille

See More: (N)ASM 32bit linking

Report •

December 15, 2009 at 16:31:07
I just got through taking an assembly language class, and I can say for a fact that a 64-bit pc will not run nasm, or any other 16-bit program without a bitof tweaking. I had a similar situation (but I use TASM). The workaround will be to download dosbox 64-bit edition to emulate your assembler. That's how I fixed my problem. Dosbox is a great dos emulator. I even got TASM working under Ubuntu! That's about all the help I can offer. Sorry I don't know more about NASM.

ASCII question, get an ANSI

Report •
Related Solutions

Ask Question