home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 402.lha / ECS_Test / ecs.c < prev    next >
C/C++ Source or Header  |  1990-07-26  |  4KB  |  103 lines

  1. echo ; /*  Note that this declares an int available externally
  2.  lc -cfikrsu -b1 -d0 -v -qram: -ms -O -y ecs.c
  3.  blink ecs.o TO ecs MAP ecs.map,FHLOSX,PLAIN LIB lib:amiga.lib DEFINE _stdout=_echo SMALLDATA SMALLCODE NODEBUG VERBOSE
  4.  quit
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <exec/types.h>
  9. #include "exec/exec.h"
  10. #include "exec/execbase.h"
  11. #include <graphics/gfxbase.h>
  12. #include <hardware/custom.h>
  13. #include "libraries/dos.h"
  14. #include "proto/exec.h"
  15. #include "proto/dos.h"
  16.  
  17. #undef printf /* Disable Lattice 5.0 Auto-Conversion of printf() */
  18.               /* into _writes() and _tinyprintf()                */
  19.  
  20. /**********************/
  21. /* Global Definitions */
  22. /**********************/
  23. #define GFXF_HR_AGNUS   1    /* Defined in v1.4 Alpha Includes     */
  24. #define GFXF_HR_DENISE  2    /* Defined in v1.4 Alpha Includes     */
  25.  
  26. /********************/
  27. /* Global Variables */
  28. /********************/
  29. struct GfxBase    *GfxBase;  /* Graphics.Library Base Vector       */
  30. struct DosLibrary *DOSBase;  /* Dos.Library      Base Vector       */
  31.  
  32.                              /* Pickup a Ptr to Custom Chip Region */
  33. struct Custom     *chips = (struct Custom *)0xDFF000;
  34.  
  35. /***********************/
  36. /* Function Prototypes */
  37. /***********************/
  38. void ecs(void);
  39. int  printf(char *, );
  40.  
  41. /**********************************************************************/
  42. /*         Enhanced Chipset (ECS) Detector Program (June '89)         */
  43. /*              Public Domain - Do With It What You Will              *
  44. /*                                                                    */
  45. /*   by Jeff Rush                                                     */
  46. /*      Sysop of Rising Star BBS @ (214) 231-1372                     */
  47. /*      Fidonet: 1:124/4206                                           */
  48. /*      BIX:     jrush                                                */
  49. /*                                                                    */
  50. /**********************************************************************/
  51. void
  52. ecs()
  53. {
  54.     UWORD agnus_id, denise_id;
  55.     UBYTE osflags;
  56.  
  57.     if (!(DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",0)))
  58.         return;
  59.  
  60.     echo = (int)Output();
  61.  
  62.     printf("Enhanced Chipset (ECS) Detector Program, June '89\n");
  63.     printf("Full Public Domain - Do What You Will\n\n");
  64.  
  65.     agnus_id  = (chips->vposr    & 0x7F00);
  66.     denise_id = (chips->pad7c[0] & 0x00FF);;
  67.  
  68.     printf("Hardware Present:\n");
  69.     switch (agnus_id) {
  70.     case 0x0000: printf("  Normal Agnus Chip (PAL)\n");  break;
  71.     case 0x1000: printf("  Normal Agnus Chip (NTSC)\n"); break;
  72.     case 0x2000: printf("  Super Agnus Chip (PAL)\n");   break;
  73.     case 0x3000: printf("  Super Agnus Chip (NTCS)\n");  break;
  74.     default:     printf("  Unrecognized Agnus Chip (ID# 0x%04X)\n", agnus_id); break;
  75.     }
  76.  
  77.     if (denise_id == 0x00FC) printf("  Super Denise Chip\n");
  78.     else                     printf("  Normal Denise Chip\n");
  79.  
  80.     printf("\n");
  81.  
  82.     GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 0);
  83.     if (GfxBase != NULL) {
  84.         osflags = (GfxBase->reserved[0] >> 24) & 0x000000FF;
  85.  
  86.         if (agnus_id == 0x2000 || agnus_id == 0x3000) { /* If Super Agnus Present */
  87.             printf("Operating System is %s of the Presence of the Super Agnus Chip\n",
  88.                 (osflags & GFXF_HR_AGNUS) ? "Aware" : "-Unaware-");
  89.         }
  90.  
  91.         if (denise_id == 0x00FC) { /* If Super Denise Present */
  92.             printf("Operating System is %s of the Presence of the Super Denise Chip\n",
  93.                 (osflags & GFXF_HR_DENISE) ? "Aware" : "-Unaware-");
  94.         }
  95.  
  96.         CloseLibrary((struct Library *)GfxBase);
  97.     } else
  98.         printf("Error - Unable to Open GRAPHICS.LIBRARY\n");
  99.  
  100.     CloseLibrary((struct Library *)DOSBase);
  101. }
  102.  
  103.