ProgramFlowVisualizer.java
     1: //========================================================================================
     2: //  ProgramFlowVisualizer.java
     3: //    en:Program flow visualizer -- It visualizes the track of the program counter in real time.
     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: //  パネル
    15: //    address1    bar   funnel address2                                map
    16: //                                     0000    0400    0800    0c00    1000    1400    1800    1c00    2000
    17: //    00000000 +-------+   +-- 40000000 +---------------------------------------------------------------+ mapY0
    18: //             |       |   |            |                                                               |
    19: //    20000000 |       |   |   40010000 |                                                               |
    20: //             |       |   |            |                                                               |
    21: //    40000000 |       | --+   40020000 |                                                               |
    22: //             |       |   |            |                                                               |
    23: //    60000000 |       |   |   40030000 |                                                               |
    24: //             |       |   |            |                                                               |
    25: //    80000000 |       |   |   40040000 |                                                               |
    26: //             |       |   |            |                                                               |
    27: //    A0000000 |       |   |   40050000 |                                                               |
    28: //             |       |   |            |                                                               |
    29: //    C0000000 |       |   |   40060000 |                                                               |
    30: //             |       |   |            |                                                               |
    31: //    E0000000 |       |   |   40070000 |                                                               |
    32: //             +-------+   +--          +---------------------------------------------------------------+ mapY1
    33: //  バー
    34: //    パネルの左側にアドレス空間全体の最近プログラムカウンタが通った範囲を示すバーを表示する
    35: //  漏斗
    36: //    バーとマップの間にアドレス空間全体から見たマップの表示範囲を示す漏斗を表示する
    37: //  マップ
    38: //    パネルの右側に最近プログラムカウンタが通った範囲を示すマップを表示する
    39: //                            1セル  32バイト  16ワード     2x2ピクセル
    40: //                1ライン   256セル  8Kバイト  4Kワード   512x2ピクセル
    41: //    1マップ  512Kライン  128Mセル  4Gバイト  2Gワード  512x1Mピクセル
    42: //  色
    43: //    最近プログラムカウンタが通ったセルを明るい色で表示する
    44: //  更新
    45: //    0.1秒間隔で更新する
    46: //----------------------------------------------------------------------------------------
    47: 
    48: package xeij;
    49: 
    50: 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
    51: 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
    52: import java.awt.image.*;  //BufferedImage,DataBuffer,DataBufferByte,DataBufferInt,IndexColorModel
    53: import java.lang.*;  //Boolean,Character,Class,Comparable,Double,Exception,Float,IllegalArgumentException,Integer,Long,Math,Number,Object,Runnable,SecurityException,String,StringBuilder,System
    54: import java.util.*;  //ArrayList,Arrays,Calendar,GregorianCalendar,HashMap,Map,Map.Entry,Timer,TimerTask,TreeMap
    55: import javax.swing.*;  //AbstractButton,AbstractSpinnerModel,Box,ButtonGroup,DefaultListModel,ImageIcon,JApplet,JButton,JCheckBox,JCheckBoxMenuItem,JComponent,JDialog,JFileChooser,JFrame,JLabel,JList,JMenu,JMenuBar,JMenuItem,JPanel,JRadioButton,JScrollPane,JSpinner,JTextArea,JTextField,JTextPane,JViewport,ScrollPaneConstants,SpinnerListModel,SpinnerNumberModel,SwingConstants,SwingUtilities,UIManager,UIDefaults,UnsupportedLookAndFeelException
    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;  //1セルあたりのバイト数
    67:   public static final int PFV_CELLS_PER_LINE = 1 << PFV_LOG2_CELLS_PER_LINE;  //1ラインあたりのセル数
    68:   public static final int PFV_BYTES_PER_LINE = 1 << PFV_LOG2_BYTES_PER_LINE;  //1ラインあたりのバイト数
    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;  //アドレス1の幅
    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;  //アドレス2の幅
    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;  //アドレス1の左端
    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;  //アドレス2の左端
    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;  //パネルの高さ。PFV_PANEL_MIN_HEIGHT<=pfvPanelHeight<=PFV_PANEL_MAX_HEIGHT
   100:   public static int pfvMapHeight;  //マップの高さ。pfvPanelHeight-(PFV_MARGIN_TOP+PFV_MARGIN_BOTTOM)
   101:   public static int pfvMapY1;  //マップの下端。PFV_MAP_Y0-1+pfvMapHeight
   102:   public static int pfvLines;  //ラインの数。pfvMapHeight+1>>1
   103: 
   104:   //状態
   105:   public static int pfvLine0;  //開始ライン。max(0,min(PFV_TOTAL_LINES-pfvLines,(int)((long)PFV_TOTAL_LINES*(y-PFV_MAP_Y0)/pfvMapHeight)-(pfvLines>>1)))
   106:   public static int pfvLine1;  //終了ライン。pfvLine0+pfvLines-1
   107:   public static int pfvAddress0;  //開始アドレス。pfvLine0<<PFV_LOG2_BYTES_PER_LINE
   108:   public static int pfvAddress1;  //終了アドレス。(pfvLine1+1<<PFV_LOG2_BYTES_PER_LINE)-2
   109:   public static int pfvFunnelY0;  //漏斗の口の上端。PFV_MAP_Y0+(int)((long)pfvMapHeight*pfvLine0/PFV_TOTAL_LINES)
   110:   public static int pfvFunnelY1;  //漏斗の口の下端。PFV_MAP_Y0+(int)((long)pfvMapHeight*pfvLine1/PFV_TOTAL_LINES)
   111:   public static int pfvPressedX;  //マウスのボタンが押された座標
   112:   public static int pfvPressedY;
   113:   public static int pfvPressedLine0;  //マウスのボタンが押されたときのpfvLine0
   114:   public static int pfvSpan;  //表示範囲。0=256,1=512,2=1024,3=2048,4=4096,5=8192,6=16384,7=32768,8=65536
   115: 
   116:   //色
   117:   //    赤   黄   緑   水   青   紫   赤   黄
   118:   //   0/6  1/6  2/6  3/6  4/6  5/6  6/6  7/6
   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:   //pfvInit ()
   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:     //pfvPressedY = -1;
   155:     //pfvPressedLine0 = -1;
   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)),  //H
   163:                                 PFV_COLOR_S0 + i * (1F / 256F * (PFV_COLOR_S1 - PFV_COLOR_S0)),  //S
   164:                                 PFV_COLOR_B0 + i * (1F / 256F * (PFV_COLOR_B1 - PFV_COLOR_B0)));  //B
   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:   }  //pfvInit()
   178: 
   179:   //pfvStart ()
   180:   public static void pfvStart () {
   181:     if (RestorableFrame.rfmGetOpened (Settings.SGS_PFV_FRAME_KEY)) {
   182:       pfvOpen ();
   183:     }
   184:   }  //pfvStart()
   185: 
   186:   //pfvOpen ()
   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:   }  //pfvOpen()
   199: 
   200:   //pfvMakeFrame ()
   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:           //CENTER
   433:           pfvPanel,
   434:           //NORTH
   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 (),  //トレース10回ボタン
   494:             XEiJ.mpuMakeTrace100Button (),  //トレース100回ボタン
   495:             XEiJ.mpuMakeStepButton (),  //ステップ実行ボタン
   496:             XEiJ.mpuMakeStep10Button (),  //ステップ10回ボタン
   497:             XEiJ.mpuMakeStep100Button (),  //ステップ100回ボタン
   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:   }  //pfvMakeFrame()
   513: 
   514:   //pfvUpdate ()
   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:     //アドレス1
   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:     //アドレス2
   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);  //1周していない場合があるのでnewestからの距離を使う
   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:     }  //for record
   694:     pfvPanel.repaint ();
   695:     pfvTimer = PFV_INTERVAL;
   696:     BranchLog.blgLock = false;
   697:   }  //pfvUpdate()
   698: 
   699:   //pfvPutc (i, c, p)
   700:   //  1文字表示
   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) {  //t << 24 < 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:   }  //pfvPutc(int,int,int)
   749: 
   750: }  //class ProgramFlowVisualizer
   751: 
   752: 
   753: