🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1872

Re: Detecting an 80486

#1872
From: John R. Levine
Date: Tue, 14 Aug 1990 02:55
22 lines
1732 bytes
In article <3817@altos86.Altos.COM> rcollins@altos86.UUCP (Robert Collins) writes:
>In some article, it was written:
>+}  In my Infoplus program, the 286/386/486 are detected by trapping the
>+}invalid opcode interrupt, and then trying instructions. 
>[but there are lots of places where this doesn't work very well, either
>because someone else gets the trap, or because some putatively unused opcodes
>do secret things.]

The Intel 486 Programmer's manual has sample code to tell the difference
among the 8086, 286, 386, and 486 without any trapping at all.  There are
lots of differences other than new instructions.  For example, on a PUSH SP,
the 8086 pushes the decremented SP but newer processors push the original
value.  When you push the flags register with PUSHF, the 8086 always sets
bits 12-15 to one, the 286 always sets them to zero, and the 386 and 486
store some actual flags there.  The 486 uses flag bit 18, which the 386
didn't.  Intel provides sample code that is straightforward and doesn't
depend on catching traps.  Looks good to me.

-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|spdcc|world}!esegue!johnl
Marlon Brando and Doris Day were born on the same day.
Technical Details
Message-ID: <1990Aug14.025550.17669@esegue.segue.boston.ma.us>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!spdcc!esegue!johnl
References: <26a858b9@ralf> <3817@altos86.Altos.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!snorkelwacker!spdcc!esegue!johnl
From: johnl@esegue.segue.boston.ma.us (John R. Levine)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Detecting an 80486
Message-ID: <1990Aug14.025550.17669@esegue.segue.boston.ma.us>
Date: 14 Aug 90 02:55:50 GMT
References: <26a858b9@ralf> <3817@altos86.Altos.COM>
Reply-To: johnl@esegue.segue.boston.ma.us (John R. Levine)
Organization: Segue Software, Cambridge MA
Lines: 22