[comp.lang.pascal] Turbo Pascal 6.0 code generation for 80286

vereijken@rulcri.leidenuniv.nl (Jan Joris Vereijken) (03/26/91)

Hi,
 
I have run into something very strange: under Turbo Pascal one can choose to
generate specific 80286 code ($G+ switch). This code is not supposed to run on
XT-like (8088/8086-based) machines. However, it seems to do...
 
Facts:
 
   - My system is  V30-based clone, using a BIOS called "PC-SPEED V1.50"
     (Actually it's a modified Atari ST, it runs about every MSDOS thing
     just fine. I am sure I have a V30, as I installed it myself.)
   - I compiled (for 80286) BGIDEMO.PAS, TCALC.PAS and a few (big) things
     I wrote myself.
   - The code generated DID differ from the "normal" code (for 8088). I checked
     this. The 80286-code is shorter, and is generated faster(!).
   - All the above programs ran like a charm on my V30 machine!
   - I did NOT benchmark the speed of the 8088 vs. 80286 code. (Actually I
     did, but then proclaimed my results unreliable).
 
This is not supposed to happen! I want my machine to be locked up! I PAID for
that (Borland manuals say it should lock up).
 
I have given it some thought and have come up with the following:
 
   - Maybe a V30 (which is a enhanced 8086) can handle the 80286 instructions
     Turbo 6.0 generates? (Of course not ALL 80286 instruction, but maybe TP6.0
     only generates a proper subset.)
   - Maybe I have a BIOS that catches the 80286 instructions and emulates them?
     (Is this possible somehow? I only have a limited 8086-machinecode
     experience.)
   - Maybe the programs I ran did in fact NOT function properly, but I did not
     notice? (Say again? Me not notice???)
   - Maybe I'm going crazy? (I'm not crazy! I'm a dictionary!)
 
However, I still do not figure why things are as they are (a well-known concept
when applied to life-at-large).
 
Who sheds some light on the matter?
 
Thanx!
 
- Jan Joris -
 
forchk@rullf2.LeidenUniv.NL
vereijken@hlerul5.bitnet
 
(P.S.: Reply to me personally too, as I do not subscribe to this list.)
 

mnrausch@immd4.informatik.uni-erlangen.de (Martin Rausche) (03/26/91)

vereijken@rulcri.leidenuniv.nl (Jan Joris Vereijken) writes:

>Hi,
> 
>I have run into something very strange: under Turbo Pascal one can choose to
>generate specific 80286 code ($G+ switch). This code is not supposed to run on
>XT-like (8088/8086-based) machines. However, it seems to do...
> 
>Facts:
> 
>   - My system is  V30-based clone, using a BIOS called "PC-SPEED V1.50"
>[some stuff deleted]
>   - All the above programs ran like a charm on my V30 machine!
> 
>[some stuff deleted]
>
>Thanx!
> 
>- Jan Joris -
> 
>forchk@rullf2.LeidenUniv.NL
>vereijken@hlerul5.bitnet
> 
>(P.S.: Reply to me personally too, as I do not subscribe to this list.)
> 
TP6.0 generates code for the 80286, but it uses only the real mode extensions
of the 80286. The NEC-V30 chip can deal with this instructions. There is no
mystery. Have fun. Martin.
---
------------------------------------------------------------------------------
| Martin Rausche                                                              |
| EMail: mnrausch@immd4.informatik.uni-erlangen.de                            |
| Trust me, I know what I'm doing -- Sledge Hammer                            |
------------------------------------------------------------------------------

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (03/26/91)

In article <1991Mar26.010615.1@rulcri.leidenuniv.nl> vereijken@rulcri.leidenuniv.nl (Jan Joris Vereijken) writes:
>Hi,
> 
>I have run into something very strange: under Turbo Pascal one can choose to
>generate specific 80286 code ($G+ switch). This code is not supposed to run on
>XT-like (8088/8086-based) machines. However, it seems to do...
> 
>Facts:
> 
>   - My system is  V30-based clone, using a BIOS called "PC-SPEED V1.50"
>     (Actually it's a modified Atari ST, it runs about every MSDOS thing
>     just fine. I am sure I have a V30, as I installed it myself.)
>   - I compiled (for 80286) BGIDEMO.PAS, TCALC.PAS and a few (big) things

There's been some discussion of this on Fidonet.  It seems that the $G+
command only generates instructions that are on the 80186; V20 and V30
chips also support these instructions.  There's a list of exactly which
instructions the $G+ command allows in the manual; if you have a V30
manual, you can verify that it supports all of them.

Duncan Murdoch
dmurdoch@watstat.waterloo.edu

jamesp@world.std.com (james M peterson) (03/27/91)

The V-30 chip does in fact have a subset of the 286 instruction set.
I've been using this "feature" occasionally.  Its mostly the enhanced
move and such codes.

jamesp@world.std.com

ebergman@isis.cs.du.edu (Eric Bergman-Terrell) (04/02/91)

I used to use a Zenith which used (I believe) an NEC V-20 which was a
80186 clone.  Turbo C generated 80186 instructions which the Zenith happily
executed.  Result:  prog. ran ~10% faster & code was slightly smaller...

Maybe the same thing is happening to you?


Terrell