41 lines
1.5 KiB
NASM
41 lines
1.5 KiB
NASM
|
; pentbug.asm
|
||
|
;
|
||
|
; tests for the existence of the well-documented Pentium NPU bug
|
||
|
;
|
||
|
; assemble and run this program using Borland's TASM and run under DOS:
|
||
|
;
|
||
|
; TASM pentbug ; one pass assemble
|
||
|
; TLINK /Tdc pentbug ; link as COM file
|
||
|
; PENTBUG ; run the program...
|
||
|
;
|
||
|
.MODEL tiny
|
||
|
.386
|
||
|
.387
|
||
|
|
||
|
.CODE
|
||
|
ORG 100h
|
||
|
Start:
|
||
|
mov dx,OFFSET okmsg ; start out optimistically
|
||
|
fild [first] ; load the first number (x)
|
||
|
fild [second] ; and the second (y)
|
||
|
fdiv st(1),st ; perform y/x
|
||
|
fmulp st(1),st ; now st(0) = (y/x)*x
|
||
|
fild [first] ; reload y
|
||
|
fcompp ; compare the two
|
||
|
fnstsw ax ; put status word into ax
|
||
|
sahf ; load into CPU flags
|
||
|
jz short @@NoBug ; if they're equal, no bug
|
||
|
mov dx,OFFSET bugmsg ; load bad news message...
|
||
|
@@NoBug:
|
||
|
mov ah,9 ; print appropriate message
|
||
|
int 21h ;
|
||
|
mov ah,4ch ; and exit
|
||
|
int 21h ;
|
||
|
|
||
|
first DD 4195835 ; "magic numbers" culled from
|
||
|
second DD 3145727 ; the net. There are others...
|
||
|
|
||
|
okmsg DB "No "
|
||
|
bugmsg DB "Pentium bug found.",13,10,'$'
|
||
|
|
||
|
END Start
|