[comp.sys.ibm.pc] 386 instructions

hlison@bbn.com (Herb Lison) (01/12/90)

Does anyone know if there are any compiler options with MSC5.1 which
let the compiler generate 386 specific instructions where appropriate.
The documentation I have only shows the /G2 option for generating
286 code.  Specifically, it would be nice to take advantage of
32 integer multiplies and shifts, or is this something the compiler
does automatically?

Thanks,

Herb Lison

kaleb@mars.jpl.nasa.gov (Kaleb Keithley) (01/12/90)

In article <13346@garnet.BBN.COM> hlison@bbn.com (Herb Lison) writes:
>Does anyone know if there are any compiler options with MSC5.1 which
>let the compiler generate 386 specific instructions where appropriate.
>The documentation I have only shows the /G2 option for generating
>286 code.  Specifically, it would be nice to take advantage of
>32 integer multiplies and shifts, or is this something the compiler
>does automatically?

MSC 5.1 will not generate 386 instructions under any circumstances, not
automatically, not today, not tomorrow, not next year, not ever.  MASM 5.1
will generate some of the 386 instructions, but not all.  You have to
get somebodies (Phar Lap is an example) 386 compiler and DOS extender.


Chewey, get us outta here!
                 
kaleb@mars.jpl.nasa.gov             (818)354-8771
Kaleb Keithley

batman@watsci.uwaterloo.ca (Marcell Stoer) (01/12/90)

In article <13346@garnet.BBN.COM> hlison@bbn.com (Herb Lison) writes:
>Does anyone know if there are any compiler options with MSC5.1 which
>let the compiler generate 386 specific instructions where appropriate.
>The documentation I have only shows the /G2 option for generating
>286 code.  Specifically, it would be nice to take advantage of
>32 integer multiplies and shifts, or is this something the compiler
>does automatically?
>
>Thanks,
>
>Herb Lison

If you want to issue 386 instructions, you will need a compiler that
generates 32 bit code.  Microsoft has no such compiler.  There are companies
that provide these though.  One is WATCOM ( presently the best C compiler
around, refer to BYTE, PC Magazin, INFO World...etc), another is
Metaware.  These compilers generate 386 (32 bit) specific code that can
make use of all the memory your machine has (passed the 640K limit of
DOS).  To run the executables you will also need a DOS-Extender that can
switch your 386 to protected mode in order to make use of the 32 bit utilities.
Phar Lap has a good DOS-Extender.  These 386 compilers generally cost around
$650-900 (think twice) and the DOS-Extender is $495 (when I bought it 2 months
ago).  If anyone is interested for more info on WATCOM you can e-mail me
and I'll pass the info along.

--

		Marcell			BITNET : Batman@Watsci.uwaterloo.ca

===============================================================================

henry@Apple.COM (Peter Henry) (01/12/90)

In article <580@watserv1.waterloo.edu> batman@watsci.UUCP (Marcell Stoer) writes:
>If you want to issue 386 instructions, you will need a compiler that
>generates 32 bit code.  Microsoft has no such compiler.  There are companies
...
>Phar Lap has a good DOS-Extender.  These 386 compilers generally cost around
>$650-900 (think twice) and the DOS-Extender is $495 (when I bought it 2 months
>ago).>

Great! for the price of the compiler and extender, you could just buy UNIX for 
the 386 (with all the trimmings), get a real 32-bit environment, with
compiler (and/or use GCC), and still have money left over...  These UNIXes
will even support DOSMERGE-style apps that let you run MSDOS programs.

Seems to me, if you're willing to spend that kind of money to develop software
that won't even run under MSDOS (without the extender), what are you doing
running MSDOS as your primary OS in the first place?  Get UNIX, and spawn
DOS for your word processing/games/spreadsheet etc. (until good ones are
written for UNIX)!

-Peter Henry (peter@nucleus.apple.com)

dhinds@portia.Stanford.EDU (David Hinds) (01/12/90)

    On a tangent to the previous articles in the series, why are these DOS
