Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.intel > #344

Re: How many x86 instructions?

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-25 10:54 +0100
Organization dis
Message-ID <op.xeu9shxuo4et73@dell3100> (permalink)
References <53068f25$1@news.bnb-lp.com> <le69i5$2vq$1@news.albasani.net> <5306baeb$1@news.bnb-lp.com> <le6k8c$pt5$1@dont-email.me> <5306ea35$1@news.bnb-lp.com>

Cross-posted to 3 groups.

Show all headers | View raw


On Fri, 21 Feb 2014 05:55:02 -0000, Yousuf Khan  
<bbbl67@spammenot.yahoo.com> wrote:

> On 20/02/2014 11:21 PM, Paul wrote:
>> At one time, a compiler would issue instructions
>> from about 30% of the instruction set. It would mean
>> a compiled program would never emit the other 70% of
>> them. But a person writing assembler code, would
>> have access to all of them, at least, as long as
>> the mnemonic existed in the assembler.
>
> I think the original idea of the x86's large instruction count was to  
> make an assembly language as full-featured as a high-level language. x86  
> even had string-handling instructions!
>
> 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. :)
>
> 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

code segment
assume cs:code,ds:code
.radix 16
org 100

mov ax,1
mov cx,32
shl ax,cl
jnz x186

;pusha
   db '60'
stc
jc nec

mov ax,cs
add ax,01000h
mov es,ax
xor si,si
mov di,100h
mov cx,08000h
;rep es movsb
rep es:movsb
or cx,cx
jz cmos
nmos:
mov ax,0
jmp x8_16
cmos:
mov ax,2
jmp x8_16
nec:
mov ax,4
jmp x8_16
x186:
push sp
pop ax
cmp ax,sp
jz x286

mov ax,6
x8_16:
xor bx,bx
mov byte [a1],043h
a1 label byte
nop
or bx,bx
jnz t1
or bx,1
t1:
jmp cpuid_end
x286:
pushf
pop ax
or ah,070h
push ax
popf
pushf
pop ax
and ax,07000h
jnz x386

mov ax,8
jmp cpuid_end
x386:
mov ax,0Ah

cpuid_end:


code ends

end


-- 
It's a money /life balance.

Back to comp.sys.intel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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