1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

How many x86 instructions?

Discussion in 'Intel' started by Yousuf Khan, Feb 20, 2014.

  1. On Sat, 26 Apr 2014 01:58:41 +0100, Yousuf Khan
    <> wrote:

    > On 25/04/2014 5:54 AM, Stanley Daniel de Liver wrote:
    >> On Fri, 21 Feb 2014 05:55:02 -0000, Yousuf Khan
    >> <> 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.
     
    Stanley Daniel de Liver, Apr 26, 2014
    #41
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wheel
    Replies:
    6
    Views:
    470
    wheel
    Feb 21, 2004
  2. Uncle Vinnie

    1.2 Tualitan- how many volts is too many?

    Uncle Vinnie, Jul 16, 2005, in forum: Overclocking
    Replies:
    21
    Views:
    1,047
    Fishface
    Jul 23, 2005
  3. AnotherAnonymous

    Many many errors...

    AnotherAnonymous, Mar 26, 2007, in forum: Gigabyte
    Replies:
    3
    Views:
    796
  4. Peter

    Many, many COM ports "in use"...

    Peter, Mar 16, 2005, in forum: Tablet PC
    Replies:
    5
    Views:
    494
    Chris H.
    Mar 21, 2005
  5. Albretch Mueller
    Replies:
    11
    Views:
    633
    vladitx
    Dec 16, 2009
Loading...