extenders and things needed anyway???  Almost all of the 386-specific
instructions can be executed by the processor in real mode (i.e., under DOS)
without any contortions.  The only ones requiring protected mode are the
funny ones for playing with memory management and task switching.  Any DOS
program can use the 386's 32-bit registers, extended arithmetic, and new
addressing modes.  Any DOS program can simply use 32-bit addresses to access
extended memory.  Borland's Turbo Assembler will let you put 32-bit code
in the middle of anything you want.  So why aren't compilers available for
higher languages that do this?  It wouldn't be much work to just have a 
separate 386-specific version of a compiler's run-time library, but even
this would be a big speed boost for math-intensive programs.  For a single
task, the 386 can run 32-bit code just as well under DOS in real mode, as
it can under UNIX, OS/2, or a DOS extender in protected mode.

-David Hinds
 dhinds@portia.stanford.edu

johnl@esegue.segue.boston.ma.us (John R. Levine) (01/12/90)

In article <8166@portia.Stanford.EDU> dhinds@portia.Stanford.EDU (David Hinds) writes:
>    On a tangent to the previous articles in the series, why are these DOS
>extenders and things needed anyway??? ... Any DOS program can simply use
>32-bit addresses to access extended memory.

In 386 real mode, you can use all of the 32 bit registers but for some reason
you can only use 20 bit addresses.  Also, in real mode it needs to generate
operand and address size override bytes so the code is a lot larger than it
would be in protected mode.
-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."

louk@tslwat.UUCP (Lou Kates) (01/12/90)

In article <580@watserv1.waterloo.edu> batman@watsci.UUCP (Marcell Stoer) writes:
>In article <13346@garnet.BBN.COM> hlison@bbn.com (Herb Lison) writes:
>>Does anyone know if there are any compiler options with MSC5.1 which
>>let the compiler generate 386 specific instructions where appropriate.
>>The documentation I have only shows the /G2 option for generating
>>286 code.  Specifically, it would be nice to take advantage of

One reply mentions that Microsoft C does not generate 386 code but that 
Watcom and Metaware can and that these can allow you to pass the 640K
limit.   Its true that you can't generate 386 code on Microsoft C but
if the problem is that you need to exceed the 640K limit then you could use
the 286 code option and run the result under the Eclipse OS/286 DOS
extender which will allow you to run Microsoft C programs up to 16 MB
large on a 286 or 386.   If you are using a 386 then you will likely want
their 386 version OS/386 which will also allow you to run 286 generated
code from Microsoft C.

Lou Kates, ...!watmath!looking!tslwat!louk, 519-725-0277

bcw@rti.UUCP (Bruce Wright) (01/13/90)

In article <580@watserv1.waterloo.edu>, batman@watsci.uwaterloo.ca (Marcell Stoer) writes:
> If you want to issue 386 instructions, you will need a [C] compiler that
> generates 32 bit code.  Microsoft has no such compiler.

