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