Problem with int 21h and Masm32.

From: Nelson (spamtrap_at_crayne.org)
Date: 09/03/04


Date: Fri, 3 Sep 2004 00:10:53 +0000 (UTC)

code:

  .486
  .model flat, stdcall
  option casemap: none

.code
start:
  mov ah, 4ch
  int 21h
end start

Alright, simple enough. I type that into QEditor then hit the console
assemble and link button from the project menu which basically does
this:

ml /c /coff <file>.asm
link /SUBSYSTEM:CONSOLE /OPT:NOREF <file>.obj

Assembles and links without errors or warnings...I go to run it and
when it tries to execute the int 21h line I get an "access violation".

I got this thing to work last night by linking it with tlink instead,
after looking at the hex for both versions of the executable I noticed
that the big difference is in the header of the exe. The masm32
linker version even has an ascii string saying that this program does
not run in dos mode, so it makes sense that calling a DOS interrupt
won't work. So I guess my question is how can I get the linker that
is included in the masm32 package to create exe's that can call DOS
interrupts? Is there a 16-bit combatibility mode or something I can
use? Does this have to do with coff? Can I make it link in another
format? etc?

Thanx a bunch.