[comp.os.msdos.programmer] Need compiler for 386 code for DOS

nelson@bolyard.wpd.sgi.com (Nelson Bolyard) (10/02/90)

I have an application which uses long integer arithmetic extensively.
I have compiled and run this application on my 25 Mhz 386 clone with 
Turbo C 2.0 and also on a 20 Mhz MIPS system.  The performance on the 
386 system is about 1/20th of the performance on the MIPS.  When I look at
the assembly code generated by each compiler, the reason for the speed
difference becomes obvious - there are at least 6 8086 instructions being
generated for each 1 mips instruction.  This is not a complaint about Turbo
C's optimization.  This is mainly due to the 16-bit registers in the 8086
model.  

I want to be able to use the 32-bit registers on the 386.  To do this, I
need a c compiler that will generate 386 instructions.  The entire
application runs now in Turbo C's tiny model, so memory space is not an
issue.  I don't need to use the 386 descriptor tables; that is, 8086 style 
memory addressing is just fine,  I only need wider registers.

I've heard of things called "DOS Extenders", but they're always advertised
as existing to solve problems caused by the 8086's 1 MB memory limit - which
is not my problem.  The Turbo Debugger manual states that with the "virtual
debugger device driver" tdh386 (which I use all the time) "Your program can
use nearly all the 80386 instructions, with the exception of the
protected-mode instructions CLTS, LMSW, LTR, LGDT, LIDT, LLDT."

So my questions are these:
1. Do I need a dos extender to be able to use the 32-bit registers?
   Evidently not if I'm using TD386H, but what about when I'm not 
   debugging the program?  I might want to someday sell this program, so I
   want a solution that won't require every customer to buy a DOS extender.

2. Where can I get a c compiler that will generate code that uses the 32-bit
   386 registers efficiently, but still use DOS for I/O?  I guess I could
   buy some flavor of UNIX/XENIX as these come with 386 compilers, and 
   reportedly some flavors run DOS as a process, but this seems like a big
   investment to reach my simple goal.

3.  Turbo C has a compiler option to generate 186/286 instructions, that
    I've never used.  What does that do for me?

4.  Do you have any suggestions?

Please e-mail your responses to me at the address below, and I will
summarize to the net, if asked to do so.
Thanks in advance for your replies.

-----------------------------------------------------------------------------
Nelson Bolyard      nelson@sgi.COM      {decwrl,sun}!sgi!whizzer!nelson
Disclaimer: Views expressed herein do not represent the views of my employer.
-----------------------------------------------------------------------------

jagrogan@vax1.tcd.ie (10/25/90)

You really need to get Watcom C (386). This compiler generates code specifically
for a 386 processor. I don't know of any other compiler that will generate 386
code. I use TC2.0 myself, and haven't found a way to improve the assembly
generated.
John.
-- 
-------------------------------------------------------------------------------
					   jagrogan@vax1.tcd.ie@cunyvm.cuny.edu
    3rd Year Computer Science                     jagrogan@vax1.tcd.ie
     Trinity College Dublin.                      jagrogan@unix1.tcd.ie
                                                  jagrogan@tcdmath.uucp
-------------------------------------------------------------------------------
	"I haven't lost my mind.....I'm sure it's backed up here somewhere!"