danw@jacobs.cs.orst.edu (Dan Whitaker) (10/23/90)
For all of you that have been looking for a fool proof way to tell a 386DX from a 386SX, there it is. (Source code included) This program works on all existing 386's. It should be assume that when Advanced Micro Devices (AMD) comes out with it's 386sx chip that it will not have the bug in it that allows this program to work. The program displays a simple message that tells what kind of processor you are working on. This is quick and dirty code, so be careful. I assume that anyone that uses this code is would use it wisely. By that I mean, don't purposely disable your code so it won't work on an SX or something like that. FLAME ON [ I hope AMD kicks Intels butt in it's current lawsuit, Intel deserves it for the way it treats it's smaller customers.] FLAME OFF Dan Whitaker wk (503) 757-0934 FAX (503) 757-7350 The following code is written in Borlands Turbo Assembler ======================================================= DOSSEG .MODEL MEDIUM .386P .STACK 100h .DATA have386dx DB 'You have a 386DX',13,10,'$' have386sx DB 'You have a 386sx',13,10,'$' .CODE mov eax,CR0 ;Read in the CR0 register and eax,0ffefh ;set the 5th bit to 0 mov CR0,eax ;write out modified register to reset CR0 mov eax,CR0 ;Read it back in to see if it changed and eax,00010h ;set register to 0 if 5th bit was zero jnz sxchip ;see if it is sx mov ax,@data ;lets display the dx message mov ds,ax ;set DS to point to the data segment mov ah,9 ;DOS print string function mov dx,OFFSET have386dx ;point to dx message int 21h ;display the message jmp exit sxchip: mov ax,@data mov ds,ax ;set DS to point to the data segment mov ah,9 ;DOS print string function mov dx,OFFSET have386sx ;point to sx message int 21h ;display message exit: mov ah,4ch ;DOS terminate program function int 21h ;terminate the program END =======================================================