delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/28/18:20:08

From: paulboss AT erols DOT com (Paul J. Bosselaers)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Mixing asm and C
Date: Wed, 28 Oct 98 23:17:14 GMT
Lines: 32
Message-ID: <7188nc$2cr$1@autumn.news.rcn.net>
References: <363247ad DOT 81580547 AT newshost DOT cc DOT utexas DOT edu> <363782F1 DOT 7EA4 AT erols DOT com>
X-Trace: GMYNX9CFOiT8GPbgjcOvS8Epa9gURxU0+fKzPLsmzfs=
X-Complaints-To: abuse AT rcn DOT com
NNTP-Posting-Date: 28 Oct 1998 23:18:04 GMT
X-Newsreader: News Xpress 2.0 Beta #0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <363782F1 DOT 7EA4 AT erols DOT com>, johnfine AT erols DOT com wrote:
>Jeramie Hicks wrote:
>> 
>> I've been working on this code for about a week now with no result.
>> Could somebody point out what I'm doing wrong? All I want to do is
>> load a COM program into a chunk of allocated memory and then run it.
>.. . .
>> // allocate comdata to size of COM program
>> // fread COM program into comdata
>> codeptr = (functptr) comdata;
>> codeptr();
>
>> and then, the COM program compiled with MASM 6.1 with the /AT switch:
>> 
>> .model TINY
>> .386
>> .code
>> equalfive proc
>>         mov eax, 5
>>         ret
>> equalfive endp
>> end equalfive
>
>  I may not be remembering MASM switches and directives correctly, but
>I am nearly sure that .model TINY _always_ forces 16-bit defaults.
>Most instructions generated that way will not run correctly when
>the CPU is in 32-bit mode (as it is with DJGPP).
>

If you put .386 before .model tiny MASM will generate 32 bit code.

Paul Bosselaers

- Raw text -


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