home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d583 / cpuset.lha / CPUSet / Source / cpuset.s next >
Text File  |  1992-01-04  |  27KB  |  576 lines

  1. ;Program CPUSet by Nic Wilson Assembled with Macro68                
  2.  
  3. ;This source code is copyright Nic Wilson Software
  4. ;it may not be used in whole or in part without
  5. ;permission of Nic Wilson.  It is supplied here as
  6. ;example of how to manipulate the caches of the
  7. ;68020, 68030, 68040 processors.  This source
  8. ;calls some macros that are not included in this
  9. ;source code.  This source code uses the new
  10. ;Motorola syntax and was assembled with Macro68
  11.  
  12.                 
  13.                 incdir "includes:"     
  14.                 MC68040
  15.                 super
  16.                 exeobj
  17.                 maclib  "includes:commonmac/allmacs.mac
  18.                 include "commonmac/macs.i"
  19.                 SECTION main,CODE               
  20.  
  21.                 StartCode                               ;startup stuff
  22. main            move.l    (_argv),d0
  23.                 beq.b     noargs  
  24.                 movea.l   d0,a0
  25.                 movea.l   (a0),a0
  26.                 cmpi.b    #'?',(a0)
  27.                 beq.w     dispusage
  28. noargs          movea.l   (4).w,a6                      ;get execbase
  29.                 move.w    (AttnFlags,a6),d0             ;check for 040
  30.                 btst      #AFB_68040,d0                 ;have we got one?
  31.                 bne.w     do040                         ;yup! do 40 code
  32.                 btst      #AFB_68030,d0                 ;else check 030
  33.                 bne.b     do030                         ;yup! do 30 code
  34.                 btst      #AFB_68020,d0                 ;check for 020
  35.                 beq.w     error                         ;minimum not found
  36.                 movea.l   (4).w,a6
  37.                 cmpi.w    #36,(LIB_VERSION,a6)
  38.                 bge.b     noneed
  39.                 lea       (checkproc,pc),a5
  40.                 CALLEXEC  Supervisor
  41.                 tst.l     d1
  42.                 bpl.b     no040
  43.                 bset.b    #AFB_68040,(AttnFlags+1,a6)
  44.                 bset.b    #AFB_68030,(AttnFlags+1,a6)   ;020 should already be
  45.                 bra.w     do040                         ;set
  46. no040           btst      #CACRB_DBE,d1
  47.                 beq.b     noneed
  48.                 bset.b    #AFB_68030,(AttnFlags+1,a6)
  49.                 bra.b     do030
  50. noneed          lea       (iburst,pc),a0                ;get data burst gad
  51.                 ori.w     #GFLG_DISABLED,(gg_Flags,a0)  ;disable it
  52.                 lea       (dburst,pc),a0                ;get ins burst gad
  53.                 ori.w     #GFLG_DISABLED,(gg_Flags,a0)  ;disable it
  54.                 move.b    #-2,(procflag)                ;set 020 flag
  55.                 bra.b     do020                         ;jump into 030 code
  56. do030           move.b    #-1,(procflag)                ;set 030 flag
  57. do020           lea       (winddatc,pc),a0              ;get second gadget
  58.                 move.l    #dburst,(a0)                  ;put burst gadgets in
  59.                 
  60. ;*********************************************************
  61. ;Initialise the gadgets for the 68020 and 68030 processors
  62. ;*********************************************************                
  63.  
  64.                 tst.l     (_argv)                       ;have we CLI args?
  65.                 bne.w     dodos                         ;do CLI code if so
  66.                 bsr.w     getstat                       ;get current cache modes
  67.                 btst      #CACRB_EnableI,d0             ;check for ICACHE
  68.                 bne.b     checkdc1                      ;if on default settings
  69.                 move.l    #ICText2,(Icache)             ;else put off bg text
  70.                 move.l    #ICText2,(ICa)                ;and put off  fg text
  71.                 ori.w     #SELECTED,(inflag)            ;make gadget selected
  72.                 move.b    #1,(ICText)                   ;reverse bg colour
  73.                 move.b    #2,(ICTextb)                  ;reverse fg colour
  74.  
  75. checkdc1        btst      #CACRB_EnableD,d0             ;check for DCACHE
  76.                 bne.b     checkib1                      ;if on use default
  77.                 move.l    #DCText2,(Dcache)             ;else put off bg text
  78.                 move.l    #DCText2,(DCa)                ;and put on fg text
  79.                 ori.w     #SELECTED,(dflag)             ;make gadget selected
  80.                 move.b    #1,(DCText)                   ;reverse bg colour
  81.                 move.b    #2,(DCTextb)                  ;reverse fg colour
  82.  
  83.                                                         ;we allow 020 through
  84.                                                         ;so they will show 'off'
  85. checkib1        btst      #CACRB_IBE,d0                 ;check for IBURST
  86.                 bne.b     checkdb1                      ;if on use default
  87.                 move.l    #IBText2,(IB)                 ;else put off bg text
  88.                 move.l    #IBText2,(IBa)                ;and put on fg text
  89.                 ori.w     #SELECTED,(ibflag)            ;make it selected
  90.                 move.b    #1,(IBText)                   ;reverse bg colour
  91.                 move.b    #2,(IBTextb)                  ;reverse fg colour
  92.  
  93. checkdb1        btst      #CACRB_DBE,d0                 ;check for DBURST
  94.                 bne.w     dowindow                      ;if on go open window
  95.                 move.l    #DBText2,(DB)                 ;else put off bg text
  96.                 move.l    #DBText2,(DBa)                ;and put on fg text
  97.                 ori.w     #SELECTED,(dbflag)            ;select the gadget
  98.                 move.b    #1,(DBText)                   ;reverse the bg colour
  99.                 move.b    #2,(DBTextb)                  ;reverse the fg colour
  100.                 bra.w     dowindow                      ;and go open the window
  101.         
  102. ;**********************************************
  103. ;Initialise the gadgets for the 68040 processor
  104. ;**********************************************                
  105.  
  106. do040           tst.l     (_argv)                       ;do we have CLI args?
  107.                 bne.w     dodos                         ;do dos code if so
  108.                 bsr.w     getstat                       ;get current cache modes
  109.                 btst      #15,d0                        ;check for ICACHE
  110.                 bne.b     checkdc                       ;default if its on
  111.                 move.l    #ICText2,(Icache)             ;else put off bg text
  112.                 move.l    #ICText2,(ICa)                ;and put on fg text
  113.                 ori.w     #SELECTED,(inflag)            ;select the gadget
  114.                 move.b    #1,(ICText)                   ;reverse the bg colour
  115.                 move.b    #2,(ICTextb)                  ;reverse the fg colour
  116.  
  117. checkdc         btst      #31,d0                        ;check for DCACHE
  118.                 bne.b     checkcb                       ;default if on 
  119.                 move.l    #DCText2,(Dcache)             ;else put off bg text
  120.                 move.l    #DCText2,(DCa)                ;and put on fg text
  121.                 ori.w     #SELECTED,(dflag)             ;select the gadget
  122.                 move.b    #1,(DCText)                   ;reverse the bg colour
  123.                 move.b    #2,(DCTextb)                  ;reverse the fg colour
  124. checkcb         andi.b    #$20,d1                       ;check for Copyback
  125.                 bne.b     dowindow                      ;default if on
  126.                 move.l    #CBText2,(CB)                 ;else put off bg text
  127.                 move.l    #CBText2,(CBa)                ;and put on fg text
  128.                 ori.w     #SELECTED,(cflag)             ;select the gadget
  129.                 move.b    #1,(CBText)                   ;reverse the bg colour
  130.                 move.b    #2,(CBTextb)                  ;reverse the fg colour
  131.  
  132. dowindow        lea       (window,pc),a0                ;get the window
  133.                 CALLINT   OpenWindow                    ;open it
  134.                 tst.l     d0                            ;did it open?
  135.                 beq.w     error                         ;error out if not
  136.                 move.l    d0,(windsave)                 ;save the ptr
  137.  
  138. waitloop        movea.l   (windsave,pc),a0              ;get window ptr
  139.                 movea.l   (wd_UserPort,a0),a0           ;get the msg port
  140.                 moveq     #0,d0                         ;set do WaitPort
  141.                 moveq     #0,d1                         ;set for ReplyMsg
  142.                 WaitMsg                                 ;wait for a msg
  143.                 cmpi.w    #1,(gg_GadgetID,a1)           ;was it ICACHE
  144.                 beq.w     doi                           ;do it if so
  145.                 cmpi.w    #2,(gg_GadgetID,a1)           ;was it DCACHE
  146.                 beq.w     dod                           ;do it if so
  147.                 cmpi.w    #3,(gg_GadgetID,a1)           ;was it third gad
  148.                 beq.w     docb                          ;do it if so
  149.                 cmpi.w    #4,(gg_GadgetID,a1)           ;was it IBURST
  150.                 bne.w     exitwb                        ;must be close so exit
  151.                 
  152.                 bsr.w     getstate                      ;get the gads state
  153.                 tst.l     d0                            ;test the return
  154.                 bmi.b     setiboff                      ;turn it off
  155.                 move.l    #IBText1,(IB)                 ;else on bg text
  156.                 move.l    #IBText1,(IBa)                ;and on fg text
  157.                 move.b    #2,(IBText)                   ;reverse the fg colour
  158.                 move.b    #1,(IBTextb)                  ;reverse the bg colour
  159.                 bsr.w     refresh                       ;refresh the gadget
  160.                 moveq     #0,d3                         ;clear cache bits reg
  161.                 bset      #CACRB_IBE,d3                 ;set cache bits on
  162.                 move.l    d3,d2                         ;set the cache mask
  163.                 bra.w     doit
  164.                 
  165. setiboff        move.l    #IBText2,(IB)                 ;the rest of these are
  166.                 move.l    #IBText2,(IBa)                ;the similar as ones
  167.                 move.b    #1,(IBText)                   ;above
  168.                 move.b    #2,(IBTextb)
  169.                 bsr.w     refresh
  170.                 moveq     #0,d2
  171.                 move.l    d2,d3
  172.                 bset      #CACRB_IBE,d2                 ;set the cache mask
  173.                 bra.w     doit          
  174.                                 
  175. dodb            bsr.w     getstate
  176.                 tst.l     d0
  177.                 bmi.b     setdboff
  178.                 move.l    #DBText1,(DB)
  179.                 move.l    #DBText1,(DBa)
  180.                 move.b    #2,(DBText)
  181.                 move.b    #1,(DBTextb) 
  182.                 bsr.w     refresh
  183.                 moveq     #0,d3
  184.                 bset      #CACRB_DBE,d3
  185.                 move.l    d3,d2
  186.                 bra.b     doit
  187.                 
  188. setdboff        move.l    #DBText2,(DB)
  189.                 move.l    #DBText2,(DBa)
  190.                 move.b    #1,(DBText)
  191.                 move.b    #2,(DBTextb)
  192.                 bsr.w     refresh
  193.                 moveq     #0,d2
  194.                 move.l    d2,d3
  195.                 bset      #CACRB_DBE,d2
  196.                 bra.b     doit          
  197.  
  198. docb            tst.b     (procflag)
  199.                 bmi.b     dodb
  200.                 bsr.w     getstate
  201.                 tst.l     d0
  202.                 bmi.b     setcboff
  203.                 move.l    #CBText1,(CB)
  204.                 move.l    #CBText1,(CBa)
  205.                 move.b    #2,(CBText)
  206.                 move.b    #1,(CBTextb)
  207.                 bsr.w     refresh
  208.                 moveq     #0,d3
  209.                 bset      #CACRB_CopyBack,d3
  210.                 move.l    d3,d2
  211. doit            bsr.w     dowb
  212.                 bra.w     waitloop
  213.                 
  214. setcboff        move.l    #CBText2,(CB)
  215.                 move.l    #CBText2,(CBa)
  216.                 move.b    #1,(CBText)
  217.                 move.b    #2,(CBTextb)
  218.                 bsr.w     refresh
  219.                 moveq     #0,d3
  220.                 move.l    d3,d2
  221.                 bset      #CACRB_CopyBack,d2
  222.                 bra.b     doit          
  223.                 
  224. dod             bsr.w     getstate
  225.                 tst.l     d0
  226.                 bmi.b     setdcoff
  227.                 move.l    #DCText1,(Dcache)
  228.                 move.l    #DCText1,(DCa)
  229.                 move.b    #2,(DCText)
  230.                 move.b    #1,(DCTextb) 
  231.                 bsr.w     refresh
  232.                 moveq     #0,d3
  233.                 bset      #CACRB_EnableD,d3
  234.                 move.l    d3,d2
  235.                 bra.b     doit
  236.                 
  237. setdcoff        move.l    #DCText2,(Dcache)
  238.                 move.l    #DCText2,(DCa)
  239.                 move.b    #1,(DCText)
  240.                 move.b    #2,(DCTextb)
  241.                 bsr.w     refresh
  242.                 moveq     #0,d3
  243.                 move.l    d3,d2
  244.                 bset      #CACRB_EnableD,d2
  245.                 bra.w     doit          
  246.                 
  247. doi             bsr.w     getstate
  248.                 tst.l     d0
  249.                 bmi.b     seticoff
  250.                 move.l    #ICText1,(Icache)
  251.                 move.l    #ICText1,(ICa)
  252.                 move.b    #2,(ICText)
  253.                 move.b    #1,(ICTextb)
  254.                 bsr.b     refresh
  255.                 moveq     #0,d3
  256.                 bset      #CACRB_EnableI,d3
  257.                 move.l    d3,d2
  258.                 bra.w     doit
  259.                 
  260. seticoff        move.l    #ICText2,(Icache)
  261.                 move.l    #ICText2,(ICa)
  262.                 move.b    #1,(ICText)
  263.                 move.b    #2,(ICTextb)
  264.                 bsr.b     refresh
  265.                 moveq     #0,d3
  266.                 move.l    d3,d2
  267.                 bset      #CACRB_EnableI,d2
  268.                 bra.w     doit          
  269.                 
  270.                 
  271. exitwb          movea.l   (windsave,pc),a0              ;get the window
  272.                 JMPINT    CloseWindow                   ;close it
  273.                    
  274.                                                                 
  275. refresh         movea.l   a1,a0                         ;refresh the gadget
  276.                 movea.l   (windsave,pc),a1              ;in a1
  277.                 suba.l    a2,a2
  278.                 moveq     #1,d0
  279.                 JMPINT    RefreshGList
  280.                              
  281.                 
  282. ;****************************************************                
  283. ;depending on the processor this routine will go into
  284. ;supervisor and return either the cacr in d0 or cacr
  285. ;in d0 and dtt1 in d1                
  286. ;****************************************************
  287.                 
  288. getstat         lea       (supcode,pc),a5
  289.                 JMPEXEC  Supervisor
  290.  
  291. supcode         movec     cacr,d0                     
  292.                 tst.b     (procflag)
  293.                 bmi.b     sc_xit
  294.                 movec     dtt1,d1               
  295. sc_xit          rte
  296.  
  297. ;*********************************************
  298. ;Test the state of the gadget in a1 and return
  299. ;a boolean result in d0                       
  300. ;*********************************************    
  301.  
  302. getstate        move.w    (gg_Flags,a1),d0
  303.                 andi.w    #GFLG_SELECTED,d0
  304.                 bne.b     gadset
  305.                 moveq     #0,d0
  306.                 rts
  307. gadset          moveq     #-1,d0
  308.                 rts             
  309.                 
  310. ;**************************************************                
  311. ;error routine, display credits, do an audible beep
  312. ;and flash the screen and exit                
  313. ;**************************************************
  314.                 
  315. error           bsr.b     dispcredit
  316.                 moveq     #0,d0                         
  317.                 moveq     #0,d1
  318.                 Beep
  319.                 suba.l    a0,a0
  320.                 CALLINT   DisplayBeep
  321.                 lea       (errmsg,pc),a0
  322.                 bsr.w     print
  323.                 bra.b     errorout
  324. dispusage       bsr.b     dispcredit
  325.                 lea       (usage,pc),a0
  326.                 bsr.w     print
  327.                 bra.b     errorout
  328.                 
  329. dispcredit      lea       (credit,pc),a0
  330.                 bsr.w     print
  331. errorout        rts                
  332.                 
  333. dodos           lea       (credit,pc),a0
  334.                 bsr.w     print
  335.                 tst.l     (_argv)
  336.                 beq.w     exit
  337.                 movea.l   (_argv),a2
  338.                 move.l    (_argc),d7
  339.                 subq.l    #1,d7
  340.                 tst.l     (a2)
  341.                 beq.w     exit
  342.                 moveq     #0,d2
  343.                 moveq     #0,d3
  344.                 
  345. loop            lea       (cbon,pc),a1          ;CopyBack on
  346.                 bsr.b     docmp
  347.                 bne.b     nocbon
  348.                 tst.b     (procflag)
  349.                 bmi.w     next
  350.                 bset      #CACRB_CopyBack,d3
  351.                 bset      #CACRB_CopyBack,d2
  352.                 lea       (cben,pc),a0
  353.                 bsr.b     print
  354.                 bra.w     next
  355.                 
  356. nocbon          lea       (cboff,pc),a1         ;CopyBack off
  357.                 bsr.b     docmp
  358.                 bne.b     nocboff
  359.                 tst.b     (procflag)
  360.                 bmi.w     next
  361.                 bset      #CACRB_CopyBack,d2
  362.                 bclr      #CACRB_CopyBack,d3
  363.                 lea       (cbdis,pc),a0
  364.                 bsr.b     print
  365.                 bra.w     next
  366.                 
  367. nocboff         lea       (icon,pc),a1          ;Ins cache on
  368.                 bsr.b     docmp
  369.                 bne.b     noicon
  370.                 bset      #CACRB_EnableI,d3
  371.                 bset      #CACRB_EnableI,d2
  372.                 lea       (icen,pc),a0
  373.                 bsr.b     print
  374.                 bra.w     next
  375.  
  376. docmp           movea.l   (a2),a0
  377.                 moveq     #-1,d0
  378.                 StringCmp
  379.                 tst.l     d0
  380.                 rts
  381.  
  382. print           move.l    (_stdout),d1
  383.                 beq.b     prexit
  384.                 DosAPrint
  385. prexit          rts
  386.  
  387. noicon          lea       (icoff,pc),a1         ;Inc Cache off
  388.                 bsr.b     docmp
  389.                 bne.b     noicoff
  390.                 bclr      #CACRB_EnableI,d3
  391.                 bset      #CACRB_EnableI,d2
  392.                 lea       (icdis,pc),a0
  393.                 bsr.b     print
  394.                 bra.w     next
  395.                 
  396. noicoff         lea       (dcon,pc),a1          ;Data Cache on
  397.                 bsr.b     docmp
  398.                 bne.b     nodcon
  399.                 bset      #CACRB_EnableD,d3
  400.                 bset      #CACRB_EnableD,d2
  401.                 lea       (dcen,pc),a0
  402.                 bsr.b     print
  403.                 bra.w     next
  404.                 
  405. nodcon          lea       (dcoff,pc),a1         ;Data Cache off
  406.                 bsr.b     docmp
  407.                 bne.b     nodcoff
  408.                 bclr      #CACRB_EnableD,d3
  409.                 bset      #CACRB_EnableD,d2
  410.                 lea       (dcdis,pc),a0
  411.                 bsr.w     print
  412.                 bra.w     next
  413.                 
  414. nodcoff         cmpi.b    #-1,(procflag)        ;is it the 030
  415.                 bne.w     next                  ;if not rest are invalid
  416.                 lea       (ibon,pc),a1          ;Ins Burst on
  417.                 bsr.w     docmp
  418.                 bne.b     noibon
  419.                 bset      #CACRB_IBE,d3
  420.                 bset      #CACRB_IBE,d2
  421.                 lea       (iben,pc),a0
  422.                 bsr.w     print
  423.                 bra.b     next
  424.                 
  425. noibon          lea       (iboff,pc),a1         ;Ins Burst off
  426.                 bsr.w     docmp
  427.                 bne.b     noiboff
  428.                 bclr      #CACRB_IBE,d3
  429.                 bset      #CACRB_IBE,d2
  430.                 lea       (ibdis,pc),a0
  431.                 bsr.w     print
  432.                 bra.b     next
  433.                 
  434. noiboff         lea       (dbon,pc),a1          ;Data Burst on
  435.                 bsr.w     docmp
  436.                 bne.b     nodbon
  437.                 bset      #CACRB_DBE,d3
  438.                 bset      #CACRB_DBE,d2
  439.                 lea       (dben,pc),a0
  440.                 bsr.w     print
  441.                 bra.b     next
  442.                 
  443. nodbon          lea       (dboff,pc),a1         ;Data Burst off
  444.                 bsr.w     docmp
  445.                 bne.b     next
  446.                 bclr      #CACRB_DBE,d3
  447.                 bset      #CACRB_DBE,d2
  448.                 lea       (dbdis,pc),a0
  449.                 bsr.w     print
  450.                 
  451. next            addq.l    #4,a2
  452.                 dbf       d7,loop
  453.                 
  454. dowb            lea       (do030code,pc),a5
  455.                                                 ;if we're under V2.0x
  456.                 movea.l   (4).w,a6              ;then there is no need
  457.                 cmpi.w    #36,(LIB_VERSION,a6)  ;to do our own code
  458.                 blt.b     isneed                ;we'll call the V2.0x
  459.                                                 ;function instead with
  460.                 move.l    d3,d0                 ;the same parameters as
  461.                 move.l    d2,d1                 ;we use
  462.                 JMPEXEC  CacheControl
  463.                 
  464.                 
  465. isneed          and.l     d2,d3                 ;d3=cache bits
  466.                 not.l     d2                    ;d2=cache mask (inverted)      
  467.                 
  468.                                                 ;< 68040 ?
  469.                 tst.b     (procflag)            ;branch if not 68040
  470.                 bmi.b     super
  471.                 
  472.                 lea       (docode,pc),a5        ;get 68040 code
  473. super           CALLEXEC  Supervisor
  474. exit            rts
  475.                 
  476. ;****************************************************************                
  477. ;This is to check for the presence of the 68040, 68030 or 68020
  478. ;cpu, we try to set specific modes for each and return the result
  479. ;in d1, this is need if we are running under kickstart 1.3  
  480. ;****************************************************************
  481.  
  482. checkproc       movec     cacr,d0               
  483.                 move.l    d0,d1         ;I dont use the name CACR_Copyback      
  484.                 bset      #31,d1        ;in this place it is misleading
  485.                 bset      #CACRB_DBE,d1
  486.                 movec     d1,cacr
  487.                 movec     cacr,d1
  488.                 movec     d0,cacr
  489.                 rte         
  490.                 
  491. ;*******************************************************
  492. ;Set the required modes of the 68030 or 68020 processors
  493. ;This is called if under kickstart 1.3
  494. ;*******************************************************
  495.                 
  496. do030code       movec     cacr,d0       ;get cache control        
  497.                 or.l      d3,d0         ;add our manipulate bits
  498.                 or.l      d3,d2         ;add any set bits to the mask
  499.                 and.l     d2,d0         ;clear unwanted
  500.                 movec     d0,cacr       ;set new settings        
  501.                 rte          
  502.                 
  503. ;*********************************************                
  504. ;Set the required modes of the 68040 processor
  505. ;This is called if under kickstart 1.3
  506. ;*********************************************                
  507.                 
  508. docode          movec     cacr,d4       ;get cache control register 
  509.                 move.l    d2,d0         ;make a copy of new bits
  510.                 move.l    d3,d1         ;make a copy of the mask
  511.                 andi.l    #$0101,d1     ;clear any cback bit
  512.                 bset      #31,d0        ;set the bit in the mask
  513.                 moveq     #15,d7        ;get 15 into a data reg
  514.                 lsl.l     d7,d1         ;get icache into bit 15
  515.                 lsl.l     d7,d0         ;and do the mask
  516.                 swap      d1            ;swap the 16 bit halves
  517.                 swap      d0            ;swap the mask too
  518.                 lsl.w     #8,d1         ;shift dcache to bit 31
  519.                 lsl.w     #8,d0         ;shift any dcache to bit 31
  520.                 swap      d1            ;return the halves
  521.                 swap      d0            ;and the mask
  522.                 or.l      d1,d4         ;set the bits were gonna manipulate
  523.                 or.l      d1,d0         ;add the set bits in the mask
  524.                 and.l     d0,d4         ;clear the bits not in the mask 
  525.                 andi.l    #$80000000,d3 ;clear all except any copyback 
  526.                 rol.l     #6,d3         ;shift to its correct position
  527.                 or.l      #$7fffffff,d2 ;add the cleared bits to the mask
  528.                 rol.l     #6,d2         ;shift it too
  529.                 cpusha    dc            ;push the data cache to update memory
  530.                 movec     dtt1,d6       ;get transparent trans reg
  531.                 andi.b    #$9f,d6       ;clear the CacheMode bits
  532.                 or.l      d3,d6         ;set our manipulate bit
  533.                 or.l      d3,d2         ;add the bit to the mask
  534.                 and.l     d2,d6         ;clear the unwanted bit
  535.                 movec     d6,dtt1       ;set the reg
  536.                 cpusha    bc            ;push data/ins caches to update memory
  537.                 movec     d4,cacr       ;and set the cache control
  538.                 rte     
  539.                 
  540.                 INCLUDE  /cpuset/cpuset.window                
  541.                 even
  542.                 
  543. windsave        dc.l    0
  544. procflag        dc.b    0
  545. cbon            dc.b    'CBACK_ON',0
  546. cboff           dc.b    'CBACK_OFF',0
  547. icon            dc.b    'ICACHE_ON',0
  548. icoff           dc.b    'ICACHE_OFF',0 
  549. dcon            dc.b    'DCACHE_ON',0
  550. dcoff           dc.b    'DCACHE_OFF',0 
  551. ibon            dc.b    'IBURST_ON',0
  552. iboff           dc.b    'IBURST_OFF',0
  553. dbon            dc.b    'DBURST_ON',0
  554. dboff           dc.b    'DBURST_OFF',0
  555. cben            dc.b    'COPYBACK CACHE ENABLED',$0a,0
  556. cbdis           dc.b    'COPYBACK CACHE DISABLED',$0a,0
  557. icen            dc.b    'INSTRUCTION CACHE ENABLED',$0a,0
  558. icdis           dc.b    'INSTRUCTION CACHE DISABLED',$0a,0 
  559. dcen            dc.b    'DATA CACHE ENABLED',$0a,0
  560. dcdis           dc.b    'DATA CACHE DISABLED',$0a,0
  561. iben            dc.b    'INSTRUCTION BURST ENABLED',$0a,0
  562. ibdis           dc.b    'INSTRUCTION BURST DISABLED',$0a,0 
  563. dben            dc.b    'DATA BURST ENABLED',$0a,0
  564. dbdis           dc.b    'DATA BURST DISABLED',$0a,0
  565. credit          dc.b    $0a,$1b,'[0;33m     CPUSet V1.5 ',$1b,'[0;32mWritten in Assembler ',$1b,'[0;m © Nic Wilson',$0a
  566.                 dc.b    '     For 68020, 68030 & 68040 Processors',$0a
  567.                 dc.b    $1b,'[0;32m     This program is Shareware',$1b,'[0;m',$0a,$0a,0
  568. errmsg          dc.b    'You ',$1b,'[0;33mMUST ',$1b,'[0mhave a 68020, 68030 or 68040 Processor',$1b,'[0;32mCPU',$1b,'[0m',$0a,$0a,0
  569. usage           dc.b    $0a,$1b,'[0;33m68040-> ',$1b,'[0;32mCPUSet  ',$1b,'[0;mICACHE_ON/S,ICACHE_OFF/S,DCACHE_ON/S,DCACHE_OFF/S',$0a
  570.                 dc.b    '                CBACK_ON/S,CBACK_OFF/S',$0a 
  571.                 dc.b    $0a,$1b,'[0;33m68030-> ',$1b,'[0;32mCPUSet  ',$1b,'[0;mICACHE_ON/S,ICACHE_OFF/S,DCACHE_ON/S,DCACHE_OFF/S',$0a
  572.                 dc.b    '                IBURST_ON] IBURST_OFF/S,DBURST_ON/S,DBURST_ON/S',$0a
  573.                 dc.b    $0a,$1b,'[0;33m68020-> ',$1b,'[0;32mCPUSet  ',$1b,'[0;mICACHE_ON/S,ICACHE_OFF/S,DCACHE_ON/S,DCACHE_OFF/S',$0a,$0a,0
  574.                 
  575.                 END
  576.