Welcome, Guest. Please login or register.

Author Topic: How to detect CPU?  (Read 3304 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline x303

Re: How to detect CPU?
« on: July 24, 2009, 10:32:59 PM »
What you need is this:

UBYTE *cpu[]= { "MC68000", "MC68010", "MC68020", "MC68030", "XC68040", "XC68060" };
int cpux=0;

int main()
{

UBYTE cpuname[40];
.......
checkcpu();
strcpy(cpuname, "CPU = ");
 strcat(cpuname, cpu[cpux]);
.......
}

void checkcpu(void)
{
  UWORD attn = SysBase->AttnFlags;

  if(attn & AFF_68010)
  {
    cpux=1;
  }
  if(attn & AFF_68020)
  {
    cpux=2;
  }
  if(attn & AFF_68030)
  {
    cpux=3;
  }
  if(attn & AFF_68040)
  {
    cpux=4;
  }
  if(attn & AFF_68060)
  {
    cpux=5;
  }
}

x303 :D :D :D
 

Offline x303

Re: How to detect CPU?
« Reply #1 on: July 25, 2009, 06:25:00 PM »
Quote from: Karlos;516759
Incidentally, AFB_68060/AFF_68060 didn't seem to be #defined in any of my NDK versions.

Have you tried ndk os3.9 ? AFB_68060 and AFF_68060 are defined in exec/execbase.h !!!

x303 :D :D :D
 

Offline x303

Re: How to detect CPU?
« Reply #2 on: July 26, 2009, 03:06:53 AM »
Quote from: JosephC;516852
How does one detect if running on ECS or AGA?

    Taken from RandyAGA.doc:

          LEA     $DFF000,A5
           MOVE.W  $7C(A5),D0      ; DeniseID or LisaID in AGA
           MOVEQ   #30,D2          ; Check 30 times ( prevents old denise random)
           ANDI.W  #%000000011111111,d0    ; low byte only
DENLOOP:
           MOVE.W  $7C(A5),D1      ; Denise ID (LisaID on AGA)
           ANDI.W  #%000000011111111,d1    ; low byte only
           CMP.B   d0,d1           ; same value?
           BNE.S   NOTAGA          ; Not the same value, then OCS Denise!
           DBRA    D2,DENLOOP      ; (THANX TO DDT/HBT FOR MULTICHECK HINT)
           ORI.B   #%11110000,D0   ; MASK AGA REVISION (will work on new aga)
           CMPI.B  #%11111000,D0   ; BIT 3=AGA (this bit will be=0 in AAA!)
           BNE.S   NOTAGA          ; IS THE AGA CHIPSET PRESENT?
           ST.B    AGA             ; Set the AGA flag that will be tested later
NOTAGA:                         ; NOT AGA, BUT IS POSSIBLE AN AAA MACHINE!!

You can find it here: http://aminet.net/docs/misc/RandyAGA.lha

x303 :D :D :D