LogicalSpaceMonitor.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13: package xeij;
14:
15: import java.awt.*;
16: import java.awt.event.*;
17: import java.lang.*;
18: import javax.swing.*;
19:
20: public class LogicalSpaceMonitor {
21:
22: public static JFrame atwFrame;
23: public static final ScrollTextArea[] atwBoard = new ScrollTextArea[2];
24: public static final JTextArea[] atwTextArea = new JTextArea[2];
25:
26:
27:
28: public static void atwInit () {
29: atwFrame = null;
30: }
31:
32:
33: public static void atwStart () {
34: if (RestorableFrame.rfmGetOpened (Settings.SGS_ATW_FRAME_KEY)) {
35: atwOpen ();
36: }
37: }
38:
39:
40:
41:
42: public static void atwOpen () {
43: if (atwFrame == null) {
44: atwMake ();
45: }
46: atwUpdate ();
47: atwFrame.setVisible (true);
48: XEiJ.dbgVisibleMask |= XEiJ.DBG_ATW_VISIBLE_MASK;
49: }
50:
51:
52:
53: public static void atwMake () {
54:
55: for (int m = 0; m < 2; m++) {
56:
57: atwBoard[m] = ComponentFactory.setPreferredSize (
58: ComponentFactory.setFont (new ScrollTextArea (), LnF.lnfMonospacedFont),
59: 550, 250);
60: atwBoard[m].setMargin (new Insets (2, 4, 2, 4));
61: atwBoard[m].setHighlightCursorOn (true);
62: atwTextArea[m] = atwBoard[m].getTextArea ();
63: atwTextArea[m].setEditable (false);
64: }
65:
66:
67: ComponentFactory.addListener (
68: atwTextArea[0],
69: new MouseAdapter () {
70: @Override public void mousePressed (MouseEvent me) {
71: if (XEiJ.mpuTask == null && me.isPopupTrigger ()) {
72: XEiJ.dbgShowPopup (me, atwTextArea[0], false);
73: }
74: }
75: @Override public void mouseReleased (MouseEvent me) {
76: if (XEiJ.mpuTask == null && me.isPopupTrigger ()) {
77: XEiJ.dbgShowPopup (me, atwTextArea[0], false);
78: }
79: }
80: });
81: ComponentFactory.addListener (
82: atwTextArea[1],
83: new MouseAdapter () {
84: @Override public void mousePressed (MouseEvent me) {
85: if (XEiJ.mpuTask == null && me.isPopupTrigger ()) {
86: XEiJ.dbgShowPopup (me, atwTextArea[1], false);
87: }
88: }
89: @Override public void mouseReleased (MouseEvent me) {
90: if (XEiJ.mpuTask == null && me.isPopupTrigger ()) {
91: XEiJ.dbgShowPopup (me, atwTextArea[1], false);
92: }
93: }
94: });
95:
96:
97: ActionListener listener = new ActionListener () {
98: @Override public void actionPerformed (ActionEvent ae) {
99: Object source = ae.getSource ();
100: switch (ae.getActionCommand ()) {
101: case "Update":
102: atwUpdate ();
103: break;
104: }
105: }
106: };
107:
108:
109: atwFrame = Multilingual.mlnTitle (
110: ComponentFactory.createRestorableSubFrame (
111: Settings.SGS_ATW_FRAME_KEY,
112: "Logical space monitor",
113: null,
114: ComponentFactory.createBorderPanel (
115: ComponentFactory.createVerticalSplitPane (
116: ComponentFactory.createVerticalBox (
117: ComponentFactory.createHorizontalBox (
118: Multilingual.mlnText (ComponentFactory.createLabel ("User mode"), "ja", "ユーザモード"),
119: Box.createHorizontalGlue ()
120: ),
121: atwBoard[0]
122: ),
123: ComponentFactory.createVerticalBox (
124: ComponentFactory.createHorizontalBox (
125: Multilingual.mlnText (ComponentFactory.createLabel ("Supervisor mode"), "ja", "スーパーバイザモード"),
126: Box.createHorizontalGlue ()
127: ),
128: atwBoard[1]
129: )
130: ),
131: ComponentFactory.createHorizontalBox (
132: Multilingual.mlnToolTipText (
133: ComponentFactory.createImageButton (
134: XEiJ.createImage (
135: 20, 14,
136: "11111111111111111111" +
137: "1..................1" +
138: "1.......1111.......1" +
139: "1......111111.1....1" +
140: "1.....11....111....1" +
141: "1....11.....111....1" +
142: "1....11....1111....1" +
143: "1....11............1" +
144: "1....11............1" +
145: "1.....11....11.....1" +
146: "1......111111......1" +
147: "1.......1111.......1" +
148: "1..................1" +
149: "11111111111111111111",
150: LnF.lnfRGB[0],
151: LnF.lnfRGB[12]),
152: "Update", listener),
153: "ja", "更新"),
154: Box.createHorizontalGlue ()
155: )
156: )
157: ),
158: "ja", "論理空間モニタ");
159: ComponentFactory.addListener (
160: atwFrame,
161: new WindowAdapter () {
162: @Override public void windowClosing (WindowEvent we) {
163: XEiJ.dbgVisibleMask &= ~XEiJ.DBG_ATW_VISIBLE_MASK;
164: }
165: });
166:
167: }
168:
169:
170:
171: public static void atwUpdate () {
172: for (int m = 0; m < 2; m++) {
173: StringBuilder sb = new StringBuilder ();
174: sb.append (Multilingual.mlnJapanese ?
175:
176: " 論理アドレス 物理アドレス\n" :
177: " Logical address Physical address\n");
178: int l0 = 0x00000000;
179: int p0 = MC68060.mmuTranslatePeek (l0, m, 0);
180: int f0 = MC68060.mmuPeekFlags;
181: if ((p0 ^ l0) == 1) {
182: p0 = 1;
183: }
184: int l1 = MC68060.mmuPageSize;
185: while (l1 != 0x00000000) {
186: int p1 = MC68060.mmuTranslatePeek (l1, m, 0);
187: int f1 = MC68060.mmuPeekFlags;
188: if ((p1 ^ l1) == 1) {
189: p1 = 1;
190: }
191: if (!(p0 == 1 && p1 == 1 ||
192: p0 != 1 && p1 != 1 && p1 - p0 == l1 - l0 && f0 == f1)) {
193: if (p0 != 1) {
194: XEiJ.fmtHex8 (XEiJ.fmtHex8 (XEiJ.fmtHex8 (XEiJ.fmtHex8 (sb, l0).append ('-'), l1 - 1).append (" "), p0).append ('-'), p0 + (l1 - l0) - 1).append (' ');
195: if ((f0 & MC68060.MMU_DESCRIPTOR_SUPERVISOR_PROTECTED) != 0) {
196: sb.append (Multilingual.mlnJapanese ? " [スーパーバイザ]" : " [Supervisor]");
197: }
198: if ((f0 & MC68060.MMU_DESCRIPTOR_MODIFIED) != 0) {
199: sb.append (Multilingual.mlnJapanese ? " [修正済み]" : " [Modified]");
200: }
201: if ((f0 & MC68060.MMU_DESCRIPTOR_USED) != 0) {
202: sb.append (Multilingual.mlnJapanese ? " [使用済み]" : " [Used]");
203: }
204: if ((f0 & MC68060.MMU_DESCRIPTOR_WRITE_PROTECTED) != 0) {
205: sb.append (Multilingual.mlnJapanese ? " [書き込み禁止]" : " [Write-protected]");
206: }
207: sb.append ('\n');
208: }
209: l0 = l1;
210: p0 = p1;
211: f0 = f1;
212: }
213: l1 += MC68060.mmuPageSize;
214: }
215: if (p0 != 1) {
216: XEiJ.fmtHex8 (XEiJ.fmtHex8 (XEiJ.fmtHex8 (XEiJ.fmtHex8 (sb, l0).append ('-'), l1 - 1).append (" "), p0).append ('-'), p0 + (l1 - l0) - 1).append (' ');
217: if ((f0 & MC68060.MMU_DESCRIPTOR_SUPERVISOR_PROTECTED) != 0) {
218: sb.append (Multilingual.mlnJapanese ? " [スーパーバイザ]" : " [Supervisor]");
219: }
220: if ((f0 & MC68060.MMU_DESCRIPTOR_MODIFIED) != 0) {
221: sb.append (Multilingual.mlnJapanese ? " [修正済み]" : " [Modified]");
222: }
223: if ((f0 & MC68060.MMU_DESCRIPTOR_USED) != 0) {
224: sb.append (Multilingual.mlnJapanese ? " [使用済み]" : " [Used]");
225: }
226: if ((f0 & MC68060.MMU_DESCRIPTOR_WRITE_PROTECTED) != 0) {
227: sb.append (Multilingual.mlnJapanese ? " [書き込み禁止]" : " [Write-protected]");
228: }
229: sb.append ('\n');
230: }
231: atwTextArea[m].setText (sb.toString ());
232: atwTextArea[m].setCaretPosition (0);
233: }
234: }
235:
236: }
237:
238:
239: