flat assembler
Message board for the users of flat assembler.

Index > Main > mmx

Author
Thread Post new topic Reply to topic
thecf



Joined: 23 Dec 2006
Posts: 23
thecf
how do i check for mmx support?
Post 24 Dec 2006, 14:17
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Code:
; http://www.sandpile.org/ia32/cpuid.htm
mmx_detect: ; Returns 1 if MMX present, 0 otherwise
mov eax, 1
cpuid
test edx, 800000h
setnz al
ret    

I'm assuming that CPU supports CPUID (support starts from late 486 CPUs)
Post 24 Dec 2006, 14:24
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
This one checks for CPUID presence first
Code:
mmx_detect: ; Returns 1 if MMX present, 0 otherwise 
  pushf
  pop   eax

  pushf
  xor   byte [esp+2], $20
  popf

  pushf
  pop   edx
  cmp   eax, edx
  je    .return

  mov eax, 1 
  cpuid 
  test edx, 800000h 
.return:
  setnz al 
  ret
    
Post 24 Dec 2006, 14:29
View user's profile Send private message Reply with quote
thecf



Joined: 23 Dec 2006
Posts: 23
thecf
thanks guys it works fine
Post 29 Dec 2006, 13:20
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.