delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/10/09/17:17:25

Date: Sun, 9 Oct 1994 12:14:18 -0700 (PDT)
From: "Frederick W. Reimer" <fwreimer AT crl DOT com>
Subject: Re: djgpp and the 386SX
To: "Mr. Salty" <cigna AT helios DOT phy DOT ohiou DOT edu>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

On Sun, 9 Oct 1994, Mr. Salty wrote:
> I compiled to assembly the following program:
> 
>  main()
>  {
>    long a = 10, b = 20, c = 0;
> 
>    c = a + b;
>  }
> 
> When compiled with borland using "bcc -S -3 tst.c" the output was:
> 
>   mov dword ptr [bp-4],large 10
>   mov dword ptr [bp-8],large 20
>   mov dword ptr [bp-12],large 0
>   mov eax,dword ptr [bp-4]
>   add eax,dword ptr [bp-8]
>   mov dword ptr [bp-12],eax
> 
> The assembler syntax is different, but it looks like they both use
> 32 bit registers for 32 bit integers. Notice however that Borland C 3.1
> uses bp (16 bits) to hold a *pointer*, while djgpp uses ebp (32 bits).
> 
> In the Intel world "32 bit code" == "flat memory model" and
> "16 bit code" == "segment:offset addressing". It has tremendously
> little to do with the size of an integer.

Well don't I feel like an ass!  I just reinstalled both Borland C++ 3.1 
and Microsoft Visual C++ 1.0 and they BOTH produce code like above.  I 
guess I was really talking about what you say in your last quoted 
paragraph, that 32 bit code == flat memory model, which neither Borland 
nor Microsoft support without add-ons (which cost more money).

I won't make any more excuses.  Extream appologies to anyone which took 
offense at my inacurate posts.  Hope no one will suffer irreparable - 
life long - damage from them...

Fred Reimer

+-------------------------------------------------------------+
| The views expressed in the above are solely my own, and are |
| not necessarily the views of my employer.  Have a nice day! |
| PGP2.6 public key available via `finger fwreimer AT crl DOT com`   |
+-------------------------------------------------------------+



- Raw text -


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