CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Support and general discussion.
Post Reply
ibmpc5150
Posts: 12
Joined: Sat 17 Jan, 2015 6:17 pm

CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by ibmpc5150 » Mon 04 Dec, 2017 9:20 am

According to PCEM emulator, CPU ID is recognized as NEC V20 on PC-Tools 4.x

*CPU ID:NEC V20 on PCEM or 86box
Image

I think it can't be changed to Intel 8088.

So I wonder it is impossible to implement CPU ID as Intel 8088.

User avatar
omarsis81
Posts: 838
Joined: Thu 17 Dec, 2015 6:20 pm

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by omarsis81 » Mon 04 Dec, 2017 2:08 pm

Does it happen in al 8088 machines?

ibmpc5150
Posts: 12
Joined: Sat 17 Jan, 2015 6:17 pm

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by ibmpc5150 » Mon 19 Feb, 2018 8:56 pm

@omarsis81

No.

It stills appears as NEC V20 on PCEM.

Image

I think this emulation is Not equal to Intel 8088, but NEC V20.

I hope PCEM add i8088 emulation correctly.

User avatar
omarsis81
Posts: 838
Joined: Thu 17 Dec, 2015 6:20 pm

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by omarsis81 » Sun 04 Mar, 2018 11:44 am

No, NEC V20 is not emulated, PCem is closer to 8088 than NEC V20 according to this post viewtopic.php?p=3504
This must be a minor bug in the way PC Tools detects the CPU.
MAYBE you set the clock above the 4.77 and PC Tools thinks you have a NEC V20?

ibmpc5150
Posts: 12
Joined: Sat 17 Jan, 2015 6:17 pm

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by ibmpc5150 » Sun 04 Mar, 2018 8:16 pm

@omarsis81

I tested it as $4.77Mhz with another PC-Tools version too.
This seems to be bug on PCEM/86box, Not PC-Tools.

Why not test it if you doubt?

User avatar
omarsis81
Posts: 838
Joined: Thu 17 Dec, 2015 6:20 pm

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by omarsis81 » Mon 05 Mar, 2018 1:30 am

I don't doubt about what you said, I only mention a possibility, but since you already tested with 4.77 mhz there must be a PCem's bug

EluanCM
Posts: 105
Joined: Tue 27 Oct, 2015 2:07 pm
Location: Brazil
Contact:

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by EluanCM » Mon 05 Mar, 2018 1:24 pm

Quick note: the recently added Xi8088 BIOS knows how to differentiate between new/old 8088s and NEC V20 and works fine with PCem (detects as old 8088)

Greatpsycho
Posts: 137
Joined: Tue 22 Mar, 2016 10:03 am
Location: Korea
Contact:

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by Greatpsycho » Sat 28 Mar, 2020 1:06 pm

