Page 1 of 1
Detecting Processors
Posted: Fri Nov 15, 2002 9:53 am
by jcout_bsi
I need some Assembly code to detect processors so that i can use pre optimized code. Start with a 386 and move to P4 and AMD 2100+ XP... Start with 386 because 386 or lower will not be able to run my code.(Could just would take a lot longer that you would be willing to sit and wait.)
Re:Detecting Processors
Posted: Fri Nov 15, 2002 10:58 am
by Curufir
386 -> 586 detection is a nightmare and basically depends on certain features being present/not present/broken. Detecting as greater than 286 is easy enough (There's tutorials littered all over the web, mostly in bootsectors), but detecting model is problematic at best (Wouldn't be if whichever morons programmed BIOS didn't remove the information before handing it to your code).
After 586 use the cpuid instruction, it's well documented and will detect processor model, stepping and all those other fun things.
Curufir
Re:Detecting Processors
Posted: Sat Nov 16, 2002 1:35 am
by K.J.
Look around on Dr. Dobbs Journal website(
http://ddj.com/) there was an article there about a year ago that talked about identifying 386, 486, and the original pentiums(after the original pentium, just use cpuid like Curufir said).
K.J.