Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.intel > #346
| From | "Stanley Daniel de Liver" <admin@127.0.0.1> |
|---|---|
| Newsgroups | comp.sys.intel, comp.sys.ibm.pc.hardware.chips, alt.windows7.general |
| Subject | Re: How many x86 instructions? |
| Date | 2014-04-26 11:29 +0100 |
| Organization | dis |
| Message-ID | <op.xew5360yo4et73@dell3100> (permalink) |
| References | (2 earlier) <5306baeb$1@news.bnb-lp.com> <le6k8c$pt5$1@dont-email.me> <5306ea35$1@news.bnb-lp.com> <op.xeu9shxuo4et73@dell3100> <z7idnWEjHZI0mcbOnZ2dnUVZ_rSdnZ2d@giganews.com> |
Cross-posted to 3 groups.
On Sat, 26 Apr 2014 01:58:41 +0100, Yousuf Khan
<bbbl67@spammenot.yahoo.com> wrote:
> On 25/04/2014 5:54 AM, Stanley Daniel de Liver wrote:
>> On Fri, 21 Feb 2014 05:55:02 -0000, Yousuf Khan
>> <bbbl67@spammenot.yahoo.com> wrote:
>>> I remember I designed an early version of the CPUID program that ran
>>> under DOS. The whole executable including its *.exe headers was
>>> something like 40 bytes! Got it down to under 20 bytes when I
>>> converted it to *.com (which had no headers)! Most of the space was
>>> used to store strings, like "This processor is a:" followed by
>>> generated strings like 386SX or 486DX, etc. :)
I doubt the minimalism; a print rtn is 6 bytes, and the text "This
processor is a:" is 20 on it's own!
>>>
>>> You could make some really tiny assembler programs on x86. Of course,
>>> compiled programs ignored most of these useful high-level instructions
>>> and stuck with simple instructions to do everything.
>>>
>>> Yousuf Khan
>> Did you cater for all the early cpus?
>>
>> ;This code assembles under nasm as 105 bytes of machine code, and will
>> ;return the following values in ax:
>> ;
>> ;AX CPU
>> ;0 8088 (NMOS)
>> ;1 8086 (NMOS)
>> ;2 8088 (CMOS)
>> ;3 8086 (CMOS)
>> ;4 NEC V20
>> ;5 NEC V30
>> ;6 80188
>> ;7 80186
>> ;8 286
>> ;0Ah 386 and higher
>
(this wasn't my code, I probably had it from clax some years back)
> I don't know if I still have my old program anymore, but I do remember
> at that time it could distinguish 386SX from DX and 486SX from DX as
> well.
>
> Yousuf Khan
Here's the routine I boiled it down to:
test_cpu:
; mikes shorter test for processor
mov ax,07000h
push ax
popf
sti
pushf
pop ax
and ah,0C0h ; isolate top 2 bits
shr ah,1 ; avoid negative
cmp ah,020h
; anything greater means 8086 - but 80 =-1!
; anything less means bit 4 off, i.e 286
; equal implies 386
ret
of course when the CPUID instruction was introduced it made the later
chips much easier to identify!
--
It's a money /life balance.
Back to comp.sys.intel | Previous | Next — Previous in thread | Next in thread | Find similar
How many x86 instructions? Yousuf Khan <bbbl67@spammenot.yahoo.com> - 2014-02-20 18:26 -0500
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-20 17:19 -0800
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-20 17:26 -0800
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-20 17:29 -0800
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-20 17:35 -0800
Re: How many x86 instructions? Yousuf Khan <bbbl67@spammenot.yahoo.com> - 2014-02-20 21:33 -0500
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-20 19:46 -0800
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-20 20:02 -0800
Re: How many x86 instructions? Paul <nospam@needed.com> - 2014-02-20 23:21 -0500
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-20 21:23 -0800
Re: How many x86 instructions? Yousuf Khan <bbbl67@spammenot.yahoo.com> - 2014-02-21 00:55 -0500
Re: How many x86 instructions? "Stanley Daniel de Liver" <admin@127.0.0.1> - 2014-04-25 10:54 +0100
Re: How many x86 instructions? Yousuf Khan <bbbl67@spammenot.yahoo.com> - 2014-04-25 20:58 -0400
Re: How many x86 instructions? "Stanley Daniel de Liver" <admin@127.0.0.1> - 2014-04-26 11:29 +0100
Re: How many x86 instructions? Robert Redelmeier <redelm@ev1.net.invalid> - 2014-02-21 14:23 +0000
Re: How many x86 instructions? Yousuf Khan <bbbl67@spammenot.yahoo.com> - 2014-02-21 14:15 -0500
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-21 11:34 -0800
Re: How many x86 instructions? charlie <cdknospam@msn.com> - 2014-02-23 10:14 -0500
Re: How many x86 instructions? "J. P. Gilliver (John)" <G6JPG@soft255.demon.co.uk> - 2014-02-23 16:37 +0000
Re: How many x86 instructions? charlie <cdknospam@msn.com> - 2014-02-23 17:41 -0500
Re: How many x86 instructions? BillW50 <BillW50@aol.kom> - 2014-02-23 17:15 -0600
Re: How many x86 instructions? Yousuf Khan <bbbl67@spammenot.yahoo.com> - 2014-02-23 19:30 -0500
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-24 12:11 -0800
Re: How many x86 instructions? Jason <jason_warren@ieee.org> - 2014-02-24 18:41 -0500
Re: How many x86 instructions? krw@attt.bizz - 2014-02-23 19:34 -0500
Re: How many x86 instructions? charlie <cdknospam@msn.com> - 2014-02-24 04:42 -0500
Re: How many x86 instructions? Gene E. Bloch <blochxxxx@someplace.invalid> - 2014-02-23 15:45 -0800
Re: How many x86 instructions? BillW50 <BillW50@aol.kom> - 2014-02-23 17:49 -0600
Re: How many x86 instructions? Char Jackson <none@none.invalid> - 2014-02-21 19:03 -0600
Re: How many x86 instructions? Robert Redelmeier <redelm@ev1.net.invalid> - 2014-02-22 02:16 +0000
Re: How many x86 instructions? Yousuf Khan <bbbl67@spammenot.yahoo.com> - 2014-02-21 21:32 -0500
Re: How many x86 instructions? Jason <jason_warren@ieee.org> - 2014-02-23 23:21 -0500
Re: How many x86 instructions? krw@attt.bizz - 2014-02-24 13:02 -0500
Re: How many x86 instructions? Jason <jason_warren@ieee.org> - 2014-02-24 13:38 -0500
Re: How many x86 instructions? krw@attt.bizz - 2014-02-24 14:09 -0500
Re: How many x86 instructions? Jason <jason_warren@ieee.org> - 2014-02-24 16:35 -0500
Re: How many x86 instructions? pedro1492@lycos.com - 2014-03-28 19:50 -0700
Re: How many x86 instructions? Yousuf Khan <bbbl67@spammenot.yahoo.com> - 2014-04-02 09:47 -0400
Re: How many x86 instructions? Robert Redelmeier <redelm@ev1.net.invalid> - 2014-02-25 00:35 +0000
Re: How many x86 instructions? John Doe <jdoe@usenetlove.invalid> - 2014-04-25 03:33 +0000
Re: How many x86 instructions? "Jim" <gtfo@stfu.invalid> - 2014-02-27 01:28 -0500
csiph-web