Maybe you meant to say that Microsoft has no such compiler at a reasonable
price.  They most certainly *do* have a 32-bit version of their C compiler -
it comes with their OS/2 V2.0 development kit (just shipping in the last
month).  I haven't seen it, not doing OS/2 development, and it's rather
expensive (the whole development kit costs $2600, counting documentation,
compiler, developer's tools, etc).

It's basically the same sort of deal as their earlier SDK's - a premium
price to get an early look at the new version of OS/2.  But it probably
isn't ready for prime time yet.

						Bruce C. Wright

norsk@sequent.UUCP (Doug Thompson) (01/13/90)

In article <13346@garnet.BBN.COM> hlison@bbn.com (Herb Lison) writes:
>Does anyone know if there are any compiler options with MSC5.1 which
>let the compiler generate 386 specific instructions where appropriate.
>The documentation I have only shows the /G2 option for generating
>286 code.  Specifically, it would be nice to take advantage of
>32 integer multiplies and shifts, or is this something the compiler
>does automatically?
>
>Thanks,
>
>Herb Lison

MSC 5.1 DOES NOT generate 386 32-bit instructions.
-- 
Douglas Thompson		UUCP: ..{tektronix,ogicse,uunet}!sequent!norsk
Sequent Computer Systems	Phone: (503) 526-5727
15450 SW Koll Parkway	!"The scientist builds to learn;the engineer learns in
Beaverton OR 97006	!order to build."  Fred Brooks

harlow@plains.UUCP (Jay B. Harlow) (01/13/90)

In article <8166@portia.Stanford.EDU> dhinds@portia.Stanford.EDU (David Hinds) writes:
>
>    On a tangent to the previous articles in the series, why are these DOS
>extenders and things needed anyway???  Almost all of the 386-specific
>instructions can be executed by the processor in real mode (i.e., under DOS)
>without any contortions.  The only ones requiring protected mode are the
>funny ones for playing with memory management and task switching.  Any DOS
>program can use the 386's 32-bit registers, extended arithmetic, and new
>addressing modes.  Any DOS program can simply use 32-bit addresses to access
>extended memory. 
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in Normal real Mode this won't work.  as per a recent Magizine article 
(i forget name of magizine) you can TRICK the 386 into seeing it,
only Why? the method they use will not work under Virual-86 mode. 
under DOS you are restricted to 1M address space.
the 386 for compatiblity preserves this restriction (ok you have maybe 64K-16
bytes of extended to use) remember in real mode you are stuck with
segment:offset = segment*16+offset, no way past 1M.
the trick i mention envolves going to protected mode, loading a descriptor
that has a very large (end of extended memory) limit to FS or GS,
then clearing the PE bit in CR0, with mov CR0,eax  Gee is this why intel
says to load descriptors with 64K limit before switch to real mode? ;-)
on same note can we create a 32-bit REAL mode? ;-)
>                  Borland's Turbo Assembler will let you put 32-bit code
>in the middle of anything you want.  So why aren't compilers available for
>higher languages that do this?  It wouldn't be much work to just have a 
>separate 386-specific version of a compiler's run-time library, but even
>this would be a big speed boost for math-intensive programs.  For a single
>task, the 386 can run 32-bit code just as well under DOS in real mode, as
>it can under UNIX, OS/2, or a DOS extender in protected mode.
>
>-David Hinds
> dhinds@portia.stanford.edu


from my understanding 32-bit code under dos is a hair slower then under 
unix (protected mode), ok on unix you have other tasks(maybe) running.

		Jay
-- 
		Jay B. Harlow	<nuharlow@plains.nodak.edu>
	uunet!plains!nuharlow (UUCP)	nuharlow@plains (Bitnet)

Of course the above is personal opinion, And has no bearing on reality...

fredb@llama.rtech.UUCP (Fred Buechler) (01/13/90)

In article <13346@garnet.BBN.COM> hlison@bbn.com (Herb Lison) writes:
>Does anyone know if there are any compiler options with MSC5.1 which
>let the compiler generate 386 specific instructions where appropriate.


I just read in a recent (1/8/90) Infoworld that Microsoft is now shipping
the OS/2 2.0 Software Developers Kit. Included in the kit are 32 bit versions
of MSC 5.1 and MASM 5.1 with a 32 bit debugger. The 2.0 release of OS/2
contains 32 bit code and will only run on 32 bit (386/486) systems.

Fred.

rob@prism.TMC.COM (01/13/90)

>Does anyone know if there are any compiler options with MSC5.1 which
>let the compiler generate 386 specific instructions where appropriate.
>The documentation I have only shows the /G2 option for generating
>286 code.  Specifically, it would be nice to take advantage of
>32 integer multiplies and shifts, or is this something the compiler
>does automatically?

   To my knowledge, MSC 5.1 has no support for the 386, though a 386-version 
of it is included with the OS/2 2.0 SDK kit (yours for only $2600).

   Several other companies (Watcom, Metaware, etc.) sell C compilers that 
take advantage of the 386.

davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) (01/13/90)

In article <3114@plains.UUCP> harlow@plains.UUCP (Jay B. Harlow) writes:

