delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/06/02:15:35

Date: Mon, 6 Nov 2000 09:13:27 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Danny Byers <dan AT magma DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: using COFF object file from MASM to compile C
In-Reply-To: <3A05AA54.229C4FAE@magma.net>
Message-ID: <Pine.SUN.3.91.1001106091259.9527C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 5 Nov 2000, Danny Byers wrote:

> getc.asm --------------------------------------------
> .MODEL SMALL
> EXTRN _PrintInfo:PROC
> .STACK 100H

I think ".MODEL SMALL" and ".STACK 100H" might be a cause of your
trouble.  Also, don't you need a .386 directive, to make the code
32-bit?

> BEGIN:
>  push BP
>  mov BP,SP
>  mov AX,[BP+4]
>  call _PrintInfo

You are calling PrintInfo without pushing its argument onto the
stack.  What's more serious, PrintInfo calls `printf', which needs
vast amounts of stack space.  You also don't preserve registers that
GCC-generated code assumes to be loaded with certain values; see
section 17.4 of the DJGPP FAQ list.

> Any idea as to why I am getting a GPF error with this code? Is it a problem
> related to Protected Mode??

Probably.  But you didn't post the full crash message printed when
your program GPFaults, so it is very hard to tell.

You might consider running the program under a debugger, to see where
exactly does it crash, and what is the machine instruction that causes
the crash.  That might give you a clue.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019