home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / Devcon_Extras / Example_Code / 68020 / ShowCpu.c next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  1.1 KB  |  41 lines

  1. /*
  2.  
  3.     Quick program to show how to detect what processor the Amiga is
  4.     running.  This program is not as powerful as the SetCpu program.
  5.  
  6.  */
  7. #include "exec/types.h"
  8. #include "exec/execbase.h"
  9.  
  10. #define AFB_68030 2        /* New flag for 68030 processor. THIS FLAG    */
  11. #define AFF_68030 (1<<2)   /* is not set by V1.2 or V1.3 Kickstart,    */
  12.               /* but will be supported in Kickstart V1.4! */
  13.  
  14. /* declare SysBase to point to struct ExecBase */
  15. extern struct ExecBase *SysBase;
  16.  
  17.  
  18. void main()
  19. {
  20. UWORD    flags;
  21.  
  22.     flags=SysBase->AttnFlags;    /* get flags */
  23.  
  24.     printf("SysBase->AttnFlags=$%x\n",flags);
  25.  
  26.     /* The 68010 flag remains set for the 68020, the 68020 flag
  27.        remains set for the 68030, etc. */
  28.     if(flags & AFF_68030)
  29.     printf("68030 Central Processing Unit (CPU) installed\n");
  30.     else if(flags & AFF_68020)
  31.     printf("68020 [or 68030] Central Processing Unit (CPU) installed\n");
  32.     else if(flags & AFF_68010)
  33.     printf("68010 Central Processing Unit (CPU) installed\n");
  34.     else
  35.     printf("68000 Central Processing Unit (CPU) installed\n");
  36.  
  37.     if(flags & AFF_68881)
  38.     printf("68881 Floating Point Math Coprocessor installed\n");
  39. }
  40.  
  41.