| from my understanding 32-bit code under dos is a hair slower then under 
| unix (protected mode), ok on unix you have other tasks(maybe) running.

  I can't say for sure, but the speed of 32 bit code over 16 bit comde 
under DOS can be up to 2:1 faster for some things. Note "can be." It all
depends on what you're doing.

  I have some documentation which indicates that PKZIP runs in 32 bit
mode on a 386, and that there's an option to force it to run in 286
mode. I don't have any details other than that. Supposedly it make about
a 40% difference.
-- 
bill davidsen	(davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
            "Stupidity, like virtue, is its own reward" -me

kaleb@mars.jpl.nasa.gov (Kaleb Keithley) (01/13/90)

In article <3416@rti.UUCP> bcw@rti.UUCP (Bruce Wright) writes:
>In article <580@watserv1.waterloo.edu>, batman@watsci.uwaterloo.ca (Marcell Stoer) writes:
>> If you want to issue 386 instructions, you will need a [C] compiler that
>> generates 32 bit code.  Microsoft has no such compiler.
>
>Maybe you meant to say that Microsoft has no such compiler at a reasonable
>price.  They most certainly *do* have a 32-bit version of their C compiler -
>it comes with their OS/2 V2.0 development kit (just shipping in the last
>month).  I haven't seen it, not doing OS/2 development, and it's rather
>expensive (the whole development kit costs $2600, counting documentation,
>compiler, developer's tools, etc).
>

Which means that they (Microsoft) doesn't have it.  Specifically, I can't
run down to Egghead or Software Etc and pick up a copy.  Not only that, but
this might imply that you have to run the compiler under OS/2, which not every
has, or wants, especially if you are developing for the DOS environment...

Chewey, get us outta here!
                 
kaleb@mars.jpl.nasa.gov             (818)354-8771
Kaleb Keithley

toma@tekgvs.LABS.TEK.COM (Tom Almy) (01/13/90)

In article <8166@portia.Stanford.EDU> dhinds@portia.Stanford.EDU (David Hinds) writes:
>
>    On a tangent to the previous articles in the series, why are these DOS
>extenders and things needed anyway???
>[Statements I agree with]
>Any DOS
>program can use the 386's 32-bit registers, extended arithmetic, and new
>addressing modes. 
But with the cost of having to put prefix bytes on each such instruction

>Any DOS program can simply use 32-bit addresses to access
>extended memory.
Not true. While you can do 32 bit address calculation, the resulting address
must be 16 bits (before adding the contents of the 16 bit segment selector).
To quote the Intel 80386 Programmer's Reference Manual, "Unlike the 8086 and
80286, 32-bit effective addresses can be generated (via the address-size
prefix); however, the value of a 32-bit address may not exceed 65535 without
causing an exception.

>For a single
>task, the 386 can run 32-bit code just as well under DOS in real mode, as
>it can under UNIX, OS/2, or a DOS extender in protected mode.

Not true, for you still have to deal with 64k segments and suffer the
additional code size of those prefix bytes. The linear addressing is a big
win for many memory intensive programs.

Tom Almy
toma@tekgvs.labs.tek.com
Standard Disclaimers Apply

pabres13@pc.usl.edu (Joubert John V.) (01/13/90)

	Get a copy of the newest PC Week magazine.  In it there is an article
about a 386 extender for MSC.


--
John Joubert                                      |  /\  |    /\    |     _ 
Internet: pabres13@usl-pc.usl.edu                 |  \|<>|>|> \|<>|>|><`|`|
GENIE: J.JOUBERT                                  |--/|-------/|------------
                                                  |  \/       \/

joefritz@pawl.rpi.edu (Jochen M. Fritz) (01/16/90)

I am not an assembler programmer (yet?), but this kludge might just work.
Look up the opcodes to all the instructions you wish to use in some 386 
reference manual.  Then define these as macros for the assembler with define
byte operator.  This will directlly insert the code into your assembler.

Hope this works  (feedback welcome!)
Jochen Fritz ("Noah")
joefritz@pawl.rpi.edu