DisassembleList.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 java.util.*;
19: import javax.swing.*;
20: import javax.swing.event.*;
21:
22: public class DisassembleList {
23:
24: public static final int DDP_ITEM_SIZE = 0x00000002;
25: public static final int DDP_PAGE_SIZE = 0x00000400;
26: public static final int DDP_ITEM_MASK = -DDP_ITEM_SIZE;
27: public static final int DDP_PAGE_MASK = -DDP_PAGE_SIZE;
28: public static final int DDP_MAX_ITEMS = DDP_PAGE_SIZE / DDP_ITEM_SIZE + 2;
29:
30: public static final char[] DDP_MOVEQD0_BASE = (
31:
32:
33: "moveq.l #$xx,d0").toCharArray ();
34: public static final char[] DDP_DCW_BASE = (
35:
36:
37: ".dc.w $xxxx").toCharArray ();
38:
39: public static int ddpItemCount;
40: public static int ddpItemIndex;
41: public static int ddpItemAddress;
42: public static int ddpPageAddress;
43: public static final int[] ddpAddressArray = new int[DDP_MAX_ITEMS];
44: public static final int[] ddpSplitArray = new int[DDP_MAX_ITEMS];
45: public static final int[] ddpCaretArray = new int[DDP_MAX_ITEMS];
46: public static final boolean[] ddpDCWArray = new boolean[DDP_MAX_ITEMS];
47:
48: public static JFrame ddpFrame;
49: public static ScrollTextArea ddpBoard;
50: public static JTextArea ddpTextArea;
51:
52: public static Hex8Spinner ddpSpinner;
53:
54: public static int ddpPopupAddress;
55:
56: public static boolean ddpBacktraceOn;
57: public static long ddpBacktraceRecord;
58: public static SpinnerNumberModel ddpBacktraceModel;
59: public static JSpinner ddpBacktraceSpinner;
60: public static JCheckBox ddpBacktraceCheckBox;
61:
62: public static String ddpStoppedBy;
63: public static int ddpStoppedAddress;
64:
65: public static int ddpSupervisorMode;
66: public static JCheckBox ddpSupervisorCheckBox;
67:
68: public static int ddpProgramMode;
69: public static RotaryButton ddpProgramButton;
70: public static JComboBox<String> ddpProgramBox;
71: public static int ddpProgramAge;
72:
73:
74:
75:
76: public static void ddpInit () {
77:
78: ddpItemCount = 0;
79: ddpItemIndex = 0;
80: ddpItemAddress = -1;
81: ddpPageAddress = 0;
82: ddpSupervisorMode = 1;
83:
84:
85:
86:
87:
88: ddpFrame = null;
89:
90: }
91:
92:
93: public static void ddpStart () {
94: if (RestorableFrame.rfmGetOpened (Settings.SGS_DDP_FRAME_KEY)) {
95: ddpOpen (-1, -1, true);
96: }
97: }
98:
99:
100:
101:
102: public static void ddpOpen (int address, int supervisor, boolean forceUpdate) {
103: if (ddpFrame == null) {
104: ddpMake ();
105: }
106: ddpFrame.setVisible (true);
107: ddpBacktraceRecord = -1L;
108: LabeledAddress.lblClear ();
109: ddpUpdate (address, supervisor, forceUpdate);
110: XEiJ.pnlExitFullScreen (false);
111: XEiJ.dbgVisibleMask |= XEiJ.DBG_DDP_VISIBLE_MASK;
112: }
113:
114:
115:
116: public static void ddpMake () {
117:
118:
119: ddpBoard = ComponentFactory.setPreferredSize (
120: ComponentFactory.setFont (new ScrollTextArea (), LnF.lnfMonospacedFont),
121: 730, 400);
122: ddpBoard.setMargin (new Insets (2, 4, 2, 4));
123: ddpBoard.setHighlightCursorOn (true);
124: ddpTextArea = ddpBoard.getTextArea ();
125: ddpTextArea.setEditable (false);
126: ddpTextArea.addMouseWheelListener ((mwe) -> {
127: int n = mwe.getWheelRotation ();
128: JViewport v = ddpBoard.getViewport ();
129: Point p = v.getViewPosition ();
130: v.setViewPosition (new Point (p.x,
131: Math.max (0,
132: Math.min (ddpTextArea.getSize ().height - v.getExtentSize ().height,
133: p.y + n * ddpTextArea.getFont ().getSize () * 5))));
134: });
135:
136:
137: ddpSpinner = ComponentFactory.createHex8Spinner (ddpPageAddress, DDP_ITEM_MASK, true, new ChangeListener () {
138:
139:
140:
141:
142: @Override public void stateChanged (ChangeEvent ce) {
143: if (XEiJ.dbgEventMask == 0) {
144: ddpUpdate (ddpSpinner.getAbsoluteValue (), ddpSupervisorMode, false);
145: }
146: }
147: });
148:
149:
150:
151:
152:
153:
154: ComponentFactory.addListener (
155: ddpTextArea,
156: new CaretListener () {
157: @Override public void caretUpdate (CaretEvent ce) {
158: if (XEiJ.dbgEventMask == 0) {
159: int p = ce.getDot ();
160: if (p == ce.getMark ()) {
161: int i = Arrays.binarySearch (ddpSplitArray, 1, ddpItemCount, p + 1);
162: i = (i >> 31 ^ i) - 1;
163: ddpSpinner.setHintIndex (i);
164:
165: }
166: }
167: }
168: });
169:
170:
171: ComponentFactory.addListener (
172: ddpTextArea,
173: new MouseAdapter () {
174: @Override public void mousePressed (MouseEvent me) {
175: if (XEiJ.mpuTask == null && me.isPopupTrigger ()) {
176: XEiJ.dbgShowPopup (me, ddpTextArea, true);
177: }
178: }
179: @Override public void mouseReleased (MouseEvent me) {
180: if (XEiJ.mpuTask == null && me.isPopupTrigger ()) {
181: XEiJ.dbgShowPopup (me, ddpTextArea, true);
182: }
183: }
184: });
185:
186:
187: ActionListener listener = new ActionListener () {
188: @Override public void actionPerformed (ActionEvent ae) {
189: Object source = ae.getSource ();
190: switch (ae.getActionCommand ()) {
191: case "Backtrace":
192: if (BranchLog.BLG_ON) {
193: ddpBacktraceOn = ((JCheckBox) ae.getSource ()).isSelected ();
194: if (XEiJ.dbgEventMask == 0) {
195: ddpUpdate (ddpAddressArray[ddpItemIndex], ddpSupervisorMode, true);
196: }
197: }
198: break;
199: case "User/Supervisor":
200: if (XEiJ.dbgEventMask == 0) {
201: ddpUpdate (ddpAddressArray[ddpItemIndex], ((JCheckBox) ae.getSource ()).isSelected () ? 1 : 0, true);
202: }
203: break;
204: case "Address and/or offset":
205: ddpProgramMode = ddpProgramButton.getIndex ();
206: if (XEiJ.dbgEventMask == 0) {
207: ddpUpdate (0, ddpSupervisorMode, true);
208: }
209: break;
210: case "Program name":
211: {
212: int index = ddpProgramBox.getSelectedIndex ();
213: if (0 <= index) {
214: if (index == 0) {
215: ddpSpinner.setOffset (0);
216: } else {
217: if (ddpProgramAge == LabeledAddress.lblProgramAge) {
218: ddpSpinner.setOffset (LabeledAddress.lblProgramHead[index - 1]);
219: }
220: }
221: }
222: }
223: break;
224: }
225: }
226: };
227:
228:
229: ddpProgramMode = 0;
230: ddpProgramButton = Multilingual.mlnToolTipText (
231: ComponentFactory.createRotaryButton (
232: "Address and/or offset",
233: listener,
234: ddpProgramMode,
235: XEiJ.createImage (
236: 20, 14,
237: "22222222222222222222" +
238: "2..................2" +
239: "2........22........2" +
240: "2......222222......2" +
241: "2.....22222222.....2" +
242: "2.....22.22........2" +
243: "2.....2222222......2" +
244: "2......2222222.....2" +
245: "2........22.22.....2" +
246: "2.....22222222.....2" +
247: "2......222222......2" +
248: "2........22........2" +
249: "2..................2" +
250: "22222222222222222222",
251: LnF.lnfRGB[0],
252: LnF.lnfRGB[6],
253: LnF.lnfRGB[12]),
254: XEiJ.createImage (
255: 20, 14,
256: "22222222222222222222" +
257: "2..................2" +
258: "2......22..........2" +
259: "2......22..........2" +
260: "2......22..........2" +
261: "2......22..........2" +
262: "2......22..........2" +
263: "2......22..........2" +
264: "2......22..........2" +
265: "2......22..........2" +
266: "2......2222222.....2" +
267: "2......2222222.....2" +
268: "2..................2" +
269: "22222222222222222222",
270: LnF.lnfRGB[0],
271: LnF.lnfRGB[6],
272: LnF.lnfRGB[12]),
273: XEiJ.createImage (
274: 20, 14,
275: "22222222222222222222" +
276: "2..................2" +
277: "2....22....22......2" +
278: "2..222222..22......2" +
279: "2.22222222.22......2" +
280: "2.22.22....22......2" +
281: "2.2222222..22......2" +
282: "2..2222222.22......2" +
283: "2....22.22.22......2" +
284: "2.22222222.22......2" +
285: "2..222222..2222222.2" +
286: "2....22....2222222.2" +
287: "2..................2" +
288: "22222222222222222222",
289: LnF.lnfRGB[0],
290: LnF.lnfRGB[6],
291: LnF.lnfRGB[12])
292: ),
293: "ja", "アドレスとオフセット");
294:
295:
296: ddpProgramBox = Multilingual.mlnToolTipText (
297: ComponentFactory.createComboBox (0, "Program name", listener, 16, ""),
298: "ja", "プログラム名");
299: ddpProgramBox.setMaximumRowCount (16);
300: ddpProgramAge = -1;
301:
302:
303: if (BranchLog.BLG_ON) {
304: ddpBacktraceOn = false;
305: ddpBacktraceRecord = -1L;
306:
307:
308: ddpBacktraceModel = new ReverseLongModel (0L, 0L, 0L, 1L);
309: ddpBacktraceSpinner = ComponentFactory.createNumberSpinner (ddpBacktraceModel, 10, new ChangeListener () {
310: @Override public void stateChanged (ChangeEvent ce) {
311: if (XEiJ.dbgEventMask == 0 && XEiJ.mpuTask == null) {
312: long record = ddpBacktraceModel.getNumber ().longValue ();
313: int i = (char) record << BranchLog.BLG_RECORD_SHIFT;
314: if (
315: ddpBacktraceRecord < record) {
316: ddpBacktraceRecord = record;
317: ddpUpdate (BranchLog.blgArray[i] & ~1, BranchLog.blgArray[i] & 1, false);
318: } else if (record < ddpBacktraceRecord) {
319: ddpBacktraceRecord = record;
320: ddpUpdate (BranchLog.blgArray[i + 1] & ~1, BranchLog.blgArray[i] & 1, false);
321: }
322: }
323: }
324: });
325:
326:
327: ddpBacktraceCheckBox =
328: Multilingual.mlnToolTipText (
329: ComponentFactory.createIconCheckBox (
330: ddpBacktraceOn,
331: XEiJ.createImage (
332: 20, 14,
333: "22222222222222222222" +
334: "2..................2" +
335: "2.......1..........2" +
336: "2......1.1.........2" +
337: "2.....1...1........2" +
338: "2....111.111.......2" +
339: "2......1.1.........2" +
340: "2......1.111111....2" +
341: "2......1......1....2" +
342: "2......111111.1....2" +
343: "2...........1.1....2" +
344: "2...........111....2" +
345: "2..................2" +
346: "22222222222222222222",
347: LnF.lnfRGB[0],
348: LnF.lnfRGB[6],
349: LnF.lnfRGB[12]),
350: XEiJ.createImage (
351: 20, 14,
352: "22222222222222222222" +
353: "2..................2" +
354: "2.......1..........2" +
355: "2......1.1.........2" +
356: "2.....1...1........2" +
357: "2....111.111.......2" +
358: "2......1.1.........2" +
359: "2......1.111111....2" +
360: "2......1......1....2" +
361: "2......111111.1....2" +
362: "2...........1.1....2" +
363: "2...........111....2" +
364: "2..................2" +
365: "22222222222222222222",
366: LnF.lnfRGB[0],
367: LnF.lnfRGB[12],
368: LnF.lnfRGB[12]),
369: "Backtrace", listener),
370: "ja", "バックトレース");
371: }
372:
373:
374: ddpSupervisorCheckBox =
375: Multilingual.mlnToolTipText (
376: ComponentFactory.createIconCheckBox (
377: ddpSupervisorMode != 0,
378: XEiJ.createImage (
379: 20, 14,
380: "22222222222222222222" +
381: "2..................2" +
382: "2..................2" +
383: "2.....11....11.....2" +
384: "2.....11....11.....2" +
385: "2.....11....11.....2" +
386: "2.....11....11.....2" +
387: "2.....11....11.....2" +
388: "2.....11....11.....2" +
389: "2.....11111111.....2" +
390: "2.....11111111.....2" +
391: "2..................2" +
392: "2..................2" +
393: "22222222222222222222",
394: LnF.lnfRGB[0],
395: LnF.lnfRGB[12],
396: LnF.lnfRGB[12]),
397: XEiJ.createImage (
398: 20, 14,
399: "22222222222222222222" +
400: "2..................2" +
401: "2..................2" +
402: "2.....11111111.....2" +
403: "2.....11111111.....2" +
404: "2.....11...........2" +
405: "2.....11111111.....2" +
406: "2.....11111111.....2" +
407: "2...........11.....2" +
408: "2.....11111111.....2" +
409: "2.....11111111.....2" +
410: "2..................2" +
411: "2..................2" +
412: "22222222222222222222",
413: LnF.lnfRGB[0],
414: LnF.lnfRGB[12],
415: LnF.lnfRGB[12]),
416: "User/Supervisor", listener),
417: "ja", "ユーザ/スーパーバイザ");
418:
419:
420: ddpFrame = Multilingual.mlnTitle (
421: ComponentFactory.createRestorableSubFrame (
422: Settings.SGS_DDP_FRAME_KEY,
423: "Disassemble list",
424: null,
425: ComponentFactory.createBorderPanel (
426: ddpBoard,
427: ComponentFactory.createHorizontalBox (
428: ddpProgramButton,
429: ddpProgramBox,
430: ddpSpinner,
431: ddpSupervisorCheckBox,
432: Box.createHorizontalStrut (12),
433: (BranchLog.BLG_ON ?
434: ComponentFactory.createHorizontalBox (
435: ddpBacktraceCheckBox,
436: ddpBacktraceSpinner,
437: Box.createHorizontalStrut (12)) :
438: null),
439: Box.createHorizontalGlue (),
440: XEiJ.mpuMakeOriIllegalCheckBox (),
441: XEiJ.mpuMakeStopOnErrorCheckBox (),
442: XEiJ.mpuMakeStopAtStartCheckBox (),
443: Box.createHorizontalStrut (12),
444: XEiJ.mpuMakeBreakButton (),
445: XEiJ.mpuMakeTraceButton (),
446: XEiJ.mpuMakeTrace10Button (),
447: XEiJ.mpuMakeTrace100Button (),
448: XEiJ.mpuMakeStepButton (),
449: XEiJ.mpuMakeStep10Button (),
450: XEiJ.mpuMakeStep100Button (),
451: XEiJ.mpuMakeReturnButton (),
452: XEiJ.mpuMakeRunButton ()
453: )
454: )
455: ),
456: "ja", "逆アセンブルリスト");
457: ComponentFactory.addListener (
458: ddpFrame,
459: new WindowAdapter () {
460: @Override public void windowClosing (WindowEvent we) {
461: XEiJ.dbgVisibleMask &= ~XEiJ.DBG_DDP_VISIBLE_MASK;
462: }
463: });
464:
465: ddpStoppedBy = null;
466: ddpStoppedAddress = -1;
467:
468: }
469:
470:
471:
472:
473: public static void ddpUpdate (int address, int supervisor, boolean forceUpdate) {
474:
475: XEiJ.dbgEventMask++;
476:
477: if (address == -1) {
478: ddpStoppedAddress = address = ddpStoppedBy == null ? XEiJ.regPC : XEiJ.regPC0;
479: forceUpdate = true;
480: } else if (address == 0) {
481: address = ddpItemAddress;
482: }
483:
484: if (supervisor == -1) {
485: supervisor = XEiJ.regSRS;
486: forceUpdate = true;
487: }
488:
489: if ((ddpSupervisorMode != 0) != (supervisor != 0)) {
490: ddpSupervisorMode = supervisor;
491: forceUpdate = true;
492: if (ddpSupervisorCheckBox.isSelected () != (supervisor != 0)) {
493: ddpSupervisorCheckBox.setSelected (supervisor != 0);
494: }
495: }
496:
497: if (forceUpdate) {
498: ddpItemCount = 0;
499: }
500:
501: address &= DDP_ITEM_MASK;
502:
503:
504: if (BranchLog.BLG_ON) {
505: if (XEiJ.mpuTask == null) {
506: long newestRecord = BranchLog.blgNewestRecord;
507: long oldestRecord = Math.max (0L, newestRecord - 65535);
508: if (
509: ddpBacktraceRecord < oldestRecord || newestRecord < ddpBacktraceRecord) {
510: ddpBacktraceRecord = newestRecord;
511: ddpBacktraceModel.setMaximum (Long.valueOf (newestRecord));
512: ddpBacktraceModel.setValue (Long.valueOf (newestRecord));
513: }
514: if (ddpBacktraceOn) {
515: int i = (char) ddpBacktraceRecord << BranchLog.BLG_RECORD_SHIFT;
516: if (address >>> 1 < BranchLog.blgArray[i] >>> 1) {
517: if (oldestRecord < ddpBacktraceRecord) {
518: ddpBacktraceRecord--;
519: ddpBacktraceModel.setValue (Long.valueOf (ddpBacktraceRecord));
520: address = BranchLog.blgArray[((char) ddpBacktraceRecord << BranchLog.BLG_RECORD_SHIFT) + 1] & ~1;
521: }
522: } else if (BranchLog.blgArray[i + 1] >>> 1 < address >>> 1) {
523: if (ddpBacktraceRecord < newestRecord) {
524: ddpBacktraceRecord++;
525: ddpBacktraceModel.setValue (Long.valueOf (ddpBacktraceRecord));
526: address = BranchLog.blgArray[(char) ddpBacktraceRecord << BranchLog.BLG_RECORD_SHIFT] & ~1;
527: }
528: }
529: }
530: }
531: }
532:
533: if (ddpItemCount != 0) {
534: int i = Arrays.binarySearch (ddpAddressArray, 1, ddpItemCount, address + 1);
535: i = (i >> 31 ^ i) - 1;
536: if (0 < i && i < ddpItemCount - 1 &&
537: ddpAddressArray[i] == address &&
538: !ddpDCWArray[i]) {
539:
540:
541:
542: ddpItemAddress = address;
543: if (ddpItemIndex != i) {
544: ddpItemIndex = i;
545: ddpTextArea.setCaretPosition (ddpCaretArray[i]);
546: }
547:
548:
549:
550:
551: XEiJ.dbgEventMask--;
552: return;
553: }
554: }
555:
556:
557: ddpItemAddress = address;
558:
559:
560:
561: ddpPageAddress = address & DDP_PAGE_MASK;
562: int pageEndAddress = ddpPageAddress + DDP_PAGE_SIZE;
563:
564:
565: int dataBytes = 10;
566: int addressWidth;
567: int codeWidth;
568: if (ddpProgramMode == 0) {
569:
570:
571:
572:
573:
574: addressWidth = 8;
575: codeWidth = 36;
576: } else if (ddpProgramMode == 1) {
577:
578:
579:
580:
581:
582: addressWidth = 7;
583: codeWidth = 37;
584: } else {
585:
586:
587:
588:
589:
590: addressWidth = 16;
591: codeWidth = 48;
592: }
593: String header = (new StringBuilder ().
594: append (XEiJ.DBG_SPACES, 0, addressWidth + 2).
595: append ("+0+1+2+3+4+5+6+7+8+9").
596: append (XEiJ.DBG_SPACES, 0, 2 + codeWidth + dataBytes - 2).
597: append ("▲\n")).toString ();
598: String footer = (new StringBuilder ().
599: append (XEiJ.DBG_SPACES, 0, addressWidth + 2).
600: append ("+0+1+2+3+4+5+6+7+8+9").
601: append (XEiJ.DBG_SPACES, 0, 2 + codeWidth + dataBytes - 2).
602: append ("▼")).toString ();
603:
604:
605: ddpAddressArray[0] = ddpPageAddress - DDP_ITEM_SIZE;
606: ddpSplitArray[0] = 0;
607: ddpCaretArray[0] = 0;
608: StringBuilder sb = new StringBuilder (header);
609: int itemCount = 1;
610: int itemAddress = ddpPageAddress;
611: int dcwAddress = pageEndAddress;
612: int dcwEndAddress = pageEndAddress;
613: boolean prevBranchFlag = false;
614:
615:
616: if (LabeledAddress.lblProgramCount == 0) {
617: LabeledAddress.lblUpdateProgram ();
618: }
619: if (ddpProgramAge != LabeledAddress.lblProgramAge) {
620: ddpProgramAge = LabeledAddress.lblProgramAge;
621: ddpProgramBox.removeAllItems ();
622: ddpProgramBox.addItem ("raw address");
623: for (int i = 0; i < LabeledAddress.lblProgramCount; i++) {
624: ddpProgramBox.addItem (XEiJ.fmtHex8 (new StringBuilder (), LabeledAddress.lblProgramHead[i]).append (' ').append (LabeledAddress.lblProgramName[i]).toString ());
625: }
626: }
627:
628: TreeMap<Integer,InstructionBreakPoint.InstructionBreakRecord> pointTable;
629: if (InstructionBreakPoint.IBP_ON) {
630: pointTable = InstructionBreakPoint.ibpPointTable;
631: }
632:
633: itemLoop:
634: do {
635: int itemEndAddress;
636: String code;
637:
638:
639:
640:
641:
642:
643:
644: if (dcwAddress <= itemAddress && itemAddress < dcwEndAddress) {
645: Disassembler.disStatus = 0;
646: int oc = MC68060.mmuPeekWordZeroCode (itemAddress, supervisor);
647: if ((oc & 0xfe00) == 0x7000 && MC68060.mmuPeekWordZeroCode (itemAddress + 2, supervisor) == 0x4e4f) {
648:
649: XEiJ.fmtHex2 (DDP_MOVEQD0_BASE, 10, oc);
650: code = String.valueOf (DDP_MOVEQD0_BASE);
651: } else {
652: XEiJ.fmtHex4 (DDP_DCW_BASE, 9, oc);
653: code = String.valueOf (DDP_DCW_BASE);
654: }
655: itemEndAddress = itemAddress + 2;
656: ddpDCWArray[itemCount] = true;
657: } else {
658: LabeledAddress.lblGetIndex (itemAddress);
659: code = Disassembler.disDisassemble (new StringBuilder (), itemAddress, supervisor,
660: LabeledAddress.lblLastGetHead, LabeledAddress.lblLastGetTail, ddpProgramMode).toString ();
661: for (int t = itemAddress + 2; t < Disassembler.disPC; t += 2) {
662: if (t == address ||
663: InstructionBreakPoint.IBP_ON && pointTable.containsKey (t)) {
664:
665:
666:
667: dcwAddress = itemAddress;
668: dcwEndAddress = t;
669: continue itemLoop;
670: }
671: }
672: itemEndAddress = Disassembler.disPC;
673: ddpDCWArray[itemCount] = false;
674: }
675:
676:
677: if (prevBranchFlag) {
678: sb.append ('\n');
679: }
680:
681:
682: if (itemAddress == address) {
683: ddpItemIndex = itemCount;
684: }
685: ddpAddressArray[itemCount] = itemAddress;
686: ddpSplitArray[itemCount] = sb.length ();
687:
688: if (prevBranchFlag) {
689:
690: if (true) {
691: int i = sb.length ();
692: LabeledAddress.lblSearch (sb, itemAddress);
693: if (i < sb.length ()) {
694: sb.append ('\n');
695: }
696: }
697: }
698:
699:
700: if (itemAddress == ddpStoppedAddress && ddpStoppedBy != null) {
701: sb.append (ddpStoppedBy).append ('\n');
702: }
703:
704: ddpCaretArray[itemCount] = sb.length ();
705:
706:
707: int lineAddress = itemAddress;
708: int lineEndAddress = Math.min (lineAddress + dataBytes, itemEndAddress);
709: {
710:
711:
712:
713: if (ddpProgramMode == 0 ||
714: ddpProgramMode == 2) {
715: XEiJ.fmtHex8 (sb, lineAddress);
716: }
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728: if (ddpProgramMode == 1 ||
729: ddpProgramMode == 2) {
730: int index = LabeledAddress.lblGetIndex (lineAddress);
731: if (index != -1 &&
732: LabeledAddress.lblLastGetHead != 0) {
733: if (ddpProgramMode == 2) {
734: sb.append (':');
735: }
736: XEiJ.fmtHex6 (sb.append ('L'), lineAddress - LabeledAddress.lblLastGetHead);
737: } else {
738: if (ddpProgramMode == 1) {
739: XEiJ.fmtHex8 (sb, lineAddress);
740: } else {
741:
742: sb.append (" ");
743: }
744: }
745: }
746: sb.append (" ");
747: }
748:
749: for (int a = lineAddress; a < lineEndAddress; a += 2) {
750: XEiJ.fmtHex4 (sb, MC68060.mmuPeekWordZeroCode (a, supervisor));
751: }
752: sb.append (XEiJ.DBG_SPACES, 0, 2 * Math.max (0, lineAddress + dataBytes - lineEndAddress) + 2);
753:
754: sb.append (code).append (XEiJ.DBG_SPACES, 0, Math.max (1, codeWidth - code.length ()));
755:
756: InstructionBreakPoint.InstructionBreakRecord r = InstructionBreakPoint.IBP_ON ? pointTable.get (itemAddress) : null;
757: if (r != null) {
758: if (r.ibrWaitInstruction != null) {
759: sb.append ("----");
760: }
761: if (r.ibrThreshold < 0) {
762: sb.append ("******");
763: } else if (r.ibrThreshold != 0x7fffffff) {
764: sb.append (r.ibrValue).append ('/').append (r.ibrThreshold);
765: }
766: } else {
767: for (int a = lineAddress; a < lineEndAddress; a++) {
768: int h = MC68060.mmuPeekByteZeroCode (a, supervisor);
769: int c;
770: if (0x81 <= h && h <= 0x9f || 0xe0 <= h && h <= 0xef) {
771: int l = MC68060.mmuPeekByteZeroCode (a + 1, supervisor);
772: if (0x40 <= l && l != 0x7f && l <= 0xfc) {
773: c = CharacterCode.chrSJISToChar[h << 8 | l];
774: if (c == 0) {
775: c = '※';
776: }
777: a++;
778: } else {
779: c = '.';
780: }
781: } else {
782: c = CharacterCode.chrSJISToChar[h];
783: if (c < 0x20 || c == 0x7f) {
784: c = '.';
785: }
786: }
787: sb.append ((char) c);
788: }
789: }
790: sb.append ('\n');
791:
792:
793: while (lineEndAddress < itemEndAddress) {
794: lineAddress = lineEndAddress;
795: lineEndAddress = Math.min (lineAddress + dataBytes, itemEndAddress);
796:
797:
798:
799: if (ddpProgramMode == 0 ||
800: ddpProgramMode == 2) {
801: XEiJ.fmtHex8 (sb, lineAddress);
802: }
803:
804:
805:
806:
807:
808:
809:
810:
811:
812:
813:
814: if (ddpProgramMode == 1 ||
815: ddpProgramMode == 2) {
816: int index = LabeledAddress.lblGetIndex (lineAddress);
817: if (index != -1 &&
818: LabeledAddress.lblLastGetHead != 0) {
819: if (ddpProgramMode == 2) {
820: sb.append (':');
821: }
822: XEiJ.fmtHex6 (sb.append ('L'), lineAddress - LabeledAddress.lblLastGetHead);
823: } else {
824: if (ddpProgramMode == 1) {
825: XEiJ.fmtHex8 (sb, lineAddress);
826: } else {
827:
828: sb.append (" ");
829: }
830: }
831: }
832: sb.append (" ");
833:
834: for (int a = lineAddress; a < lineEndAddress; a += 2) {
835: XEiJ.fmtHex4 (sb, MC68060.mmuPeekWordZeroCode (a, supervisor));
836: }
837: sb.append (XEiJ.DBG_SPACES, 0, 2 * Math.max (0, lineAddress + dataBytes - lineEndAddress) + 2 + codeWidth);
838:
839: for (int a = lineAddress; a < lineEndAddress; a++) {
840: int h = MC68060.mmuPeekByteZeroCode (a, supervisor);
841: int c;
842: if (0x81 <= h && h <= 0x9f || 0xe0 <= h && h <= 0xef) {
843: int l = MC68060.mmuPeekByteZeroCode (a + 1, supervisor);
844: if (0x40 <= l && l != 0x7f && l <= 0xfc) {
845: c = CharacterCode.chrSJISToChar[h << 8 | l];
846: if (c == 0) {
847: c = '※';
848: }
849: a++;
850: } else {
851: c = '.';
852: }
853: } else {
854: c = CharacterCode.chrSJISToChar[h];
855: if (c < 0x20 || c == 0x7f) {
856: c = '.';
857: }
858: }
859: sb.append ((char) c);
860: }
861: sb.append ('\n');
862: }
863:
864:
865: itemCount++;
866: itemAddress = itemEndAddress;
867:
868:
869: prevBranchFlag = (Disassembler.disStatus & Disassembler.DIS_ALWAYS_BRANCH) != 0;
870:
871: } while (itemAddress < pageEndAddress);
872:
873:
874: ddpAddressArray[itemCount] = itemAddress;
875: ddpSplitArray[itemCount] = sb.length ();
876: ddpCaretArray[itemCount] = sb.length ();
877: sb.append (footer);
878: itemCount++;
879: ddpItemCount = itemCount;
880:
881:
882: ddpTextArea.setText (sb.toString ());
883: ddpTextArea.setCaretPosition (ddpCaretArray[ddpItemIndex]);
884:
885:
886:
887:
888:
889: ddpSpinner.setHintArray (ddpAddressArray, itemCount);
890: ddpSpinner.setHintIndex (ddpItemIndex);
891:
892: XEiJ.dbgEventMask--;
893:
894: }
895:
896: }
897:
898:
899: