Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!decwrl!sun!gnu
From: gnu@sun.uucp (John Gilmore)
Newsgroups: net.micro.68k
Subject: Re: detecting processor type (68000/68010/etc) in software?
Message-ID: <1753@sun.uucp>
Date: Wed, 24-Oct-84 02:12:36 EDT
Article-I.D.: sun.1753
Posted: Wed Oct 24 02:12:36 1984
Date-Received: Thu, 25-Oct-84 04:13:25 EDT
References: <368@foros1.UUCP>
Organization: Sun Microsystems, Inc.
Lines: 20

I know of no way for user code to distinguish a 68000 from a 68008
or 68010 or 68012.  This is deliberate, like on a 360 or 370, since
it means you CAN'T write a program that won't transport from one
to the other.

Long long ago in a garage far away I made some Sun-1 boot proms that
figured out the difference but they did it by causing a trap and seeing
how long the stack frame was.  Supervisor programs can do this to tell
a 68000 from a 68010, but there's no way to tell a 68010 from a 68012,
or a 68008 from a 68000.

On the other hand, the 68020 offers a way to tell.  It now decodes some
bits in the index word that were ignored by previous models.  So all
you need to do is tell it to do something using those bits, and if
it does it (eg scale the index reg) it's a 68020 and if it doesn't,
it's a previous model.  This is handy since there are lots of useful
instructions you can use if you know it's a 68020.

What would your library routine do differently if it knew it was
on a 68000 versus 68010?  There really isn't that much difference.