ibmpc5150 wrote:
Mon 19 Feb, 2018 8:56 pm
I hope PCEM add i8088 emulation correctly.
I found the code that distinguishes the NEC V series from the Intel 8086/8088 series. Full source code link is [url=http://www.dcee.net/Files/Programm/C/cputype.arj]here[/url]. This REP bug in the Intel 8086/8088 CPU mentioned in the comments in the code below should be implemented.

Code: Select all

 ; This test differentiates the NEC V20/V30 between the 8088/8086
 ;
 ;   This is done by testing for a bug in the 8088/8086.  In the
 ;   Intel CPUs, if a repeated string instruction with a segment
 ;   override is interrupted by a hardware interrupt, the
 ;   instruction is not continued.


       mov      dl,cpuV20          ; load code for NEC V20
       sti                         ; enable interrupts
       push     si                 ; save si ( could be a register variable)
       mov      si,0               ; Starting with first byte in es
       mov      cx,0ffffh          ; read a complete segment
       rep      lods byte ptr es:[si]  ; rep with a segment override
       ; hardware interrupt is sure to occur during the above instruction
       pop      si                 ; restore si
       or       cx,cx              ; has entire segment been read?
       je       @@t8_16            ; YES: V20 or V30
       mov      dl,cpu8088         ; NO:  must be 8088 or 8086

User avatar
ruben_balea
Posts: 121
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by ruben_balea » Sun 29 Mar, 2020 7:58 pm

This other program can tell the very exact CPU including bus width:

Code: Select all

; ********************************************************************
; *                                                                  *
; *  CPU v2.2  (c) Septiembre 1992 CiriSOFT                          *
; *            (c) Grupo Universitario de Informática - Valladolid   *
; *                                                                  *
; *    Este programa determina el tipo de microprocesador del equipo *
; *  y devuelve un código ERRORLEVEL indicándolo:                    *
; *                                                                  *
; *               0-8088, 1-8086, 2-NEC V20, 3-NEC V30,              *
; *               4-80188, 5-80186, 6-286, 7-386, 8-486              *
; *                                                                  *
; *   Aviso: Utilizar TASM 2.0 o compatible exclusivamente.          *
; *                                                                  *
; ********************************************************************


cpu            SEGMENT
               ASSUME CS:cpu, DS:cpu

               .386

               ORG   100h
inicio:
               LEA   DX,texto_ini      ; texto de saludo
               MOV   AH,9
               INT   21h               ; imprimirlo
               CALL  procesador?       ; tipo de procesador en AX
               PUSH  AX                ; guardarlo para el final
               LEA   BX,cpus_indice-2  ; tabla de nombres-2
               MOV   CX,0FFFFh         ; número de iteración-1
otro_proc:     INC   CX
               ADD   BX,2
               MOV   DX,[BX]           ; nombre del primer procesador
               CALL  print
               CMP   CX,AX             ; ¿procesador del equipo?
               JNE   no_es_este
               LEA   DX,apuntador_txt  ; sí lo es: indicarlo
               CALL  print
no_es_este:    LEA   DX,separador_txt
               CALL  print
               CMP   CX,7              ; número de CPUs tratadas-1
               JBE   otro_proc
               LEA   DX,texto_fin      ; últimos caracteres
               CALL  print
               MOV   AH,4Ch            ; retornar código errorlevel AL
               INT   21h               ; fin de programa


procesador?    PROC        ; devolver el tipo de microprocesador en AX
               PUSHF
               PUSH  DS
               PUSH  ES
               PUSH  CX
               PUSH  DX
               PUSH  DI
               PUSH  SI
               MOV   AX,CS
               MOV   DS,AX         ; durante la rutina se guardará
               MOV   ES,AX         ; el tipo de procesador en DL:
               MOV   DL,6          ; supuesto un 286 (DL=6) ...
               PUSHF
               POP   AX            ; AX = flags
               AND   AX,0FFFh      ; borrar nibble más significativo
               PUSH  AX
               POPF                ; intentar poner a 0 los 4 bits más
               PUSHF               ; significativos de los flags
               POP   AX
               AND   AX,0F000h     ; seguirán valiendo 1 excepto en
               CMP   AX,0F000h     ; un 80286 o superior
               JE    ni286ni_super
               PUSHF               ; es 286 o superior
               POP   AX
               OR    AX,7000h      ; intentar activar bit 12, 13 ó 14
               PUSH  AX
               POPF
               PUSHF
               POP   AX
               AND   AX,7000h      ; 286 pone bits 12, 13 y 14 a cero
               JZ    cpu_hallada   ; es un 286 (DL=6)
               INC   DL            ; es un 386 (DL=7) ... de momento
               PUSH  DX
               CLI                 ; momento crítico
               MOV   EDX,ESP       ; preservar ESP en EDX
               AND   ESP,0FFFFh    ; borrar parte alta de ESP
               AND   ESP,0FFFCh    ; forzar ESP a múltiplo de 4
               PUSHFD              ; guardar flags en pila (32 bits)
               POP   EAX           ; recuperar flags en EAX
               MOV   ECX,EAX
               XOR   EAX,40000h    ; conmutar bit 18
               PUSH  EAX
               POPFD               ; intentar cambiar este bit
               PUSHFD
               POP   EAX           ; ECX conserva el bit inicial
               XOR   EAX,ECX       ; bit 18 de EAX a 1 si cambió
               SHR   EAX,12h       ; mover bit 18 a bit 0
               AND   EAX,1         ; dejar sólo ese bit
               PUSH  ECX
               POPFD               ; restaurar bit 18 de los flags
               MOV   ESP,EDX       ; restaurar ESP
               STI                 ; permitir interrupciones de nuevo
               POP   DX            ; recuperar tipo de CPU en DL
               CMP   AX,0
               JE    cpu_hallada   ; es 386: DL=7 (bit 18 no cambió)
               INC   DL            ; es 486: DL=8 (bit 18 cambió)
               JMP   cpu_hallada
ni286ni_super: MOV   DL,4          ; supuesto un 80188 ...
               MOV   AX,0FFFFh
               MOV   CL,33
               SHL   AX,CL         ; (80188/80186 toman  CL mod 32)
               JNZ   tipo_bus_proc ; ... lo es, calcular bus (188/186)
               MOV   DL,2          ; no lo es, supuesto un V20 ...
               MOV   CX,0FFFFh
               STI
               DB    0F3h,26h,0ACh ; opcode de REPZ  LODSB ES:
               JCXZ  tipo_bus_proc ; ... lo es, calcular bus (V20/V30)
               XOR   DL,DL         ; ya sólo puede ser un 8088/8086
tipo_bus_proc: STD                 ; transferencias hacia arriba
               LEA   DI,tipo_bus_dest
               MOV   AL,BYTE PTR DS:tipo_bus_byte ; opcode de STI
               MOV   CX,3
               CLI
               REP   STOSB         ; transferir tres bytes
               CLD
               NOP                 ; el INC CX (1 byte) será machacado
               NOP                 ; con STOSB pero aún se ejecutará
               NOP                 ; en un 8086/80186/V30 (y no en un
               INC   CX            ; 8088/80188/V20) porque está en la
tipo_bus_byte: STI                 ; cola de lectura adelantada.
tipo_bus_dest: STI
               JCXZ  cpu_hallada   ; el bus ya era supuesto de 8 bits
               INC   DL            ; resulta que es de 16
cpu_hallada:   MOV   AL,DL
               XOR   AH,AH
               POP   SI
               POP   DI
               POP   DX
               POP   CX
               POP   ES
               POP   DS
               POPF
               RET     ; AX = CPU: 0/1-8088/86, 2/3-NEC V20/V30
procesador?    ENDP    ;           4/5-80188/186, 6-286, 7-386, 8-486


print          PROC
               PUSH  AX
               PUSH  BX
               PUSH  CX
               MOV   AH,9
               INT   21h
               POP   CX
               POP   BX
               POP   AX
               RET
print          ENDP

cpus_indice    DW    i88,i86,v20,v30,i188,i186,i286,i386,i486
i88            DB    "Intel 8088 $"
i86            DB    "Intel 8086 $"
v20            DB    " NEC  V20  $"
v30            DB    " NEC  V30  $"
i188           DB    "Intel 80188$"
i186           DB    "Intel 80186$"
i286           DB    "Intel 80286$"
i386           DB    "Intel 80386$"
i486           DB    "Intel 80486$"

apuntador_txt  DB    " <---$"

texto_ini      LABEL BYTE
               DB    13,10,"CPU Test v2.2  "
               DB    "(c) Septiembre 1992 Ciriaco García de Celis."
               DB    13,10,"  El microprocesador de este "
               DB    "equipo es compatible:",10
separador_txt  DB    13,10,9,9,9,"$"
texto_fin      DB    13,10,"$"

cpu            ENDS
               END   inicio

User avatar
Tux
Posts: 16
Joined: Thu 03 May, 2018 6:36 pm
Location: Germany

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by Tux » Mon 30 Mar, 2020 11:32 am

Hmmm, a program with 386-instructions (" .386" at the beginning) running/testing on (e.g.) a NEC V20 or a 286?

But you can take cpulevel from FreeDOS, public domain by Eric Auer 2004-2008.

User avatar
ruben_balea
Posts: 121
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by ruben_balea » Mon 30 Mar, 2020 3:58 pm

Tux wrote:
Mon 30 Mar, 2020 11:32 am
Hmmm, a program with 386-instructions (" .386" at the beginning) running/testing on (e.g.) a NEC V20 or a 286?

But you can take cpulevel from FreeDOS, public domain by Eric Auer 2004-2008.
It only uses 386 instructions on 386 and higher CPUs and CPULEVEL does exactly the same.
.386 was there only to make Tasm 2.0 happy...
Also CPULEVEL won't detect BUS width.

User avatar
Tux
Posts: 16
Joined: Thu 03 May, 2018 6:36 pm
Location: Germany

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by Tux » Mon 30 Mar, 2020 4:55 pm

ruben_balea wrote:
Mon 30 Mar, 2020 3:58 pm
.386 was there only to make Tasm 2.0 happy...
I see, thanks for clarification (didn't check the complete code).
I just compiled cpu.asm with Tasm 2.0 and you are right, it works :)

However, CPULEVEL is Nasm-style syntax and doesn't use this - quite irritating - .386-instruction,
seems to be quite "TASM-special"...

User avatar
ruben_balea
Posts: 121
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: CPU ID:NEC V20 instead of Intel 8088 on PCEM / 86box

Post by ruben_balea » Mon 30 Mar, 2020 5:19 pm

Yes, TASM is very fussy. I don't know a lot of assembler, just enough to understand not too complex code and write very simple programs.

Post Reply