ATCMonitor.java
     1: //========================================================================================
     2: //  ATCMonitor.java
     3: //    en:Address translation caches monitor
     4: //    ja:アドレス変換キャッシュモニタ
     5: //  Copyright (C) 2003-2026 Makoto Kamada
     6: //
     7: //  This file is part of the XEiJ (X68000 Emulator in Java).
     8: //  You can use, modify and redistribute the XEiJ if the conditions are met.
     9: //  Read the XEiJ License for more details.
    10: //  https://stdkmd.net/xeij/
    11: //========================================================================================
    12: 
    13: //      +------+--------------------------------------------------------------------------------------------------------+
    14: //      |      |                                                                                                    1111
    15: //      |      |          1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000|
    16: //      |      |01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123|
    17: //      +------+--------------------------------------------------------------------------------------------------------+
    18: //      |     0|                                                                                                        |
    19: //      |     1|                                       ADDRESS TRANSLATION CACHES                                       |
    20: //      |     2|                                                                                                        |
    21: //      |     3|        USER DATA                 USER CODE              SUPERVISOR DATA           SUPERVISOR CODE      |
    22: //      |     4|    dd/64=ddd% IN USE         dd/64=ddd% IN USE         dd/64=ddd% IN USE         dd/64=ddd% IN USE     |
    23: //      |     5|                                                                                                        |
    24: //      |     6|    LOGICAL  PHYSICAL         LOGICAL  PHYSICAL         LOGICAL  PHYSICAL         LOGICAL  PHYSICAL     |
    25: //      |     7|  0 xxxxxxxx xxxxxxxx GCW   0 xxxxxxxx xxxxxxxx GCW   0 xxxxxxxx xxxxxxxx GCW   0 xxxxxxxx xxxxxxxx GCW |
    26: //      |     8|  1 xxxxxxxx xxxxxxxx GCW   1 xxxxxxxx xxxxxxxx GCW   1 xxxxxxxx xxxxxxxx GCW   1 xxxxxxxx xxxxxxxx GCW |
    27: //      |     9|  2 xxxxxxxx xxxxxxxx GCW   2 xxxxxxxx xxxxxxxx GCW   2 xxxxxxxx xxxxxxxx GCW   2 xxxxxxxx xxxxxxxx GCW |
    28: //      |    10|  3 xxxxxxxx xxxxxxxx GCW   3 xxxxxxxx xxxxxxxx GCW   3 xxxxxxxx xxxxxxxx GCW   3 xxxxxxxx xxxxxxxx GCW |
    29: //      |    11|  4 xxxxxxxx xxxxxxxx GCW   4 xxxxxxxx xxxxxxxx GCW   4 xxxxxxxx xxxxxxxx GCW   4 xxxxxxxx xxxxxxxx GCW |
    30: //      |    12|  5 xxxxxxxx xxxxxxxx GCW   5 xxxxxxxx xxxxxxxx GCW   5 xxxxxxxx xxxxxxxx GCW   5 xxxxxxxx xxxxxxxx GCW |
    31: //      |    13|  6 xxxxxxxx xxxxxxxx GCW   6 xxxxxxxx xxxxxxxx GCW   6 xxxxxxxx xxxxxxxx GCW   6 xxxxxxxx xxxxxxxx GCW |
    32: //      |    14|  7 xxxxxxxx xxxxxxxx GCW   7 xxxxxxxx xxxxxxxx GCW   7 xxxxxxxx xxxxxxxx GCW   7 xxxxxxxx xxxxxxxx GCW |
    33: //      |    15|  8 xxxxxxxx xxxxxxxx GCW   8 xxxxxxxx xxxxxxxx GCW   8 xxxxxxxx xxxxxxxx GCW   8 xxxxxxxx xxxxxxxx GCW |
    34: //      |    16|  9 xxxxxxxx xxxxxxxx GCW   9 xxxxxxxx xxxxxxxx GCW   9 xxxxxxxx xxxxxxxx GCW   9 xxxxxxxx xxxxxxxx GCW |
    35: //      |    17| 10 xxxxxxxx xxxxxxxx GCW  10 xxxxxxxx xxxxxxxx GCW  10 xxxxxxxx xxxxxxxx GCW  10 xxxxxxxx xxxxxxxx GCW |
    36: //      |    18| 11 xxxxxxxx xxxxxxxx GCW  11 xxxxxxxx xxxxxxxx GCW  11 xxxxxxxx xxxxxxxx GCW  11 xxxxxxxx xxxxxxxx GCW |
    37: //      |    19| 12 xxxxxxxx xxxxxxxx GCW  12 xxxxxxxx xxxxxxxx GCW  12 xxxxxxxx xxxxxxxx GCW  12 xxxxxxxx xxxxxxxx GCW |
    38: //      |    20| 13 xxxxxxxx xxxxxxxx GCW  13 xxxxxxxx xxxxxxxx GCW  13 xxxxxxxx xxxxxxxx GCW  13 xxxxxxxx xxxxxxxx GCW |
    39: //      |    21| 14 xxxxxxxx xxxxxxxx GCW  14 xxxxxxxx xxxxxxxx GCW  14 xxxxxxxx xxxxxxxx GCW  14 xxxxxxxx xxxxxxxx GCW |
    40: //      |    22| 15 xxxxxxxx xxxxxxxx GCW  15 xxxxxxxx xxxxxxxx GCW  15 xxxxxxxx xxxxxxxx GCW  15 xxxxxxxx xxxxxxxx GCW |
    41: //      |    23| 16 xxxxxxxx xxxxxxxx GCW  16 xxxxxxxx xxxxxxxx GCW  16 xxxxxxxx xxxxxxxx GCW  16 xxxxxxxx xxxxxxxx GCW |
    42: //      |    24| 17 xxxxxxxx xxxxxxxx GCW  17 xxxxxxxx xxxxxxxx GCW  17 xxxxxxxx xxxxxxxx GCW  17 xxxxxxxx xxxxxxxx GCW |
    43: //      |    25| 18 xxxxxxxx xxxxxxxx GCW  18 xxxxxxxx xxxxxxxx GCW  18 xxxxxxxx xxxxxxxx GCW  18 xxxxxxxx xxxxxxxx GCW |
    44: //      |    26| 19 xxxxxxxx xxxxxxxx GCW  19 xxxxxxxx xxxxxxxx GCW  19 xxxxxxxx xxxxxxxx GCW  19 xxxxxxxx xxxxxxxx GCW |
    45: //      |    27| 20 xxxxxxxx xxxxxxxx GCW  20 xxxxxxxx xxxxxxxx GCW  20 xxxxxxxx xxxxxxxx GCW  20 xxxxxxxx xxxxxxxx GCW |
    46: //      |    28| 21 xxxxxxxx xxxxxxxx GCW  21 xxxxxxxx xxxxxxxx GCW  21 xxxxxxxx xxxxxxxx GCW  21 xxxxxxxx xxxxxxxx GCW |
    47: //      |    29| 22 xxxxxxxx xxxxxxxx GCW  22 xxxxxxxx xxxxxxxx GCW  22 xxxxxxxx xxxxxxxx GCW  22 xxxxxxxx xxxxxxxx GCW |
    48: //      |    30| 23 xxxxxxxx xxxxxxxx GCW  23 xxxxxxxx xxxxxxxx GCW  23 xxxxxxxx xxxxxxxx GCW  23 xxxxxxxx xxxxxxxx GCW |
    49: //      |    31| 24 xxxxxxxx xxxxxxxx GCW  24 xxxxxxxx xxxxxxxx GCW  24 xxxxxxxx xxxxxxxx GCW  24 xxxxxxxx xxxxxxxx GCW |
    50: //      |    32| 25 xxxxxxxx xxxxxxxx GCW  25 xxxxxxxx xxxxxxxx GCW  25 xxxxxxxx xxxxxxxx GCW  25 xxxxxxxx xxxxxxxx GCW |
    51: //      |    33| 26 xxxxxxxx xxxxxxxx GCW  26 xxxxxxxx xxxxxxxx GCW  26 xxxxxxxx xxxxxxxx GCW  26 xxxxxxxx xxxxxxxx GCW |
    52: //      |    34| 27 xxxxxxxx xxxxxxxx GCW  27 xxxxxxxx xxxxxxxx GCW  27 xxxxxxxx xxxxxxxx GCW  27 xxxxxxxx xxxxxxxx GCW |
    53: //      |    35| 28 xxxxxxxx xxxxxxxx GCW  28 xxxxxxxx xxxxxxxx GCW  28 xxxxxxxx xxxxxxxx GCW  28 xxxxxxxx xxxxxxxx GCW |
    54: //      |    36| 29 xxxxxxxx xxxxxxxx GCW  29 xxxxxxxx xxxxxxxx GCW  29 xxxxxxxx xxxxxxxx GCW  29 xxxxxxxx xxxxxxxx GCW |
    55: //      |    37| 30 xxxxxxxx xxxxxxxx GCW  30 xxxxxxxx xxxxxxxx GCW  30 xxxxxxxx xxxxxxxx GCW  30 xxxxxxxx xxxxxxxx GCW |
    56: //      |    38| 31 xxxxxxxx xxxxxxxx GCW  31 xxxxxxxx xxxxxxxx GCW  31 xxxxxxxx xxxxxxxx GCW  31 xxxxxxxx xxxxxxxx GCW |
    57: //      |    39| 32 xxxxxxxx xxxxxxxx GCW  32 xxxxxxxx xxxxxxxx GCW  32 xxxxxxxx xxxxxxxx GCW  32 xxxxxxxx xxxxxxxx GCW |
    58: //      |    40| 33 xxxxxxxx xxxxxxxx GCW  33 xxxxxxxx xxxxxxxx GCW  33 xxxxxxxx xxxxxxxx GCW  33 xxxxxxxx xxxxxxxx GCW |
    59: //      |    41| 34 xxxxxxxx xxxxxxxx GCW  34 xxxxxxxx xxxxxxxx GCW  34 xxxxxxxx xxxxxxxx GCW  34 xxxxxxxx xxxxxxxx GCW |
    60: //      |    42| 35 xxxxxxxx xxxxxxxx GCW  35 xxxxxxxx xxxxxxxx GCW  35 xxxxxxxx xxxxxxxx GCW  35 xxxxxxxx xxxxxxxx GCW |
    61: //      |    43| 36 xxxxxxxx xxxxxxxx GCW  36 xxxxxxxx xxxxxxxx GCW  36 xxxxxxxx xxxxxxxx GCW  36 xxxxxxxx xxxxxxxx GCW |
    62: //      |    44| 37 xxxxxxxx xxxxxxxx GCW  37 xxxxxxxx xxxxxxxx GCW  37 xxxxxxxx xxxxxxxx GCW  37 xxxxxxxx xxxxxxxx GCW |
    63: //      |    45| 38 xxxxxxxx xxxxxxxx GCW  38 xxxxxxxx xxxxxxxx GCW  38 xxxxxxxx xxxxxxxx GCW  38 xxxxxxxx xxxxxxxx GCW |
    64: //      |    46| 39 xxxxxxxx xxxxxxxx GCW  39 xxxxxxxx xxxxxxxx GCW  39 xxxxxxxx xxxxxxxx GCW  39 xxxxxxxx xxxxxxxx GCW |
    65: //      |    47| 40 xxxxxxxx xxxxxxxx GCW  40 xxxxxxxx xxxxxxxx GCW  40 xxxxxxxx xxxxxxxx GCW  40 xxxxxxxx xxxxxxxx GCW |
    66: //      |    48| 41 xxxxxxxx xxxxxxxx GCW  41 xxxxxxxx xxxxxxxx GCW  41 xxxxxxxx xxxxxxxx GCW  41 xxxxxxxx xxxxxxxx GCW |
    67: //      |    49| 42 xxxxxxxx xxxxxxxx GCW  42 xxxxxxxx xxxxxxxx GCW  42 xxxxxxxx xxxxxxxx GCW  42 xxxxxxxx xxxxxxxx GCW |
    68: //      |    50| 43 xxxxxxxx xxxxxxxx GCW  43 xxxxxxxx xxxxxxxx GCW  43 xxxxxxxx xxxxxxxx GCW  43 xxxxxxxx xxxxxxxx GCW |
    69: //      |    51| 44 xxxxxxxx xxxxxxxx GCW  44 xxxxxxxx xxxxxxxx GCW  44 xxxxxxxx xxxxxxxx GCW  44 xxxxxxxx xxxxxxxx GCW |
    70: //      |    52| 45 xxxxxxxx xxxxxxxx GCW  45 xxxxxxxx xxxxxxxx GCW  45 xxxxxxxx xxxxxxxx GCW  45 xxxxxxxx xxxxxxxx GCW |
    71: //      |    53| 46 xxxxxxxx xxxxxxxx GCW  46 xxxxxxxx xxxxxxxx GCW  46 xxxxxxxx xxxxxxxx GCW  46 xxxxxxxx xxxxxxxx GCW |
    72: //      |    54| 47 xxxxxxxx xxxxxxxx GCW  47 xxxxxxxx xxxxxxxx GCW  47 xxxxxxxx xxxxxxxx GCW  47 xxxxxxxx xxxxxxxx GCW |
    73: //      |    55| 48 xxxxxxxx xxxxxxxx GCW  48 xxxxxxxx xxxxxxxx GCW  48 xxxxxxxx xxxxxxxx GCW  48 xxxxxxxx xxxxxxxx GCW |
    74: //      |    56| 49 xxxxxxxx xxxxxxxx GCW  49 xxxxxxxx xxxxxxxx GCW  49 xxxxxxxx xxxxxxxx GCW  49 xxxxxxxx xxxxxxxx GCW |
    75: //      |    57| 50 xxxxxxxx xxxxxxxx GCW  50 xxxxxxxx xxxxxxxx GCW  50 xxxxxxxx xxxxxxxx GCW  50 xxxxxxxx xxxxxxxx GCW |
    76: //      |    58| 51 xxxxxxxx xxxxxxxx GCW  51 xxxxxxxx xxxxxxxx GCW  51 xxxxxxxx xxxxxxxx GCW  51 xxxxxxxx xxxxxxxx GCW |
    77: //      |    59| 52 xxxxxxxx xxxxxxxx GCW  52 xxxxxxxx xxxxxxxx GCW  52 xxxxxxxx xxxxxxxx GCW  52 xxxxxxxx xxxxxxxx GCW |
    78: //      |    60| 53 xxxxxxxx xxxxxxxx GCW  53 xxxxxxxx xxxxxxxx GCW  53 xxxxxxxx xxxxxxxx GCW  53 xxxxxxxx xxxxxxxx GCW |
    79: //      |    61| 54 xxxxxxxx xxxxxxxx GCW  54 xxxxxxxx xxxxxxxx GCW  54 xxxxxxxx xxxxxxxx GCW  54 xxxxxxxx xxxxxxxx GCW |
    80: //      |    62| 55 xxxxxxxx xxxxxxxx GCW  55 xxxxxxxx xxxxxxxx GCW  55 xxxxxxxx xxxxxxxx GCW  55 xxxxxxxx xxxxxxxx GCW |
    81: //      |    63| 56 xxxxxxxx xxxxxxxx GCW  56 xxxxxxxx xxxxxxxx GCW  56 xxxxxxxx xxxxxxxx GCW  56 xxxxxxxx xxxxxxxx GCW |
    82: //      |    64| 57 xxxxxxxx xxxxxxxx GCW  57 xxxxxxxx xxxxxxxx GCW  57 xxxxxxxx xxxxxxxx GCW  57 xxxxxxxx xxxxxxxx GCW |
    83: //      |    65| 58 xxxxxxxx xxxxxxxx GCW  58 xxxxxxxx xxxxxxxx GCW  58 xxxxxxxx xxxxxxxx GCW  58 xxxxxxxx xxxxxxxx GCW |
    84: //      |    66| 59 xxxxxxxx xxxxxxxx GCW  59 xxxxxxxx xxxxxxxx GCW  59 xxxxxxxx xxxxxxxx GCW  59 xxxxxxxx xxxxxxxx GCW |
    85: //      |    67| 60 xxxxxxxx xxxxxxxx GCW  60 xxxxxxxx xxxxxxxx GCW  60 xxxxxxxx xxxxxxxx GCW  60 xxxxxxxx xxxxxxxx GCW |
    86: //      |    68| 61 xxxxxxxx xxxxxxxx GCW  61 xxxxxxxx xxxxxxxx GCW  61 xxxxxxxx xxxxxxxx GCW  61 xxxxxxxx xxxxxxxx GCW |
    87: //      |    69| 62 xxxxxxxx xxxxxxxx GCW  62 xxxxxxxx xxxxxxxx GCW  62 xxxxxxxx xxxxxxxx GCW  62 xxxxxxxx xxxxxxxx GCW |
    88: //      |    70| 63 xxxxxxxx xxxxxxxx GCW  63 xxxxxxxx xxxxxxxx GCW  63 xxxxxxxx xxxxxxxx GCW  63 xxxxxxxx xxxxxxxx GCW |
    89: //      |    71|                                       G:GLOBAL W:WRITE-PROTECTED                                       |
    90: //      |    72|                            0:WRITETHROUGH 1:COPYBACK 2:PRECISE 3:IMPRECISE                             |
    91: //      |    73|                                                                                                        |
    92: //      +------+--------------------------------------------------------------------------------------------------------+
    93: //      |      |                                                                                                    1111
    94: //      |      |          1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000|
    95: //      |      |01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123|
    96: //      +------+--------------------------------------------------------------------------------------------------------+
    97: 
    98: package xeij;
    99: 
   100: import java.awt.*;  //BasicStroke,BorderLayout,BoxLayout,Color,Component,Container,Cursor,Desktop,Dimension,Font,FlowLayout,Frame,Graphics,Graphics2D,GraphicsDevice,GraphicsEnvironment,GridLayout,Image,Insets,Paint,Point,Rectangle,RenderingHints,Robot,Shape,Stroke,TexturePaint,Toolkit
   101: import java.awt.event.*;  //ActionEvent,ActionListener,ComponentAdapter,ComponentEvent,ComponentListener,FocusAdapter,FocusEvent,FocusListener,InputEvent,KeyAdapter,KeyEvent,KeyListener,MouseAdapter,MouseEvent,MouseListener,MouseMotionAdapter,MouseWheelEvent,WindowAdapter,WindowEvent,WindowListener,WindowStateListener
   102: import java.awt.image.*;  //BufferedImage,DataBuffer,DataBufferByte,DataBufferInt,IndexColorModel
   103: import java.lang.*;  //Boolean,Character,Class,Comparable,Double,Exception,Float,IllegalArgumentException,Integer,Long,Math,Number,Object,Runnable,SecurityException,String,StringBuilder,System
   104: import java.util.*;  //ArrayList,Arrays,Calendar,GregorianCalendar,HashMap,Map,Map.Entry,Timer,TimerTask,TreeMap
   105: import javax.swing.*;  //AbstractSpinnerModel,Box,ButtonGroup,DefaultListModel,ImageIcon,JApplet,JButton,JCheckBox,JCheckBoxMenuItem,JDialog,JFileChooser,JFrame,JLabel,JList,JMenu,JMenuBar,JMenuItem,JPanel,JRadioButton,JScrollPane,JSpinner,JTextArea,JTextField,JTextPane,JViewport,ScrollPaneConstants,SpinnerListModel,SpinnerNumberModel,SwingConstants,SwingUtilities,UIManager,UIDefaults,UnsupportedLookAndFeelException
   106: 
   107: public class ATCMonitor {
   108: 
   109:   public static final boolean ACM_ON = true;
   110: 
   111:   //アドレス変換キャッシュ
   112:   public static int[][] acmCaches;
   113: 
   114:   //配置
   115:   public static final int ACM_GROUP_COLS = 26;
   116:   public static final int ACM_COLS = ACM_GROUP_COLS * 4;
   117:   public static final String ACM_TITLE = "ADDRESS TRANSLATION CACHES";
   118:   public static final String[] ACM_GROUP_TITLE = {
   119:     "USER DATA",
   120:     "USER CODE",
   121:     "SUPERVISOR DATA",
   122:     "SUPERVISOR CODE",
   123:   };
   124:   public static final String ACM_FOOTNOTE_1 = "G:GLOBAL W:WRITE-PROTECTED";
   125:   public static final String ACM_FOOTNOTE_2 = "0:WRITETHROUGH 1:COPYBACK 2:PRECISE 3:IMPRECISE";
   126: 
   127:   //キャンバス
   128:   public static final int ACM_WIDTH = 4 * ACM_COLS;
   129:   public static final int ACM_HEIGHT = 6 * 74;
   130:   public static final int ACM_OFFSET = ACM_WIDTH + 3 >> 2;
   131:   public static IndexColorModel acmColorModel;
   132:   public static BufferedImage acmImage;
   133:   public static byte[] acmBitmap;
   134: 
   135:   //パネル
   136:   public static JPanel acmPanel;  //パネル
   137: 
   138:   //ウインドウ
   139:   public static JFrame acmFrame;  //ウインドウ
   140: 
   141:   //タイマー
   142:   public static final int ACM_INTERVAL = 10;
   143:   public static int acmTimer;
   144: 
   145:   //フォント
   146:   public static final byte[] ACM_FONT_1 = new byte[5 * 127];
   147:   public static final byte[] ACM_FONT_2 = new byte[5 * 127];
   148:   public static final byte[] ACM_FONT_3 = new byte[5 * 127];
   149: 
   150:   //acmInit ()
   151:   //  初期化
   152:   public static void acmInit () {
   153: 
   154:     //アドレス変換キャッシュ
   155:     acmCaches = new int[][] {
   156:       MC68060.mmuUserDataCache,
   157:       MC68060.mmuUserCodeCache,
   158:       MC68060.mmuSuperDataCache,
   159:       MC68060.mmuSuperCodeCache,
   160:     };
   161: 
   162:     //フォント
   163:     {
   164:       final long m = 0b01010100_01010000_01000100_01000000_00010100_00010000_00000100_00000000L;
   165:       int k = 0;
   166:       for (int i = 0; i < 127; i++) {
   167:         int t = Indicator.IND_ASCII_3X5[i];
   168:         int d;
   169:         //d = t >> 14 - 6 & 0b01000000 | t >> 13 - 4 & 0b00010000 | t >> 12 - 2 & 0b00000100;
   170:         d = (int) (m >>> (t >>> 12 - 3 & 7 << 3)) & 255;
   171:         ACM_FONT_1[k] = (byte)  d;
   172:         ACM_FONT_2[k] = (byte) (d * 2);
   173:         ACM_FONT_3[k] = (byte) (d * 3);
   174:         k++;
   175:         //d = t >> 11 - 6 & 0b01000000 | t >> 10 - 4 & 0b00010000 | t >>  9 - 2 & 0b00000100;
   176:         d = (int) (m >>> (t >>>  9 - 3 & 7 << 3)) & 255;
   177:         ACM_FONT_1[k] = (byte)  d;
   178:         ACM_FONT_2[k] = (byte) (d * 2);
   179:         ACM_FONT_3[k] = (byte) (d * 3);
   180:         k++;
   181:         //d = t >>  8 - 6 & 0b01000000 | t >>  7 - 4 & 0b00010000 | t >>  6 - 2 & 0b00000100;
   182:         d = (int) (m >>> (t >>>  6 - 3 & 7 << 3)) & 255;
   183:         ACM_FONT_1[k] = (byte)  d;
   184:         ACM_FONT_2[k] = (byte) (d * 2);
   185:         ACM_FONT_3[k] = (byte) (d * 3);
   186:         k++;
   187:         //d = t <<  6 - 5 & 0b01000000 | t           & 0b00010000 | t >>  3 - 2 & 0b00000100;
   188:         d = (int) (m >>> (t            & 7 << 3)) & 255;
   189:         ACM_FONT_1[k] = (byte)  d;
   190:         ACM_FONT_2[k] = (byte) (d * 2);
   191:         ACM_FONT_3[k] = (byte) (d * 3);
   192:         k++;
   193:         //d = t <<  6 - 2 & 0b01000000 | t <<  4 - 1 & 0b00010000 | t <<  2 - 0 & 0b00000100;
   194:         d = (int) (m >>> (t <<   6 - 3 & 7 << 3)) & 255;
   195:         ACM_FONT_1[k] = (byte)  d;
   196:         ACM_FONT_2[k] = (byte) (d * 2);
   197:         ACM_FONT_3[k] = (byte) (d * 3);
   198:         k++;
   199:       }
   200:     }
   201: 
   202:     //ウインドウ
   203:     acmFrame = null;
   204: 
   205:     //タイマー
   206:     acmTimer = 0;
   207: 
   208:   }  //acmInit()
   209: 
   210:   //acmStart ()
   211:   public static void acmStart () {
   212:     if (RestorableFrame.rfmGetOpened (Settings.SGS_ACM_FRAME_KEY)) {
   213:       acmOpen ();
   214:     }
   215:   }  //acmStart()
   216: 
   217:   //acmOpen ()
   218:   //  アドレス変換キャッシュモニタを開く
   219:   public static void acmOpen () {
   220:     if (acmFrame == null) {
   221:       acmMakeFrame ();
   222:     } else {
   223:       acmUpdateFrame ();
   224:     }
   225:     XEiJ.dbgVisibleMask |= XEiJ.DBG_ACM_VISIBLE_MASK;
   226:     XEiJ.pnlExitFullScreen (false);
   227:     acmFrame.setVisible (true);
   228:   }  //acmOpen()
   229: 
   230:   //acmMakeFrame ()
   231:   //  アドレス変換キャッシュモニタを作る
   232:   //  ここでは開かない
   233:   public static void acmMakeFrame () {
   234: 
   235:     //キャンバス
   236:     acmColorModel = new IndexColorModel (2, 4,
   237:                                          //                   黒           青           橙           白
   238:                                          new byte[] { (byte) 0x00, (byte) 0x20, (byte) 0xff, (byte) 0xff },  //Red
   239:                                          new byte[] { (byte) 0x00, (byte) 0x20, (byte) 0x87, (byte) 0xff },  //Green
   240:                                          new byte[] { (byte) 0x00, (byte) 0xff, (byte) 0x40, (byte) 0xff });  //Blue
   241:     acmImage = new BufferedImage (ACM_WIDTH, ACM_HEIGHT, BufferedImage.TYPE_BYTE_BINARY, acmColorModel);
   242:     acmBitmap = ((DataBufferByte) acmImage.getRaster ().getDataBuffer ()).getData ();
   243:     acmDrawString3 ((ACM_COLS - ACM_TITLE.length ()) >> 1, 1, ACM_TITLE);
   244:     for (int z = 0; z < 4; z++) {
   245:       int x0 = ACM_GROUP_COLS * z;
   246:       acmDrawString2 (x0 + ((ACM_GROUP_COLS - ACM_GROUP_TITLE[z].length ()) >> 1), 3, ACM_GROUP_TITLE[z]);
   247:       acmDrawString3 (x0 + 6, 4, "/64=");
   248:       acmDrawString3 (x0 + 13, 4, "% IN USE");
   249:       acmDrawString2 (x0 + 4, 6, "LOGICAL  PHYSICAL");
   250:     }
   251:     acmDrawString2 ((ACM_COLS - ACM_FOOTNOTE_1.length ()) >> 1, 71, ACM_FOOTNOTE_1);
   252:     acmDrawString2 ((ACM_COLS - ACM_FOOTNOTE_2.length ()) >> 1, 72, ACM_FOOTNOTE_2);
   253: 
   254:     //パネル
   255:     acmPanel = ComponentFactory.setFixedSize (
   256:       new JPanel () {
   257:         @Override protected void paintComponent (Graphics g) {
   258:           super.paintComponent (g);
   259:           g.drawImage (acmImage, 0, 0, null);
   260:         }
   261:         @Override protected void paintBorder (Graphics g) {
   262:         }
   263:         @Override protected void paintChildren (Graphics g) {
   264:         }
   265:         @Override public void update (Graphics g) {
   266:         }
   267:       }, ACM_WIDTH, ACM_HEIGHT);
   268:     acmPanel.setBackground (Color.black);
   269:     acmPanel.setOpaque (true);
   270: 
   271:     //ウインドウ
   272:     acmFrame = Multilingual.mlnTitle (
   273:       ComponentFactory.createRestorableSubFrame (
   274:         Settings.SGS_ACM_FRAME_KEY,
   275:         "Address translation caches monitor",
   276:         null,
   277:         acmPanel
   278:         ),
   279:       "ja", "アドレス変換キャッシュモニタ");  //Multilingual.mlnTitle
   280: 
   281:     //  ウインドウリスナー
   282:     ComponentFactory.addListener (
   283:       acmFrame,
   284:       new WindowAdapter () {
   285:         @Override public void windowClosing (WindowEvent we) {
   286:           XEiJ.dbgVisibleMask &= ~XEiJ.DBG_ACM_VISIBLE_MASK;
   287:         }
   288:       });
   289: 
   290:   }  //acmMakeFrame()
   291: 
   292:   //acmUpdateFrame ()
   293:   //  アドレス変換キャッシュモニタを更新する
   294:   public static void acmUpdateFrame () {
   295: 
   296:     if (acmFrame == null) {
   297:       return;
   298:     }
   299: 
   300:     for (int z = 0; z < 4; z++) {
   301:       int[] cache = acmCaches[z];
   302:       int x0 = ACM_GROUP_COLS * z;
   303:       int inuse = 0;
   304:       int t;
   305:       for (int l = 0, i = 0; l < 64; l++, i += 4) {  //ライン,インデックス
   306:         t = XEiJ.FMT_BCD4[l];
   307:         int y = 7 + l;
   308:         int r = cache[i];  //リード用の論理ページアドレス
   309:         if (!MC68060.mmuEnabled || r == 1) {  //無効
   310:           acmDrawChar1 (x0 + 1, y, t >> 4 == 0 ? ' ' : (t >> 4) + '0');  //10の位
   311:           acmDrawChar1 (x0 + 2, y, (t & 15) + '0');  //1の位
   312:           acmDrawString1 (x0 + 4, y, "-------- -------- ---");
   313:         } else {  //有効
   314:           inuse++;
   315:           int w = cache[i + 1];  //ライト用の論理ページアドレス
   316:           int p = cache[i + 2];  //物理ページアドレス
   317:           int f = cache[i + 3];  //フラグ。bit10:グローバル,bit6-5:キャッシュモード
   318:           acmDrawChar3 (x0 + 1, y, t >> 4 == 0 ? ' ' : (t >> 4) + '0');  //10の位
   319:           acmDrawChar3 (x0 + 2, y, (t & 15) + '0');  //1の位
   320:           //論理ページアドレス
   321:           t = r >>> 28;
   322:           acmDrawChar3 (x0 + 4, y, (9 - t >> 4 & 7) + t + '0');
   323:           t = r >>> 24 & 15;
   324:           acmDrawChar3 (x0 + 5, y, (9 - t >> 4 & 7) + t + '0');
   325:           t = r >>> 20 & 15;
   326:           acmDrawChar3 (x0 + 6, y, (9 - t >> 4 & 7) + t + '0');
   327:           t = r >>> 16 & 15;
   328:           acmDrawChar3 (x0 + 7, y, (9 - t >> 4 & 7) + t + '0');
   329:           t = (char) r >>> 12;
   330:           acmDrawChar3 (x0 + 8, y, (9 - t >> 4 & 7) + t + '0');
   331:           t = r >>> 8 & 15;
   332:           acmDrawChar3 (x0 + 9, y, (9 - t >> 4 & 7) + t + '0');
   333:           t = r >>> 4 & 15;
   334:           acmDrawChar3 (x0 + 10, y, (9 - t >> 4 & 7) + t + '0');
   335:           t = r & 15;
   336:           acmDrawChar3 (x0 + 11, y, (9 - t >> 4 & 7) + t + '0');
   337:           //物理ページアドレス
   338:           t = p >>> 28;
   339:           acmDrawChar3 (x0 + 13, y, (9 - t >> 4 & 7) + t + '0');
   340:           t = p >>> 24 & 15;
   341:           acmDrawChar3 (x0 + 14, y, (9 - t >> 4 & 7) + t + '0');
   342:           t = p >>> 20 & 15;
   343:           acmDrawChar3 (x0 + 15, y, (9 - t >> 4 & 7) + t + '0');
   344:           t = p >>> 16 & 15;
   345:           acmDrawChar3 (x0 + 16, y, (9 - t >> 4 & 7) + t + '0');
   346:           t = (char) p >>> 12;
   347:           acmDrawChar3 (x0 + 17, y, (9 - t >> 4 & 7) + t + '0');
   348:           t = p >>> 8 & 15;
   349:           acmDrawChar3 (x0 + 18, y, (9 - t >> 4 & 7) + t + '0');
   350:           t = p >>> 4 & 15;
   351:           acmDrawChar3 (x0 + 19, y, (9 - t >> 4 & 7) + t + '0');
   352:           t = p & 15;
   353:           acmDrawChar3 (x0 + 20, y, (9 - t >> 4 & 7) + t + '0');
   354:           //グローバル
   355:           acmDrawChar3 (x0 + 22, y, (f & MC68060.MMU_DESCRIPTOR_GLOBAL) != 0 ? 'G' : '-');
   356:           //キャッシュモード
   357:           acmDrawChar3 (x0 + 23, y, ((f & MC68060.MMU_DESCRIPTOR_CACHE_MODE) >> 5) + '0');
   358:           //ライトプロテクト
   359:           acmDrawChar3 (x0 + 24, y, w == 1 ? 'W' : '-');
   360:         }  //if 無効/有効
   361:       }  //for l,i
   362:       t = XEiJ.FMT_BCD4[inuse];
   363:       acmDrawChar3 (x0 + 4, 4, t >> 4 == 0 ? ' ' : (t >> 4) + '0');  //10の位
   364:       acmDrawChar3 (x0 + 5, 4, (t & 15) + '0');  //1の位
   365:       t = XEiJ.FMT_BCD4[100 * inuse + 32 >> 6];
   366:       acmDrawChar3 (x0 + 10, 4, t >> 8 == 0 ? ' ' : (t >> 8) + '0');  //100の位
   367:       acmDrawChar3 (x0 + 11, 4, t >> 4 == 0 ? ' ' : (t >> 4 & 15) + '0');  //10の位
   368:       acmDrawChar3 (x0 + 12, 4, (t & 15) + '0');  //1の位
   369:     }  //for z
   370: 
   371:     acmPanel.repaint ();
   372: 
   373:   }  //acmUpdateFrame()
   374: 
   375:   //acmDrawChar1 (x, y, c)
   376:   //  パレットコード1で文字を描く
   377:   public static void acmDrawChar1 (int x, int y, int c) {
   378:     byte[] bb = acmBitmap;
   379:     x += ACM_OFFSET * 6 * y;
   380:     c *= 5;
   381:     bb[x                 ] = ACM_FONT_1[c    ];
   382:     bb[x + ACM_OFFSET    ] = ACM_FONT_1[c + 1];
   383:     bb[x + ACM_OFFSET * 2] = ACM_FONT_1[c + 2];
   384:     bb[x + ACM_OFFSET * 3] = ACM_FONT_1[c + 3];
   385:     bb[x + ACM_OFFSET * 4] = ACM_FONT_1[c + 4];
   386:   }  //acmDrawChar1(int,int,int)
   387: 
   388:   //acmDrawChar2 (x, y, c)
   389:   //  パレットコード2で文字を描く
   390:   public static void acmDrawChar2 (int x, int y, int c) {
   391:     byte[] bb = acmBitmap;
   392:     x += ACM_OFFSET * 6 * y;
   393:     c *= 5;
   394:     bb[x                 ] = ACM_FONT_2[c    ];
   395:     bb[x + ACM_OFFSET    ] = ACM_FONT_2[c + 1];
   396:     bb[x + ACM_OFFSET * 2] = ACM_FONT_2[c + 2];
   397:     bb[x + ACM_OFFSET * 3] = ACM_FONT_2[c + 3];
   398:     bb[x + ACM_OFFSET * 4] = ACM_FONT_2[c + 4];
   399:   }  //acmDrawChar2(int,int,int)
   400: 
   401:   //acmDrawChar3 (x, y, c)
   402:   //  パレットコード3で文字を描く
   403:   public static void acmDrawChar3 (int x, int y, int c) {
   404:     byte[] bb = acmBitmap;
   405:     x += ACM_OFFSET * 6 * y;
   406:     c *= 5;
   407:     bb[x                 ] = ACM_FONT_3[c    ];
   408:     bb[x + ACM_OFFSET    ] = ACM_FONT_3[c + 1];
   409:     bb[x + ACM_OFFSET * 2] = ACM_FONT_3[c + 2];
   410:     bb[x + ACM_OFFSET * 3] = ACM_FONT_3[c + 3];
   411:     bb[x + ACM_OFFSET * 4] = ACM_FONT_3[c + 4];
   412:   }  //acmDrawChar3(int,int,int)
   413: 
   414:   //acmDrawString1 (x, y, s)
   415:   //  パレットコード1で文字列を描く
   416:   public static void acmDrawString1 (int x, int y, String s) {
   417:     acmDrawString1 (x, y, s.toCharArray ());
   418:   }  //acmDrawString1(int,int,String)
   419:   public static void acmDrawString1 (int x, int y, char[] s) {
   420:     byte[] bb = acmBitmap;
   421:     x += ACM_OFFSET * 6 * y;
   422:     for (char c : s) {
   423:       c *= 5;
   424:       bb[x                 ] = ACM_FONT_1[c    ];
   425:       bb[x + ACM_OFFSET    ] = ACM_FONT_1[c + 1];
   426:       bb[x + ACM_OFFSET * 2] = ACM_FONT_1[c + 2];
   427:       bb[x + ACM_OFFSET * 3] = ACM_FONT_1[c + 3];
   428:       bb[x + ACM_OFFSET * 4] = ACM_FONT_1[c + 4];
   429:       x++;
   430:     }
   431:   }  //acmDrawString1(int,int,char[])
   432: 
   433:   //acmDrawString2 (x, y, s)
   434:   //  パレットコード2で文字列を描く
   435:   public static void acmDrawString2 (int x, int y, String s) {
   436:     acmDrawString2 (x, y, s.toCharArray ());
   437:   }  //acmDrawString2(int,int,String)
   438:   public static void acmDrawString2 (int x, int y, char[] s) {
   439:     byte[] bb = acmBitmap;
   440:     x += ACM_OFFSET * 6 * y;
   441:     for (char c : s) {
   442:       c *= 5;
   443:       bb[x                 ] = ACM_FONT_2[c    ];
   444:       bb[x + ACM_OFFSET    ] = ACM_FONT_2[c + 1];
   445:       bb[x + ACM_OFFSET * 2] = ACM_FONT_2[c + 2];
   446:       bb[x + ACM_OFFSET * 3] = ACM_FONT_2[c + 3];
   447:       bb[x + ACM_OFFSET * 4] = ACM_FONT_2[c + 4];
   448:       x++;
   449:     }
   450:   }  //acmDrawString2(int,int,char[])
   451: 
   452:   //acmDrawString3 (x, y, s)
   453:   //  パレットコード3で文字列を描く
   454:   public static void acmDrawString3 (int x, int y, String s) {
   455:     acmDrawString3 (x, y, s.toCharArray ());
   456:   }  //acmDrawString3(int,int,String)
   457:   public static void acmDrawString3 (int x, int y, char[] s) {
   458:     byte[] bb = acmBitmap;
   459:     x += ACM_OFFSET * 6 * y;
   460:     for (char c : s) {
   461:       c *= 5;
   462:       bb[x                 ] = ACM_FONT_3[c    ];
   463:       bb[x + ACM_OFFSET    ] = ACM_FONT_3[c + 1];
   464:       bb[x + ACM_OFFSET * 2] = ACM_FONT_3[c + 2];
   465:       bb[x + ACM_OFFSET * 3] = ACM_FONT_3[c + 3];
   466:       bb[x + ACM_OFFSET * 4] = ACM_FONT_3[c + 4];
   467:       x++;
   468:     }
   469:   }  //acmDrawString3(int,int,char[])
   470: 
   471: }  //class ATCMonitor
   472: 
   473: 
   474: