Skip to main content
GameDev.net gamedev.net
🔒 Locked

Assembly - compiling and linking

Started by Kuros Aug 15, 2001 at 7:18 AM 1 replies 1k views
Original Post
Kuros
Kuros
Hi. I am experiencing a little problem when I''m trying to assemble and link simple assembly programs such as:
.386
.MODEL small

.data
.code

_start:
    mov   ax,4c00h ; dos quit function
    int   21h      ; terminate the program

end _start
 
It assembles and links okay, but when I try to execute the program (or the many variations of it that I have been trying to make), it either crashes normally or into a bluescreen from which I have to reboot my computer. I am compiling this source code with ML.exe (Microsoft Macro Assembler) version 6.15.8803, and linking it with LINK.exe (Microsoft Incremental Linker) version 6.00.8447. These are the programs that came with Visual C++ 6.0, service pack 5 and the processor pack, but I have also tried to compile and link the source code with earlier versions, including the one that comes with MASM32. The exact procedure I do is: ml /c /coff test.asm link /subsystem:console test.obj test So, I would be glad if someone could point out the problem for me, because all the tutorials from the web either causes a link problem or crash, and I''m beginning to freak out. I would also appreciate if someone could type a very small shell program for the above mentioned compiler and linker that doesn''t crash the computer. Out of frustration I tried to make a "Hello, world" program using debug.exe, and it works, but I can get a "Hello, world" program working with MASM. (btw the .exe file is 12kb big - ?)
Grib
Grib
I beleve your problem is the subsystem:console directive.
Console != Dos and int 21h == Dos. You may want to try nasm as I beleve they are more DOS friendly. VC likes to pretend that Dos does not exist, though there are no doubt ways to trick it into reliving it's childhood.

Edited by - grib on August 15, 2001 4:02:22 PM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.