1: //======================================================================================== 2: // ATCMonitor.java 3: // en:Address translation caches monitor 4: // ja:アドレス変換キャッシュモニタ 5: // Copyright (C) 2003-2024 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: XEiJ.pnlExitFullScreen (false); 211: acmFrame.setVisible (true); 212: } //acmOpen() 213: 214: //acmMakeFrame () 215: // アドレス変換キャッシュモニタを作る 216: // ここでは開かない 217: public static void acmMakeFrame () { 218: 219: //キャンバス 220: acmColorModel = new IndexColorModel (2, 4, 221: // 黒 青 橙 白 222: new byte[] { (byte) 0x00, (byte) 0x20, (byte) 0xff, (byte) 0xff }, //Red 223: new byte[] { (byte) 0x00, (byte) 0x20, (byte) 0x87, (byte) 0xff }, //Green 224: new byte[] { (byte) 0x00, (byte) 0xff, (byte) 0x40, (byte) 0xff }); //Blue 225: acmImage = new BufferedImage (ACM_WIDTH, ACM_HEIGHT, BufferedImage.TYPE_BYTE_BINARY, acmColorModel); 226: acmBitmap = ((DataBufferByte) acmImage.getRaster ().getDataBuffer ()).getData (); 227: acmDrawString3 (37, 1, "ADDRESS TRANSLATION CACHES"); 228: acmDrawString2 (8, 3, "USER DATA"); 229: acmDrawString2 (33, 3, "USER CODE"); 230: acmDrawString2 (55, 3, "SUPERVISOR DATA"); 231: acmDrawString2 (80, 3, "SUPERVISOR CODE"); 232: for (int z = 0; z < 4; z++) { 233: int x0 = 25 * z; 234: acmDrawString3 (x0 + 6, 4, "/64="); 235: acmDrawString3 (x0 + 13, 4, "% IN USE"); 236: acmDrawString2 (x0 + 4, 6, "LOGICAL PHYSICAL"); 237: } 238: acmDrawString2 (37, 71, "G:GLOBAL W:WRITE-PROTECTED"); 239: 240: //パネル 241: acmPanel = ComponentFactory.setFixedSize ( 242: new JPanel () { 243: @Override protected void paintComponent (Graphics g) { 244: g.drawImage (acmImage, 0, 0, null); 245: } 246: @Override protected void paintBorder (Graphics g) { 247: } 248: @Override protected void paintChildren (Graphics g) { 249: } 250: @Override public void update (Graphics g) { 251: } 252: }, ACM_WIDTH, ACM_HEIGHT); 253: acmPanel.setBackground (Color.black); 254: acmPanel.setOpaque (true); 255: 256: //ウインドウ 257: acmFrame = Multilingual.mlnTitle ( 258: ComponentFactory.createRestorableSubFrame ( 259: Settings.SGS_ACM_FRAME_KEY, 260: "Address translation caches monitor", 261: null, 262: acmPanel 263: ), 264: "ja", "アドレス変換キャッシュモニタ"); //Multilingual.mlnTitle 265: 266: // ウインドウリスナー 267: ComponentFactory.addListener ( 268: acmFrame, 269: new WindowAdapter () { 270: @Override public void windowClosing (WindowEvent we) { 271: XEiJ.dbgVisibleMask &= ~XEiJ.DBG_ACM_VISIBLE_MASK; 272: } 273: }); 274: 275: } //acmMakeFrame() 276: 277: //acmUpdateFrame () 278: // アドレス変換キャッシュモニタを更新する 279: public static void acmUpdateFrame () { 280: 281: if (acmFrame == null) { 282: return; 283: } 284: 285: for (int z = 0; z < 4; z++) { 286: int[] cache = acmCaches[z]; 287: int x0 = 25 * z; 288: int inuse = 0; 289: int t; 290: for (int l = 0, i = 0; l < 64; l++, i += 4) { //ライン,インデックス 291: t = XEiJ.FMT_BCD4[l]; 292: int y = 7 + l; 293: int r = cache[i]; //リード用の論理ページアドレス 294: if (!MC68060.mmuEnabled || r == 1) { //無効 295: acmDrawChar1 (x0 + 1, y, t >> 4 == 0 ? ' ' : (t >> 4) + '0'); //10の位 296: acmDrawChar1 (x0 + 2, y, (t & 15) + '0'); //1の位 297: acmDrawString1 (x0 + 4, y, "-------- -------- --"); 298: } else { //有効 299: inuse++; 300: int w = cache[i + 1]; //ライト用の論理ページアドレス 301: int p = cache[i + 2]; //物理ページアドレス 302: int g = cache[i + 3]; //グローバルフラグ 303: acmDrawChar3 (x0 + 1, y, t >> 4 == 0 ? ' ' : (t >> 4) + '0'); //10の位 304: acmDrawChar3 (x0 + 2, y, (t & 15) + '0'); //1の位 305: //論理ページアドレス 306: t = r >>> 28; 307: acmDrawChar3 (x0 + 4, y, (9 - t >> 4 & 7) + t + '0'); 308: t = r >>> 24 & 15; 309: acmDrawChar3 (x0 + 5, y, (9 - t >> 4 & 7) + t + '0'); 310: t = r >>> 20 & 15; 311: acmDrawChar3 (x0 + 6, y, (9 - t >> 4 & 7) + t + '0'); 312: t = r >>> 16 & 15; 313: acmDrawChar3 (x0 + 7, y, (9 - t >> 4 & 7) + t + '0'); 314: t = (char) r >>> 12; 315: acmDrawChar3 (x0 + 8, y, (9 - t >> 4 & 7) + t + '0'); 316: t = r >>> 8 & 15; 317: acmDrawChar3 (x0 + 9, y, (9 - t >> 4 & 7) + t + '0'); 318: t = r >>> 4 & 15; 319: acmDrawChar3 (x0 + 10, y, (9 - t >> 4 & 7) + t + '0'); 320: t = r & 15; 321: acmDrawChar3 (x0 + 11, y, (9 - t >> 4 & 7) + t + '0'); 322: //物理ページアドレス 323: t = p >>> 28; 324: acmDrawChar3 (x0 + 13, y, (9 - t >> 4 & 7) + t + '0'); 325: t = p >>> 24 & 15; 326: acmDrawChar3 (x0 + 14, y, (9 - t >> 4 & 7) + t + '0'); 327: t = p >>> 20 & 15; 328: acmDrawChar3 (x0 + 15, y, (9 - t >> 4 & 7) + t + '0'); 329: t = p >>> 16 & 15; 330: acmDrawChar3 (x0 + 16, y, (9 - t >> 4 & 7) + t + '0'); 331: t = (char) p >>> 12; 332: acmDrawChar3 (x0 + 17, y, (9 - t >> 4 & 7) + t + '0'); 333: t = p >>> 8 & 15; 334: acmDrawChar3 (x0 + 18, y, (9 - t >> 4 & 7) + t + '0'); 335: t = p >>> 4 & 15; 336: acmDrawChar3 (x0 + 19, y, (9 - t >> 4 & 7) + t + '0'); 337: t = p & 15; 338: acmDrawChar3 (x0 + 20, y, (9 - t >> 4 & 7) + t + '0'); 339: //グローバル 340: acmDrawChar3 (x0 + 22, y, g != 0 ? 'G' : '-'); 341: //ライトプロテクト 342: acmDrawChar3 (x0 + 23, y, w == 1 ? 'W' : '-'); 343: } //if 無効/有効 344: } //for l,i 345: t = XEiJ.FMT_BCD4[inuse]; 346: acmDrawChar3 (x0 + 4, 4, t >> 4 == 0 ? ' ' : (t >> 4) + '0'); //10の位 347: acmDrawChar3 (x0 + 5, 4, (t & 15) + '0'); //1の位 348: t = XEiJ.FMT_BCD4[100 * inuse + 32 >> 6]; 349: acmDrawChar3 (x0 + 10, 4, t >> 8 == 0 ? ' ' : (t >> 8) + '0'); //100の位 350: acmDrawChar3 (x0 + 11, 4, t >> 4 == 0 ? ' ' : (t >> 4 & 15) + '0'); //10の位 351: acmDrawChar3 (x0 + 12, 4, (t & 15) + '0'); //1の位 352: } //for z 353: 354: acmPanel.repaint (); 355: 356: } //acmUpdateFrame() 357: 358: //acmDrawChar1 (x, y, c) 359: // パレットコード1で文字を描く 360: public static void acmDrawChar1 (int x, int y, int c) { 361: byte[] bb = acmBitmap; 362: x += ACM_OFFSET * 6 * y; 363: c *= 5; 364: bb[x ] = ACM_FONT_1[c ]; 365: bb[x + ACM_OFFSET ] = ACM_FONT_1[c + 1]; 366: bb[x + ACM_OFFSET * 2] = ACM_FONT_1[c + 2]; 367: bb[x + ACM_OFFSET * 3] = ACM_FONT_1[c + 3]; 368: bb[x + ACM_OFFSET * 4] = ACM_FONT_1[c + 4]; 369: } //acmDrawChar1(int,int,int) 370: 371: //acmDrawChar2 (x, y, c) 372: // パレットコード2で文字を描く 373: public static void acmDrawChar2 (int x, int y, int c) { 374: byte[] bb = acmBitmap; 375: x += ACM_OFFSET * 6 * y; 376: c *= 5; 377: bb[x ] = ACM_FONT_2[c ]; 378: bb[x + ACM_OFFSET ] = ACM_FONT_2[c + 1]; 379: bb[x + ACM_OFFSET * 2] = ACM_FONT_2[c + 2]; 380: bb[x + ACM_OFFSET * 3] = ACM_FONT_2[c + 3]; 381: bb[x + ACM_OFFSET * 4] = ACM_FONT_2[c + 4]; 382: } //acmDrawChar2(int,int,int) 383: 384: //acmDrawChar3 (x, y, c) 385: // パレットコード3で文字を描く 386: public static void acmDrawChar3 (int x, int y, int c) { 387: byte[] bb = acmBitmap; 388: x += ACM_OFFSET * 6 * y; 389: c *= 5; 390: bb[x ] = ACM_FONT_3[c ]; 391: bb[x + ACM_OFFSET ] = ACM_FONT_3[c + 1]; 392: bb[x + ACM_OFFSET * 2] = ACM_FONT_3[c + 2]; 393: bb[x + ACM_OFFSET * 3] = ACM_FONT_3[c + 3]; 394: bb[x + ACM_OFFSET * 4] = ACM_FONT_3[c + 4]; 395: } //acmDrawChar3(int,int,int) 396: 397: //acmDrawString1 (x, y, s) 398: // パレットコード1で文字列を描く 399: public static void acmDrawString1 (int x, int y, String s) { 400: acmDrawString1 (x, y, s.toCharArray ()); 401: } //acmDrawString1(int,int,String) 402: public static void acmDrawString1 (int x, int y, char[] s) { 403: byte[] bb = acmBitmap; 404: x += ACM_OFFSET * 6 * y; 405: for (char c : s) { 406: c *= 5; 407: bb[x ] = ACM_FONT_1[c ]; 408: bb[x + ACM_OFFSET ] = ACM_FONT_1[c + 1]; 409: bb[x + ACM_OFFSET * 2] = ACM_FONT_1[c + 2]; 410: bb[x + ACM_OFFSET * 3] = ACM_FONT_1[c + 3]; 411: bb[x + ACM_OFFSET * 4] = ACM_FONT_1[c + 4]; 412: x++; 413: } 414: } //acmDrawString1(int,int,char[]) 415: 416: //acmDrawString2 (x, y, s) 417: // パレットコード2で文字列を描く 418: public static void acmDrawString2 (int x, int y, String s) { 419: acmDrawString2 (x, y, s.toCharArray ()); 420: } //acmDrawString2(int,int,String) 421: public static void acmDrawString2 (int x, int y, char[] s) { 422: byte[] bb = acmBitmap; 423: x += ACM_OFFSET * 6 * y; 424: for (char c : s) { 425: c *= 5; 426: bb[x ] = ACM_FONT_2[c ]; 427: bb[x + ACM_OFFSET ] = ACM_FONT_2[c + 1]; 428: bb[x + ACM_OFFSET * 2] = ACM_FONT_2[c + 2]; 429: bb[x + ACM_OFFSET * 3] = ACM_FONT_2[c + 3]; 430: bb[x + ACM_OFFSET * 4] = ACM_FONT_2[c + 4]; 431: x++; 432: } 433: } //acmDrawString2(int,int,char[]) 434: 435: //acmDrawString3 (x, y, s) 436: // パレットコード3で文字列を描く 437: public static void acmDrawString3 (int x, int y, String s) { 438: acmDrawString3 (x, y, s.toCharArray ()); 439: } //acmDrawString3(int,int,String) 440: public static void acmDrawString3 (int x, int y, char[] s) { 441: byte[] bb = acmBitmap; 442: x += ACM_OFFSET * 6 * y; 443: for (char c : s) { 444: c *= 5; 445: bb[x ] = ACM_FONT_3[c ]; 446: bb[x + ACM_OFFSET ] = ACM_FONT_3[c + 1]; 447: bb[x + ACM_OFFSET * 2] = ACM_FONT_3[c + 2]; 448: bb[x + ACM_OFFSET * 3] = ACM_FONT_3[c + 3]; 449: bb[x + ACM_OFFSET * 4] = ACM_FONT_3[c + 4]; 450: x++; 451: } 452: } //acmDrawString3(int,int,char[]) 453: 454: } //class ATCMonitor 455: 456: 457: