The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: bluled on December 28, 2005, 04:17:13 PM

Title: cannot execute program
Post by: bluled on December 28, 2005, 04:17:13 PM
hello,

Im working on a pretty simple program which assembles and links properly to make an exe. The problem is when I run it i get a 'printa.exe has encountered a problem and needs to close.  We are sorry for the inconvenience.' error.

here is the code

.386
    .model flat, stdcall
     option casemap :none   ; case sensitive
    .data
    .code
      start:
    mov ah,02h
    mov dl,41h

    int 21h
    int 20h
    end start

end

Im wondering if there is something the assembler didnt pick up or something is wrong with my OS. This is also the same with other programs ive assembled and i get the same error.
Title: Re: cannot execute program
Post by: MichaelW on December 28, 2005, 05:23:58 PM
Hello bluled, welcome to the forum.

I'm not sure why you are getting that particular error message, but if your code is supposed to be for a Windows app then I'm virtually certain that the problem is with the interrupt calls. With very few exceptions, depending on your version of Windows, you cannot use interrupt calls in a Windows application. If the code is supposed to be for a Windows app, you should replace the interrupt calls with suitable API calls. If it is supposed to be for a DOS app, then with the addition of a stack segment it should run OK, but you really should change the model to one of the DOS models, probably small.

Title: Re: cannot execute program
Post by: Gustav on December 29, 2005, 06:57:37 AM

> change the model to one of the DOS models, probably small

Yes, and dont use ".386" before the ".model" directive. Write


    .286
    .model small, stdcall
    .386


thus MASM knows that it should create 16-bit segments