home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 13 / AACD13.ISO / AACD / Games / WHDLoad / Src / gci / wincpu.c < prev    next >
C/C++ Source or Header  |  2000-08-10  |  7KB  |  213 lines

  1. /*****************************************************************************
  2. ;  :Module.    wincpu.c
  3. ;  :Author.    Bert Jahn
  4. ;  :EMail.    wepl@whdload.org
  5. ;  :Address.    Franz-Liszt-Straße 16, Rudolstadt, 07404, Germany
  6. ;  :Version.    $Id: wincpu.c 0.5 2000/06/04 20:55:21 jah Exp $
  7. ;  :History.    18.07.98 started
  8. ;        03.03.00 bubble help added to all fields
  9. ;             some cleanup
  10. ;        28.03.00 more cleanup
  11. ;  :Copyright.    All Rights Reserved
  12. ;  :Language.    C
  13. ;  :Translator.    GCC
  14. ****************************************************************************/
  15.  
  16. #include <libraries/mui.h>
  17. #include <exec/execbase.h>
  18.  
  19. #include <clib/alib_protos.h>
  20. #include <clib/muimaster_protos.h>
  21.  
  22. #include "whddump.h"
  23. #include "WHDLoadGCI.h"
  24.  
  25. /****************************************************************************/
  26.  
  27. extern APTR            app,win;
  28. extern struct whddump_header    *header;
  29. extern struct whddump_cpu    *cpu;
  30. extern const char        *StringHexAccept;
  31. extern struct Library        *MUIMasterBase;
  32.  
  33. /****************************************************************************/
  34.  
  35. APTR win_cpu = NULL;
  36.  
  37. /****************************************************************************/
  38.  
  39. void make_win_cpu(void) {
  40.     ULONG open;
  41.     APTR
  42.         regmsp=0,
  43.         regcaar=0,
  44.         regcacr=0,
  45.         regpcr=0,
  46.         regbuscr=0;
  47.     const char
  48.         *sfc="SFC:",
  49.         *dfc="DFC:",
  50.         *vbr="VBR:",
  51.         *msp="MSP:",
  52.         *caar="CAAR:",
  53.         *cacr="CACR:",
  54.         *tc="TC:",
  55.         *crp="CRP:",
  56.         *srp="SRP:",
  57.         *urp="URP:",
  58.         *mmusr="MMUSR:",
  59.         *tt0="TT0:",
  60.         *tt1="TT1:",
  61.         *dtt0="DTT0:",
  62.         *dtt1="DTT1:",
  63.         *itt0="ITT0:",
  64.         *itt1="ITT1:",
  65.         *sfc_h="Source Function Code",
  66.         *dfc_h="Destination Function Code",
  67.         *vbr_h="Vector Base Register",
  68.         *msp_h="Master Stack Pointer",
  69.         *caar_h="Cache Address Register",
  70.         *cacr_h="Cache Control Register",
  71.         *tc_h="Translation Control (MMU)",
  72.         *crp_h="CPU Root Pointer (MMU)",
  73.         *srp_h="Supervisor Root Pointer (MMU)",
  74.         *urp_h="User Root Pointer (MMU)",
  75.         *mmusr_h="MMU Status Register",
  76.         *tt0_h="Transparent Translation 0",
  77.         *tt1_h="Transparent Translation 1",
  78.         *dtt0_h="Data Transparent Translation 0",
  79.         *dtt1_h="Data Transparent Translation 1",
  80.         *itt0_h="Instruction Transparent Translation 0",
  81.         *itt1_h="Instruction Transparent Translation 1",
  82.         *t_morecpu="More CPU";
  83.  
  84.     if (win_cpu) {
  85.         get(win_cpu,MUIA_Window_Open,&open);
  86.         if (open)    set(win_cpu,MUIA_Window_Open,FALSE);
  87.         else        set(win_cpu,MUIA_Window_Open,TRUE);
  88.     } else {
  89.         switch ((header->wdh_CPU)&(AFF_68010|AFF_68020|AFF_68030|AFF_68040|AFF_68060)) {
  90.         case 0:
  91.             win_cpu = WindowObject,
  92.                 MUIA_Window_Title, t_morecpu,
  93.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  94.                 WindowContents,
  95.                     TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68000", End,
  96.                 End;
  97.             break;
  98.         case AFF_68010:
  99.             win_cpu = WindowObject,
  100.                 MUIA_Window_Title, t_morecpu,
  101.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  102.                 WindowContents, VGroup,
  103.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68010", End,
  104.                     Child, HGroup, MUIA_Group_Columns, 2,
  105.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  106.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  107.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  108.                         End,
  109.                     End,
  110.                 End;
  111.             break;
  112.         case AFF_68010|AFF_68020:
  113.             win_cpu = WindowObject,
  114.                 MUIA_Window_Title, t_morecpu,
  115.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  116.                 WindowContents, VGroup,
  117.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68020", End,
  118.                     Child, HGroup, MUIA_Group_Columns, 2,
  119.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  120.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  121.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  122.                         RegisterC(regmsp,msp,msp_h,cpu->wdc_msp,8),
  123.                         RegisterC(regcaar,caar,caar_h,cpu->wdc_caar,8),
  124.                         RegisterC(regcacr,cacr,cacr_h,cpu->wdc_cacr,8),
  125.                         End,
  126.                     End,
  127.                 End;
  128.             break;
  129.         case AFF_68010|AFF_68020|AFF_68030:
  130.             win_cpu = WindowObject,
  131.                 MUIA_Window_Title, t_morecpu,
  132.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  133.                 WindowContents, VGroup,
  134.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68030", End,
  135.                     Child, HGroup, MUIA_Group_Columns, 2,
  136.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  137.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  138.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  139.                         RegisterC(regmsp,msp,msp_h,cpu->wdc_msp,8),
  140.                         RegisterC(regcaar,caar,caar_h,cpu->wdc_caar,8),
  141.                         RegisterC(regcacr,cacr,cacr_h,cpu->wdc_cacr,8),
  142.                         Register(tc,tc_h,cpu->wdc_tc),
  143.                         Register64(crp,crp_h,cpu->wdc_crp[0],cpu->wdc_crp[1]),
  144.                         Register64(srp,srp_h,cpu->wdc_srp[0],cpu->wdc_srp[1]),
  145.                         Register(mmusr,mmusr_h,cpu->wdc_mmusr),
  146.                         Register(tt0,tt0_h,cpu->wdc_tt0),
  147.                         Register(tt1,tt1_h,cpu->wdc_tt1),
  148.                         End,
  149.                     End,
  150.                 End;
  151.             break;
  152.         case AFF_68010|AFF_68020|AFF_68030|AFF_68040:
  153.             win_cpu = WindowObject,
  154.                 MUIA_Window_Title, t_morecpu,
  155.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  156.                 WindowContents, VGroup,
  157.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68040", End,
  158.                     Child, HGroup, MUIA_Group_Columns, 2,
  159.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  160.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  161.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  162.                         RegisterC(regmsp,msp,msp_h,cpu->wdc_msp,8),
  163.                         RegisterC(regcacr,cacr,cacr_h,cpu->wdc_cacr,8),
  164.                         Register(tc,tc_h,cpu->wdc_tc),
  165.                         Register(srp,srp_h,cpu->wdc_srp[0]),
  166.                         Register(urp,urp_h,cpu->wdc_urp),
  167.                         Register(mmusr,mmusr_h,cpu->wdc_mmusr),
  168.                         Register(dtt0,dtt0_h,cpu->wdc_dtt0),
  169.                         Register(dtt1,dtt1_h,cpu->wdc_dtt1),
  170.                         Register(itt0,itt0_h,cpu->wdc_itt0),
  171.                         Register(itt1,itt1_h,cpu->wdc_itt1),
  172.                         End,
  173.                     End,
  174.                 End;
  175.             break;
  176.         case AFF_68010|AFF_68020|AFF_68030|AFF_68040|AFF_68060:
  177.             win_cpu = WindowObject,
  178.                 MUIA_Window_Title, t_morecpu,
  179.                 MUIA_Window_ID   , MAKE_ID('C','P','U',' '),
  180.                 WindowContents, VGroup,
  181.                     Child, TextObject, GroupFrame, MUIA_Text_Contents, "\33cMC68060", End,
  182.                     Child, HGroup, MUIA_Group_Columns, 2,
  183.                         Register(sfc,sfc_h,cpu->wdc_sfc),
  184.                         Register(dfc,dfc_h,cpu->wdc_dfc),
  185.                         Register(vbr,vbr_h,cpu->wdc_vbr),
  186.                         RegisterC(regcacr,cacr,cacr_h,cpu->wdc_cacr,8),
  187.                         RegisterC(regpcr,"PCR:","Processor Configuration Register",cpu->wdc_pcr,8),
  188.                         RegisterC(regbuscr,"BUSCR:","Bus Control Register",cpu->wdc_buscr,8),
  189.                         Register(tc,tc_h,cpu->wdc_tc),
  190.                         Register(srp,srp_h,cpu->wdc_srp[0]),
  191.                         Register(urp,urp_h,cpu->wdc_urp),
  192.                         Register(dtt0,dtt0_h,cpu->wdc_dtt0),
  193.                         Register(dtt1,dtt1_h,cpu->wdc_dtt1),
  194.                         Register(itt0,itt0_h,cpu->wdc_itt0),
  195.                         Register(itt1,itt1_h,cpu->wdc_itt1),
  196.                         End,
  197.                     End,
  198.                 End;
  199.             break;
  200.         }
  201.         if (win_cpu) {
  202.             DoMethod(app,OM_ADDMEMBER,win_cpu);
  203.             DoMethod(win_cpu,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,app,2,MUIM_Application_ReturnID,MAIN_MORECPU);
  204.             set(win_cpu,MUIA_Window_Open,TRUE);
  205.         } else {
  206.             MUI_Request(app,win,0,NULL,"Ok","Couldn't open CPU window.");
  207.         }
  208.     }
  209. }
  210.  
  211. /****************************************************************************/
  212.  
  213.