News:

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

cannot execute program

Started by bluled, December 28, 2005, 04:17:13 PM

Previous topic - Next topic

bluled

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.

MichaelW

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.

eschew obfuscation

Gustav


> 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