ProgramFlowVisualizer.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48: package xeij;
49:
50: import java.awt.*;
51: import java.awt.event.*;
52: import java.awt.image.*;
53: import java.lang.*;
54: import java.util.*;
55: import javax.swing.*;
56:
57: public class ProgramFlowVisualizer {
58:
59: public static final boolean PFV_ON = true;
60:
61:
62: public static final int PFV_LOG2_BYTES_PER_CELL = 5;
63: public static final int PFV_LOG2_CELLS_PER_LINE = 8;
64: public static final int PFV_LOG2_BYTES_PER_LINE = PFV_LOG2_BYTES_PER_CELL + PFV_LOG2_CELLS_PER_LINE;
65: public static final int PFV_LOG2_TOTAL_LINES = 32 - PFV_LOG2_BYTES_PER_LINE;
66: public static final int PFV_BYTES_PER_CELL = 1 << PFV_LOG2_BYTES_PER_CELL;
67: public static final int PFV_CELLS_PER_LINE = 1 << PFV_LOG2_CELLS_PER_LINE;
68: public static final int PFV_BYTES_PER_LINE = 1 << PFV_LOG2_BYTES_PER_LINE;
69: public static final int PFV_TOTAL_LINES = 1 << PFV_LOG2_TOTAL_LINES;
70:
71: public static final int PFV_MARGIN_LEFT = 2;
72: public static final int PFV_ADDRESS1_WIDTH = 34;
73: public static final int PFV_BAR_WIDTH = 10;
74: public static final int PFV_FUNNEL_WIDTH = 8;
75: public static final int PFV_ADDRESS2_WIDTH = 34;
76: public static final int PFV_MAP_WIDTH = PFV_CELLS_PER_LINE << 1;
77: public static final int PFV_MARGIN_RIGHT = 2;
78:
79: public static final int PFV_ADDRESS1_X0 = PFV_MARGIN_LEFT;
80: public static final int PFV_BAR_X0 = PFV_ADDRESS1_X0 + PFV_ADDRESS1_WIDTH;
81: public static final int PFV_FUNNEL_X0 = PFV_BAR_X0 + PFV_BAR_WIDTH;
82: public static final int PFV_ADDRESS2_X0 = PFV_FUNNEL_X0 + PFV_FUNNEL_WIDTH;
83: public static final int PFV_MAP_X0 = PFV_ADDRESS2_X0 + PFV_ADDRESS2_WIDTH;
84: public static final int PFV_PANEL_WIDTH = PFV_MAP_X0 + PFV_MAP_WIDTH + PFV_MARGIN_RIGHT;
85:
86: public static final int PFV_MARGIN_TOP = 2;
87: public static final int PFV_OFFSET_HEIGHT = 6 + 2;
88: public static final int PFV_MAP_MIN_HEIGHT = 128;
89: public static final int PFV_MAP_DEFAULT_HEIGHT = 256;
90: public static final int PFV_MARGIN_BOTTOM = 2;
91:
92: public static final int PFV_OFFSET_Y0 = PFV_MARGIN_TOP;
93: public static final int PFV_MAP_Y0 = PFV_OFFSET_Y0 + PFV_OFFSET_HEIGHT;
94: public static final int PFV_PANEL_MIN_HEIGHT = PFV_MAP_Y0 + PFV_MAP_MIN_HEIGHT + PFV_MARGIN_BOTTOM;
95: public static final int PFV_PANEL_DEFAULT_HEIGHT = PFV_MAP_Y0 + PFV_MAP_DEFAULT_HEIGHT + PFV_MARGIN_BOTTOM;
96:
97: public static final int PFV_PANEL_MAX_HEIGHT = 1024;
98:
99: public static int pfvPanelHeight;
100: public static int pfvMapHeight;
101: public static int pfvMapY1;
102: public static int pfvLines;
103:
104:
105: public static int pfvLine0;
106: public static int pfvLine1;
107: public static int pfvAddress0;
108: public static int pfvAddress1;
109: public static int pfvFunnelY0;
110: public static int pfvFunnelY1;
111: public static int pfvPressedX;
112: public static int pfvPressedY;
113: public static int pfvPressedLine0;
114: public static int pfvSpan;
115:
116:
117:
118:
119: public static final float PFV_COLOR_H0 = 4F / 6F;
120: public static final float PFV_COLOR_H1 = 7F / 6F;
121: public static final float PFV_COLOR_S0 = 1F;
122: public static final float PFV_COLOR_S1 = 1F;
123: public static final float PFV_COLOR_B0 = 0.2F;
124: public static final float PFV_COLOR_B1 = 1F;
125: public static final int PFV_ADDRESS_PALET = 240;
126: public static final int PFV_FUNNEL_PALET = 240;
127:
128:
129: public static BufferedImage pfvImage;
130: public static byte[] pfvBitmap;
131: public static JPanel pfvPanel;
132: public static JFrame pfvFrame;
133:
134:
135: public static final int PFV_INTERVAL = 10;
136: public static int pfvTimer;
137:
138:
139:
140: public static void pfvInit () {
141:
142: pfvPanelHeight = PFV_PANEL_DEFAULT_HEIGHT;
143: pfvMapHeight = PFV_MAP_DEFAULT_HEIGHT;
144: pfvMapY1 = PFV_MAP_Y0 - 1 + pfvMapHeight;
145: pfvLines = pfvMapHeight + 1 >>> 1;
146:
147: pfvLine0 = 0;
148: pfvLine1 = pfvLine0 + pfvLines - 1;
149: pfvAddress0 = pfvLine0 << PFV_LOG2_BYTES_PER_LINE;
150: pfvAddress1 = (pfvLine1 + 1 << PFV_LOG2_BYTES_PER_LINE) - 2;
151: pfvFunnelY0 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine0 / PFV_TOTAL_LINES);
152: pfvFunnelY1 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine1 / PFV_TOTAL_LINES);
153: pfvPressedX = -1;
154:
155:
156: pfvSpan = 8;
157:
158: byte[] red = new byte[256];
159: byte[] green = new byte[256];
160: byte[] blue = new byte[256];
161: for (int i = 0; i < 256; i++) {
162: int rgb = Color.HSBtoRGB (PFV_COLOR_H0 + i * (1F / 256F * (PFV_COLOR_H1 - PFV_COLOR_H0)),
163: PFV_COLOR_S0 + i * (1F / 256F * (PFV_COLOR_S1 - PFV_COLOR_S0)),
164: PFV_COLOR_B0 + i * (1F / 256F * (PFV_COLOR_B1 - PFV_COLOR_B0)));
165: red[i] = (byte) (rgb >>> 16);
166: green[i] = (byte) (rgb >>> 8);
167: blue[i] = (byte) rgb;
168: }
169: IndexColorModel icm = new IndexColorModel (8, 256, red, green, blue);
170:
171: pfvImage = new BufferedImage (PFV_PANEL_WIDTH, PFV_PANEL_MAX_HEIGHT, BufferedImage.TYPE_BYTE_INDEXED, icm);
172: pfvBitmap = ((DataBufferByte) pfvImage.getRaster ().getDataBuffer ()).getData ();
173: pfvPanel = null;
174: pfvFrame = null;
175:
176: pfvTimer = 0;
177: }
178:
179:
180: public static void pfvStart () {
181: if (RestorableFrame.rfmGetOpened (Settings.SGS_PFV_FRAME_KEY)) {
182: pfvOpen ();
183: }
184: }
185:
186:
187:
188: public static void pfvOpen () {
189: if (pfvFrame == null) {
190: pfvMakeFrame ();
191: }
192: XEiJ.dbgVisibleMask |= XEiJ.DBG_PFV_VISIBLE_MASK;
193: if (XEiJ.mpuTask == null) {
194: pfvUpdate ();
195: }
196: XEiJ.pnlExitFullScreen (false);
197: pfvFrame.setVisible (true);
198: }
199:
200:
201:
202:
203: public static void pfvMakeFrame () {
204:
205: pfvPanel = ComponentFactory.setMinimumSize (
206: ComponentFactory.setPreferredSize (
207: ComponentFactory.setMaximumSize (
208: new JPanel () {
209: @Override public void paint (Graphics g) {
210: g.drawImage (pfvImage, 0, 0, null);
211: }
212: @Override protected void paintComponent (Graphics g) {
213: }
214: @Override protected void paintBorder (Graphics g) {
215: }
216: @Override protected void paintChildren (Graphics g) {
217: }
218: @Override public void update (Graphics g) {
219: }
220: },
221: PFV_PANEL_WIDTH, PFV_PANEL_MAX_HEIGHT),
222: PFV_PANEL_WIDTH, PFV_PANEL_DEFAULT_HEIGHT),
223: PFV_PANEL_WIDTH, PFV_PANEL_MIN_HEIGHT);
224:
225: ComponentFactory.addListener (
226: pfvPanel,
227: new ComponentAdapter () {
228: @Override public void componentResized (ComponentEvent ce) {
229: pfvPanelHeight = Math.max (PFV_PANEL_MIN_HEIGHT, Math.min (PFV_PANEL_MAX_HEIGHT, pfvPanel.getHeight ()));
230: pfvMapHeight = pfvPanelHeight - (PFV_MARGIN_TOP + PFV_MARGIN_BOTTOM);
231: pfvMapY1 = PFV_MAP_Y0 - 1 + pfvMapHeight;
232: pfvLines = pfvMapHeight + 1 >> 1;
233: pfvLine0 = Math.max (0, Math.min (PFV_TOTAL_LINES - pfvLines, pfvLine0 + pfvLine1 + 1 - pfvLines >> 1));
234: pfvLine1 = pfvLine0 + pfvLines - 1;
235: pfvAddress0 = pfvLine0 << PFV_LOG2_BYTES_PER_LINE;
236: pfvAddress1 = (pfvLine1 + 1 << PFV_LOG2_BYTES_PER_LINE) - 2;
237: pfvFunnelY0 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine0 / PFV_TOTAL_LINES);
238: pfvFunnelY1 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine1 / PFV_TOTAL_LINES);
239: if (XEiJ.mpuTask == null) {
240: pfvUpdate ();
241: }
242: }
243: });
244:
245: pfvPanel.setFocusable (true);
246: ComponentFactory.addListener (
247: pfvPanel,
248: new KeyAdapter () {
249: @Override public void keyPressed (KeyEvent ke) {
250: int line0;
251: switch (ke.getKeyCode ()) {
252: case KeyEvent.VK_UP:
253: line0 = pfvLine0 - 16;
254: break;
255: case KeyEvent.VK_DOWN:
256: line0 = pfvLine0 + 16;
257: break;
258: case KeyEvent.VK_PAGE_UP:
259: line0 = pfvLine0 - (pfvLines * 15 >> 4);
260: break;
261: case KeyEvent.VK_PAGE_DOWN:
262: line0 = pfvLine0 + (pfvLines * 15 >> 4);
263: break;
264: default:
265: return;
266: }
267: pfvLine0 = Math.max (0, Math.min (PFV_TOTAL_LINES - pfvLines, line0));
268: pfvLine1 = pfvLine0 + pfvLines - 1;
269: pfvAddress0 = pfvLine0 << PFV_LOG2_BYTES_PER_LINE;
270: pfvAddress1 = (pfvLine1 + 1 << PFV_LOG2_BYTES_PER_LINE) - 2;
271: pfvFunnelY0 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine0 / PFV_TOTAL_LINES);
272: pfvFunnelY1 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine1 / PFV_TOTAL_LINES);
273: if (XEiJ.mpuTask == null) {
274: pfvUpdate ();
275: }
276: }
277: });
278:
279: ComponentFactory.addListener (
280: pfvPanel,
281: new MouseAdapter () {
282: @Override public void mouseClicked (MouseEvent me) {
283: int x = me.getX ();
284: int y = me.getY ();
285: if (PFV_MAP_X0 <= x && x < PFV_MAP_X0 + PFV_MAP_WIDTH && PFV_MAP_Y0 <= y && y <= pfvMapY1) {
286:
287: DisassembleList.ddpOpen (pfvAddress0 + (x - PFV_MAP_X0 >> 1 << PFV_LOG2_BYTES_PER_CELL) + (y - PFV_MAP_Y0 >> 1 << PFV_LOG2_BYTES_PER_LINE), XEiJ.regSRS, false);
288: }
289: }
290: @Override public void mouseExited (MouseEvent me) {
291: pfvPressedX = -1;
292: }
293: @Override public void mousePressed (MouseEvent me) {
294: int x = me.getX ();
295: int y = me.getY ();
296: if (PFV_BAR_X0 <= x && x < PFV_ADDRESS2_X0) {
297: pfvLine0 = Math.max (0, Math.min (PFV_TOTAL_LINES - pfvLines, (int) ((long) PFV_TOTAL_LINES * (y - PFV_MAP_Y0) / pfvMapHeight) - (pfvLines >> 1)));
298: pfvLine1 = pfvLine0 + pfvLines - 1;
299: pfvAddress0 = pfvLine0 << PFV_LOG2_BYTES_PER_LINE;
300: pfvAddress1 = (pfvLine1 + 1 << PFV_LOG2_BYTES_PER_LINE) - 2;
301: pfvFunnelY0 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine0 / PFV_TOTAL_LINES);
302: pfvFunnelY1 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine1 / PFV_TOTAL_LINES);
303: if (XEiJ.mpuTask == null) {
304: pfvUpdate ();
305: }
306: }
307: pfvPressedX = x;
308: pfvPressedY = y;
309: pfvPressedLine0 = pfvLine0;
310: }
311: @Override public void mouseReleased (MouseEvent me) {
312: pfvPressedX = -1;
313: }
314: });
315:
316: ComponentFactory.addListener (
317: pfvPanel,
318: new MouseMotionAdapter () {
319: @Override public void mouseDragged (MouseEvent me) {
320: if (pfvPressedX >= 0) {
321: int x = me.getX ();
322: int y = me.getY ();
323: pfvLine0 = Math.max (0, Math.min (PFV_TOTAL_LINES - pfvLines,
324: PFV_BAR_X0 <= x && pfvPressedX < PFV_ADDRESS2_X0 ?
325: (int) ((long) PFV_TOTAL_LINES * (y - PFV_MAP_Y0) / pfvMapHeight) - (pfvLines >> 1) :
326: pfvPressedLine0 - (y - pfvPressedY >> 1)));
327: pfvLine1 = pfvLine0 + pfvLines - 1;
328: pfvAddress0 = pfvLine0 << PFV_LOG2_BYTES_PER_LINE;
329: pfvAddress1 = (pfvLine1 + 1 << PFV_LOG2_BYTES_PER_LINE) - 2;
330: pfvFunnelY0 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine0 / PFV_TOTAL_LINES);
331: pfvFunnelY1 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine1 / PFV_TOTAL_LINES);
332: if (XEiJ.mpuTask == null) {
333: pfvUpdate ();
334: }
335: }
336: }
337: });
338:
339: ComponentFactory.addListener (
340: pfvPanel,
341: new MouseWheelListener () {
342: @Override public void mouseWheelMoved (MouseWheelEvent mwe) {
343: pfvLine0 = Math.max (0, Math.min (PFV_TOTAL_LINES - pfvLines, pfvLine0 + (mwe.getWheelRotation () << 4)));
344: pfvLine1 = pfvLine0 + pfvLines - 1;
345: pfvAddress0 = pfvLine0 << PFV_LOG2_BYTES_PER_LINE;
346: pfvAddress1 = (pfvLine1 + 1 << PFV_LOG2_BYTES_PER_LINE) - 2;
347: pfvFunnelY0 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine0 / PFV_TOTAL_LINES);
348: pfvFunnelY1 = PFV_MAP_Y0 + (int) ((long) pfvMapHeight * pfvLine1 / PFV_TOTAL_LINES);
349: if (XEiJ.mpuTask == null) {
350: pfvUpdate ();
351: }
352: }
353: });
354:
355: ActionListener listener = new ActionListener () {
356: @Override public void actionPerformed (ActionEvent ae) {
357: Object source = ae.getSource ();
358: switch (ae.getActionCommand ()) {
359: case "Clear":
360: if (XEiJ.mpuTask == null) {
361: BranchLog.blgReset ();
362: BranchLog.blgArray[0] = XEiJ.regPC | XEiJ.regSRS >>> 13;
363: BranchLog.blgArray[1] = XEiJ.regPC;
364: pfvUpdate ();
365: }
366: break;
367: case "256 records":
368: pfvSpan = 0;
369: if (XEiJ.mpuTask == null) {
370: pfvUpdate ();
371: }
372: break;
373: case "512 records":
374: pfvSpan = 1;
375: if (XEiJ.mpuTask == null) {
376: pfvUpdate ();
377: }
378: break;
379: case "1024 records":
380: pfvSpan = 2;
381: if (XEiJ.mpuTask == null) {
382: pfvUpdate ();
383: }
384: break;
385: case "2048 records":
386: pfvSpan = 3;
387: if (XEiJ.mpuTask == null) {
388: pfvUpdate ();
389: }
390: break;
391: case "4096 records":
392: pfvSpan = 4;
393: if (XEiJ.mpuTask == null) {
394: pfvUpdate ();
395: }
396: break;
397: case "8192 records":
398: pfvSpan = 5;
399: if (XEiJ.mpuTask == null) {
400: pfvUpdate ();
401: }
402: break;
403: case "16384 records":
404: pfvSpan = 6;
405: if (XEiJ.mpuTask == null) {
406: pfvUpdate ();
407: }
408: break;
409: case "32768 records":
410: pfvSpan = 7;
411: if (XEiJ.mpuTask == null) {
412: pfvUpdate ();
413: }
414: break;
415: case "65536 records":
416: pfvSpan = 8;
417: if (XEiJ.mpuTask == null) {
418: pfvUpdate ();
419: }
420: break;
421: }
422: }
423: };
424:
425: ButtonGroup spanGroup = new ButtonGroup ();
426: pfvFrame = Multilingual.mlnTitle (
427: ComponentFactory.createRestorableSubFrame (
428: Settings.SGS_PFV_FRAME_KEY,
429: "Program flow visualizer",
430: null,
431: ComponentFactory.createBorderPanel (
432:
433: pfvPanel,
434:
435: ComponentFactory.createHorizontalBox (
436: XEiJ.mpuAddButtonStopped (
437: Multilingual.mlnToolTipText (
438: ComponentFactory.createImageButton (
439: LnF.LNF_CLEAR_IMAGE,
440: LnF.LNF_CLEAR_DISABLED_IMAGE,
441: "Clear", listener),
442: "ja", "クリア")
443: ),
444: Box.createHorizontalGlue (),
445: Multilingual.mlnToolTipText (
446: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 0,
447: LnF.LNF_NUMBER_IMAGE_ARRAY[0], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[0],
448: "256 records", listener),
449: "ja", "256 レコード"),
450: Multilingual.mlnToolTipText (
451: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 1,
452: LnF.LNF_NUMBER_IMAGE_ARRAY[1], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[1],
453: "512 records", listener),
454: "ja", "512 レコード"),
455: Multilingual.mlnToolTipText (
456: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 2,
457: LnF.LNF_NUMBER_IMAGE_ARRAY[2], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[2],
458: "1024 records", listener),
459: "ja", "1024 レコード"),
460: Multilingual.mlnToolTipText (
461: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 3,
462: LnF.LNF_NUMBER_IMAGE_ARRAY[3], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[3],
463: "2048 records", listener),
464: "ja", "2048 レコード"),
465: Multilingual.mlnToolTipText (
466: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 4,
467: LnF.LNF_NUMBER_IMAGE_ARRAY[4], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[4],
468: "4096 records", listener),
469: "ja", "4096 レコード"),
470: Multilingual.mlnToolTipText (
471: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 5,
472: LnF.LNF_NUMBER_IMAGE_ARRAY[5], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[5],
473: "8192 records", listener),
474: "ja", "8192 レコード"),
475: Multilingual.mlnToolTipText (
476: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 6,
477: LnF.LNF_NUMBER_IMAGE_ARRAY[6], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[6],
478: "16384 records", listener),
479: "ja", "16384 レコード"),
480: Multilingual.mlnToolTipText (
481: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 7,
482: LnF.LNF_NUMBER_IMAGE_ARRAY[7], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[7],
483: "32768 records", listener),
484: "ja", "32768 レコード"),
485: Multilingual.mlnToolTipText (
486: ComponentFactory.createIconRadioButton (spanGroup, pfvSpan == 8,
487: LnF.LNF_NUMBER_IMAGE_ARRAY[8], LnF.LNF_NUMBER_SELECTED_IMAGE_ARRAY[8],
488: "65536 records", listener),
489: "ja", "65536 レコード"),
490: Box.createHorizontalGlue (),
491: XEiJ.mpuMakeBreakButton (),
492: XEiJ.mpuMakeTraceButton (),
493: XEiJ.mpuMakeTrace10Button (),
494: XEiJ.mpuMakeTrace100Button (),
495: XEiJ.mpuMakeStepButton (),
496: XEiJ.mpuMakeStep10Button (),
497: XEiJ.mpuMakeStep100Button (),
498: XEiJ.mpuMakeReturnButton (),
499: XEiJ.mpuMakeRunButton ()
500: )
501: )
502: ),
503: "ja", "プログラムフロービジュアライザ");
504:
505: ComponentFactory.addListener (
506: pfvFrame,
507: new WindowAdapter () {
508: @Override public void windowClosing (WindowEvent we) {
509: XEiJ.dbgVisibleMask &= ~XEiJ.DBG_PFV_VISIBLE_MASK;
510: }
511: });
512: }
513:
514:
515:
516: public static void pfvUpdate () {
517: if (BranchLog.blgLock) {
518: return;
519: }
520: BranchLog.blgLock = true;
521: BranchLog.blgStop ();
522: Arrays.fill (pfvBitmap, 0, PFV_PANEL_WIDTH * pfvPanelHeight, (byte) 0);
523:
524: {
525: int sbits = 32 - 27 + Integer.numberOfLeadingZeros (pfvMapHeight);
526: int xbasemax = 1 << 32 - sbits;
527: for (int xbase = 0; xbase < xbasemax; xbase++) {
528: int x = xbase << sbits;
529: int i = PFV_PANEL_WIDTH * (PFV_MAP_Y0 - 2) + PFV_ADDRESS1_X0 + PFV_PANEL_WIDTH * (int) ((long) pfvMapHeight * (x & 0xffffffffL) >>> 32);
530: int t = x >>> 28;
531: pfvPutc ( i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
532: t = x >>> 24 & 15;
533: pfvPutc (4 * 1 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
534: t = x >>> 20 & 15;
535: pfvPutc (4 * 2 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
536: t = x >>> 16 & 15;
537: pfvPutc (4 * 3 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
538: t = (char) x >>> 12;
539: pfvPutc (4 * 4 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
540: t = x >>> 8 & 15;
541: pfvPutc (4 * 5 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
542: t = x >>> 4 & 15;
543: pfvPutc (4 * 6 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
544: t = x & 15;
545: pfvPutc (4 * 7 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
546: }
547: }
548:
549: {
550: int i = PFV_PANEL_WIDTH * PFV_MAP_Y0 + PFV_FUNNEL_X0 + (PFV_FUNNEL_WIDTH >>> 1);
551: pfvBitmap[i] =
552: pfvBitmap[i + 1] =
553: pfvBitmap[i + 2] =
554: pfvBitmap[i + 3] = (byte) PFV_FUNNEL_PALET;
555: for (int y = PFV_MAP_Y0; y < pfvFunnelY0; y++) {
556: pfvBitmap[i] = (byte) PFV_FUNNEL_PALET;
557: i += PFV_PANEL_WIDTH;
558: }
559: pfvBitmap[i - 3] =
560: pfvBitmap[i - 2] =
561: pfvBitmap[i - 1] =
562: pfvBitmap[i] = (byte) PFV_FUNNEL_PALET;
563: i += PFV_PANEL_WIDTH * (pfvFunnelY1 - pfvFunnelY0);
564: pfvBitmap[i - 3] =
565: pfvBitmap[i - 2] =
566: pfvBitmap[i - 1] =
567: pfvBitmap[i] = (byte) PFV_FUNNEL_PALET;
568: for (int y = pfvFunnelY1; y < pfvMapY1; y++) {
569: pfvBitmap[i] = (byte) PFV_FUNNEL_PALET;
570: i += PFV_PANEL_WIDTH;
571: }
572: pfvBitmap[i] =
573: pfvBitmap[i + 1] =
574: pfvBitmap[i + 2] =
575: pfvBitmap[i + 3] = (byte) PFV_FUNNEL_PALET;
576: }
577:
578: {
579: final int s = 4096 << PFV_LOG2_BYTES_PER_CELL - 1;
580: int x0 = pfvAddress0 + s - 1 & -s;
581: int xo1 = pfvAddress1 - x0;
582: for (int xo = 0; xo <= xo1; xo += s) {
583: int x = x0 + xo;
584: int i = PFV_PANEL_WIDTH * (PFV_MAP_Y0 - 2) + PFV_ADDRESS2_X0 + PFV_PANEL_WIDTH * (x - pfvAddress0 >>> PFV_LOG2_BYTES_PER_LINE - 1);
585: int t = x >>> 28;
586: pfvPutc ( i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
587: t = x >>> 24 & 15;
588: pfvPutc (4 * 1 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
589: t = x >>> 20 & 15;
590: pfvPutc (4 * 2 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
591: t = x >>> 16 & 15;
592: pfvPutc (4 * 3 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
593: t = (char) x >>> 12;
594: pfvPutc (4 * 4 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
595: t = x >>> 8 & 15;
596: pfvPutc (4 * 5 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
597: t = x >>> 4 & 15;
598: pfvPutc (4 * 6 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
599: t = x & 15;
600: pfvPutc (4 * 7 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
601: }
602: }
603:
604: {
605: final int s = 16 << PFV_LOG2_BYTES_PER_CELL - 1;
606: int y = PFV_OFFSET_Y0 + 2;
607: for (int x = 0; x < PFV_BYTES_PER_LINE; x += s) {
608: y = PFV_OFFSET_Y0 + PFV_OFFSET_Y0 + 2 - y;
609: if (x < 0x10) {
610: int i = PFV_PANEL_WIDTH * y + PFV_MAP_X0 - 1 + (x >>> PFV_LOG2_BYTES_PER_CELL - 1);
611: pfvPutc ( i, (9 - x >> 4 & 7 | 48) + x, PFV_ADDRESS_PALET);
612: } else if (x < 0x100) {
613: int i = PFV_PANEL_WIDTH * y + PFV_MAP_X0 - 3 + (x >>> PFV_LOG2_BYTES_PER_CELL - 1);
614: int t = x >>> 4 & 15;
615: pfvPutc ( i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
616: t = x & 15;
617: pfvPutc (4 * 1 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
618: } else if (x < 0x1000) {
619: int i = PFV_PANEL_WIDTH * y + PFV_MAP_X0 - 5 + (x >>> PFV_LOG2_BYTES_PER_CELL - 1);
620: int t = x >>> 8 & 15;
621: pfvPutc ( i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
622: t = x >>> 4 & 15;
623: pfvPutc (4 * 1 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
624: t = x & 15;
625: pfvPutc (4 * 2 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
626: } else {
627: int i = PFV_PANEL_WIDTH * y + PFV_MAP_X0 - 7 + (x >>> PFV_LOG2_BYTES_PER_CELL - 1);
628: int t = x >>> 12 & 15;
629: pfvPutc ( i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
630: t = x >>> 8 & 15;
631: pfvPutc (4 * 1 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
632: t = x >>> 4 & 15;
633: pfvPutc (4 * 2 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
634: t = x & 15;
635: pfvPutc (4 * 3 + i, (9 - t >> 4 & 7 | 48) + t, PFV_ADDRESS_PALET);
636: }
637: }
638: }
639:
640: long newestRecord = BranchLog.blgNewestRecord;
641: long oldestRecord = Math.max (0L, BranchLog.blgNewestRecord - 65535L);
642: oldestRecord = newestRecord - (long) Math.min ((256 << pfvSpan) - 1, (int) (newestRecord - oldestRecord));
643: for (long record = oldestRecord; record <= newestRecord; record++) {
644: int palet = 255 - ((int) (newestRecord - record) >>> pfvSpan);
645: int address0, supervisor, address1;
646: {
647: int i = (char) record << BranchLog.BLG_RECORD_SHIFT;
648: address0 = BranchLog.blgArray[i] & ~1;
649: supervisor = BranchLog.blgArray[i] & 1;
650: address1 = BranchLog.blgArray[i + 1];
651: }
652:
653: {
654: int y0 = (int) ((long) pfvMapHeight * (address0 & 0xffffffffL) >>> 32);
655: int y1 = (int) ((long) pfvMapHeight * (address1 & 0xffffffffL) >>> 32);
656: int i = PFV_PANEL_WIDTH * PFV_MAP_Y0 + PFV_BAR_X0 + PFV_PANEL_WIDTH * y0;
657: for (int y = y0; y <= y1; y++) {
658: pfvBitmap[i] =
659: pfvBitmap[i + 1] =
660: pfvBitmap[i + 2] =
661: pfvBitmap[i + 3] =
662: pfvBitmap[i + 4] =
663: pfvBitmap[i + 5] =
664: pfvBitmap[i + 6] =
665: pfvBitmap[i + 7] = (byte) palet;
666: i += PFV_PANEL_WIDTH;
667: }
668: }
669:
670: if ((address0 & 0xffffffffL) <= (pfvAddress1 & 0xffffffffL) && (pfvAddress0 & 0xffffffffL) <= (address1 & 0xffffffffL)) {
671: if ((address0 & 0xffffffffL) < (pfvAddress0 & 0xffffffffL)) {
672: address0 = pfvAddress0;
673: }
674: if ((address1 & 0xffffffffL) > (pfvAddress1 & 0xffffffffL)) {
675: address1 = pfvAddress1;
676: }
677: int line = address0 >>> PFV_LOG2_BYTES_PER_LINE;
678: int line1 = address1 >>> PFV_LOG2_BYTES_PER_LINE;
679: int i0 = PFV_PANEL_WIDTH * PFV_MAP_Y0 + PFV_MAP_X0 + PFV_PANEL_WIDTH * (line - pfvLine0 << 1);
680: int i = i0 + ((address0 & PFV_BYTES_PER_LINE - 2) >>> PFV_LOG2_BYTES_PER_CELL - 1 & -2);
681: for (; line <= line1; line++) {
682: int i1 = i0 + (line < line1 ? PFV_BYTES_PER_LINE - 2 >>> PFV_LOG2_BYTES_PER_CELL - 1 & -2 :
683: (address1 & PFV_BYTES_PER_LINE - 2) >>> PFV_LOG2_BYTES_PER_CELL - 1 & -2);
684: for (; i <= i1; i += 2) {
685: pfvBitmap[i] =
686: pfvBitmap[i + 1] =
687: pfvBitmap[i + PFV_PANEL_WIDTH] =
688: pfvBitmap[i + (PFV_PANEL_WIDTH + 1)] = (byte) palet;
689: }
690: i = i0 += PFV_PANEL_WIDTH << 1;
691: }
692: }
693: }
694: pfvPanel.repaint ();
695: pfvTimer = PFV_INTERVAL;
696: BranchLog.blgLock = false;
697: }
698:
699:
700:
701: public static void pfvPutc (int i, int c, int p) {
702: int t = Indicator.IND_ASCII_3X5[c];
703: if (t << 17 < 0) {
704: pfvBitmap[ i] = (byte) p;
705: }
706: if (t << 18 < 0) {
707: pfvBitmap[ 1 + i] = (byte) p;
708: }
709: if (t << 19 < 0) {
710: pfvBitmap[ 2 + i] = (byte) p;
711: }
712: if (t << 20 < 0) {
713: pfvBitmap[PFV_PANEL_WIDTH + i] = (byte) p;
714: }
715: if (t << 21 < 0) {
716: pfvBitmap[PFV_PANEL_WIDTH + 1 + i] = (byte) p;
717: }
718: if (t << 22 < 0) {
719: pfvBitmap[PFV_PANEL_WIDTH + 2 + i] = (byte) p;
720: }
721: if (t << 23 < 0) {
722: pfvBitmap[PFV_PANEL_WIDTH * 2 + i] = (byte) p;
723: }
724: if ((byte) t < 0) {
725: pfvBitmap[PFV_PANEL_WIDTH * 2 + 1 + i] = (byte) p;
726: }
727: if (t << 25 < 0) {
728: pfvBitmap[PFV_PANEL_WIDTH * 2 + 2 + i] = (byte) p;
729: }
730: if (t << 26 < 0) {
731: pfvBitmap[PFV_PANEL_WIDTH * 3 + i] = (byte) p;
732: }
733: if (t << 27 < 0) {
734: pfvBitmap[PFV_PANEL_WIDTH * 3 + 1 + i] = (byte) p;
735: }
736: if (XEiJ.TEST_BIT_3_SHIFT ? t << 28 < 0 : (t & 8) != 0) {
737: pfvBitmap[PFV_PANEL_WIDTH * 3 + 2 + i] = (byte) p;
738: }
739: if (XEiJ.TEST_BIT_2_SHIFT ? t << 29 < 0 : (t & 4) != 0) {
740: pfvBitmap[PFV_PANEL_WIDTH * 4 + i] = (byte) p;
741: }
742: if (XEiJ.TEST_BIT_1_SHIFT ? t << 30 < 0 : (t & 2) != 0) {
743: pfvBitmap[PFV_PANEL_WIDTH * 4 + 1 + i] = (byte) p;
744: }
745: if (XEiJ.TEST_BIT_0_SHIFT ? t << 31 != 0 : (t & 1) != 0) {
746: pfvBitmap[PFV_PANEL_WIDTH * 4 + 2 + i] = (byte) p;
747: }
748: }
749:
750: }
751:
752:
753: