2012年7月4日星期三

cpu.asm


.586
.model flat,stdcall
Option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
.data
correy byte "made by correy",0
ver byte "email:leguanyuan@126.com",0dh,0ah,0dh,0ah,"next is you cpu Parameters",0dh,0ah,"VendorID ="
body byte 99 dup (0)
.code
start:
                mov     eax, 0
                cpuid
                mov     dword ptr body, ebx
                mov     dword ptr body+4, edx
                mov     dword ptr body+8, ecx
                invoke MessageBox,NULL,addr ver,addr correy,0
                ret
end             start
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.686
.k3d
.mmx
.xmm
.model flat, stdcall
option casemap:none
include windows.inc
include user32.inc
include kernel32.inc
includelib kernel32.lib
includelib user32.lib
assume fs:flat
.code
szCapt          db      "CPU Speed:", 0
szFormat        db      "%lu MHz", 0
szBuffer        db      32 dup (?)
lpResult        db      32 dup (?)
delay           dd      1000
constant        dd      1000
start:
  finit
  emms
  rdtsc
  push    eax
  push    1000
  call    Sleep
  rdtsc
  pop     ebx
  sub     eax, ebx
  push    eax
  fild    dword ptr [constant]
  fild    dword ptr [delay]
  fmulp   st(1), st
  fild    dword ptr [esp]
  fxch
  fdivp   st(1), st
  frndint
  push    eax
  fistp   dword ptr [esp]
  push    offset szFormat
  push    offset lpResult
  call    wsprintfA
  add     sp, 4*3+4
  push    0
  push    offset szCapt
  push    offset lpResult
  push    0
  call    MessageBoxA
  ret
end start

没有评论:

发表评论