home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d536 / chemesthetics.lha / Chemesthetics / Source / Source.LZH / sysinfo.c < prev   
C/C++ Source or Header  |  1991-06-17  |  2KB  |  103 lines

  1. /***************************************************************************
  2. * sysinfo.c: gibt einige Systeminfos mit Hilfe von TextRequest() der       *
  3. *         req.library aus                           *
  4. *                                       *
  5. * created: 16-May-91 Mtwx                           *                              *
  6. * updated: 16-May-91 Mtwx                           *
  7. ***************************************************************************/
  8. #include "messages.h"
  9.  
  10. static struct CPU
  11. {
  12.   char CPU_Id[6];
  13.   char MaC_Id[6];
  14. } CPU;
  15.  
  16. static struct Controls
  17. {
  18.   long size_chip;
  19.   long size_fast;
  20.   long size_total;
  21.   char *CPU_Id;
  22.   char *MaC_Id;
  23. } Controls;
  24.  
  25. static struct TRStructure TRStruct;
  26.  
  27. extern struct ReqLib *ReqBase;
  28.  
  29. static struct CPU CheckCPU(void);
  30.  
  31. void      SysInfo(void)
  32. {
  33.   char        Text[1024];
  34.  
  35.   Controls.size_chip = AvailMem(MEMF_CHIP);
  36.   Controls.size_fast = AvailMem(MEMF_FAST);
  37.   Controls.size_total=Controls.size_chip+Controls.size_fast;
  38.   strcpy(Text,"System Info:\n\n");
  39.   strcat(Text,FREE_CHIP);
  40.   strcat(Text,FREE_FAST);
  41.   strcat(Text,FREE_TOTAL);
  42.   CPU = CheckCPU();
  43.   strcat(Text,"CPU-Type         : %5s\n");
  44.   Controls.CPU_Id=CPU.CPU_Id;
  45.   strcat(Text,"Math Coprocessor : %5s");
  46.   Controls.MaC_Id=CPU.MaC_Id;
  47.   TRStruct.Text=Text;
  48.   TRStruct.Controls=(char *) &Controls;
  49.   TRStruct.NegativeText=RESUME_TEXT;
  50.   TRStruct.Title="System-Information";
  51.   TRStruct.textcolor=8;
  52.   TextRequest(&TRStruct);
  53. }
  54.  
  55. static struct CPU CheckCPU(void)
  56. {
  57.   char        banner[6];
  58.  
  59.               /* set up Intuition/AmigaDOS structure pointers */
  60.   struct DOSBase *DOSBase;
  61.   struct ExecBase **SysBase;
  62.   register struct ExecBase *ExecBase;
  63.  
  64.              /* define other variables as registers,
  65.               to save space */
  66.   register int attnflag;           /* processor type bits from ExecBase struct */
  67.  
  68.   strcpy(banner,"680");
  69.   strcpy(CPU.CPU_Id,"");
  70.   strcpy(CPU.MaC_Id,"");
  71.  
  72.              /* Set up the ExecBase pointer manually,
  73.               since we don't link with anybody */
  74.   SysBase = (struct ExecBase **) (4L);
  75.   ExecBase = *SysBase;
  76.   DOSBase = (struct DOSBase *) ReqBase->DosLib;
  77.  
  78.              /* Only read the ExecBase structure once,
  79.               to save space */
  80.   attnflag = ExecBase->AttnFlags;
  81.  
  82.   if (attnflag & AFF_68020)
  83.     strcat(banner,"20");
  84.   else
  85.   {
  86.     if (attnflag & AFF_68010)
  87.       strcat(banner,"10");
  88.     else
  89.       strcat(banner,"00");
  90.   }
  91.  
  92.   strcpy(CPU.CPU_Id, banner);
  93.  
  94.              /* check for math co-processor */
  95.   if (attnflag & AFF_68881)
  96.     strcpy(CPU.MaC_Id, "68881");
  97.   else
  98.     strcpy(CPU.MaC_Id, "-----");
  99.  
  100.              /* Clean up and go home */
  101.   return (CPU);
  102. }
  103.