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: LnF.LNF_ADDRESS_IMAGE,
236: LnF.LNF_OFFSET_IMAGE,
237: LnF.LNF_BOTH_IMAGE
238: ),
239: "ja", "アドレスとオフセット");
240:
241:
242: ddpProgramBox = Multilingual.mlnToolTipText (
243: ComponentFactory.createComboBox (0, "Program name", listener, 16, ""),
244: "ja", "プログラム名");
245: ddpProgramBox.setMaximumRowCount (16);
246: ddpProgramAge = -1;
247:
248:
249: if (BranchLog.BLG_ON) {
250: ddpBacktraceOn = false;
251: ddpBacktraceRecord = -1L;
252:
253:
254: ddpBacktraceModel = new ReverseLongModel (0L, 0L, 0L, 1L);
255: ddpBacktraceSpinner = ComponentFactory.createNumberSpinner (ddpBacktraceModel, 10, new ChangeListener () {
256: @Override public void stateChanged (ChangeEvent ce) {
257: if (XEiJ.dbgEventMask == 0 && XEiJ.mpuTask == null) {
258: long record = ddpBacktraceModel.getNumber ().longValue ();
259: int i = (char) record << BranchLog.BLG_RECORD_SHIFT;
260: if (
261: ddpBacktraceRecord < record) {
262: ddpBacktraceRecord = record;
263: ddpUpdate (BranchLog.blgArray[i] & ~1, BranchLog.blgArray[i] & 1, false);
264: } else if (record < ddpBacktraceRecord) {
265: ddpBacktraceRecord = record;
266: ddpUpdate (BranchLog.blgArray[i + 1] & ~1, BranchLog.blgArray[i] & 1, false);
267: }
268: }
269: }
270: });
271:
272:
273: ddpBacktraceCheckBox =
274: Multilingual.mlnToolTipText (
275: ComponentFactory.createIconCheckBox (
276: ddpBacktraceOn,
277: LnF.LNF_BACK_TRACE_IMAGE,
278: LnF.LNF_BACK_TRACE_SELECTED_IMAGE,
279: "Backtrace", listener),
280: "ja", "バックトレース");
281: }
282:
283:
284: ddpSupervisorCheckBox =
285: Multilingual.mlnToolTipText (
286: ComponentFactory.createIconCheckBox (
287: ddpSupervisorMode != 0,
288: LnF.LNF_USER_SELECTED_IMAGE,
289: LnF.LNF_SUPERVISOR_SELECTED_IMAGE,
290: "User/Supervisor", listener),
291: "ja", "ユーザ/スーパーバイザ");
292:
293:
294: ddpFrame = Multilingual.mlnTitle (
295: ComponentFactory.createRestorableSubFrame (
296: Settings.SGS_DDP_FRAME_KEY,
297: "Disassemble list",
298: null,
299: ComponentFactory.createBorderPanel (
300:
301: ddpBoard,
302:
303: ComponentFactory.createVerticalBox (
304:
305: ComponentFactory.createHorizontalBox (
306: Box.createHorizontalGlue (),
307: XEiJ.mpuMakeOriIllegalCheckBox (),
308: XEiJ.mpuMakeStopOnErrorCheckBox (),
309: XEiJ.mpuMakeStopAtStartCheckBox (),
310: Box.createHorizontalStrut (12),
311: XEiJ.mpuMakeBreakButton (),
312: XEiJ.mpuMakeTraceButton (),
313: XEiJ.mpuMakeTrace10Button (),
314: XEiJ.mpuMakeTrace100Button (),
315: XEiJ.mpuMakeStepButton (),
316: XEiJ.mpuMakeStep10Button (),
317: XEiJ.mpuMakeStep100Button (),
318: XEiJ.mpuMakeReturnButton (),
319: XEiJ.mpuMakeRunButton ()
320: ),
321:
322: ComponentFactory.createHorizontalBox (
323: ddpProgramButton,
324: ddpProgramBox,
325: ddpSpinner,
326: ddpSupervisorCheckBox,
327: Box.createHorizontalStrut (12),
328: (BranchLog.BLG_ON ?
329: ComponentFactory.createHorizontalBox (
330: ddpBacktraceCheckBox,
331: ddpBacktraceSpinner,
332: Box.createHorizontalStrut (12)) :
333: null),
334: Box.createHorizontalGlue ()
335: )
336: )
337: )
338: ),
339: "ja", "逆アセンブルリスト");
340: ComponentFactory.addListener (
341: ddpFrame,
342: new WindowAdapter () {
343: @Override public void windowClosing (WindowEvent we) {
344: XEiJ.dbgVisibleMask &= ~XEiJ.DBG_DDP_VISIBLE_MASK;
345: }
346: });
347:
348: ddpStoppedBy = null;
349: ddpStoppedAddress = -1;
350:
351: }
352:
353:
354:
355:
356: public static void ddpUpdate (int address, int supervisor, boolean forceUpdate) {
357:
358: XEiJ.dbgEventMask++;
359:
360: if (address == -1) {
361: ddpStoppedAddress = address = ddpStoppedBy == null ? XEiJ.regPC : XEiJ.regPC0;
362: forceUpdate = true;
363: } else if (address == 0) {
364: address = ddpItemAddress;
365: }
366:
367: if (supervisor == -1) {
368: supervisor = XEiJ.regSRS;
369: forceUpdate = true;
370: }
371:
372: if ((ddpSupervisorMode != 0) != (supervisor != 0)) {
373: ddpSupervisorMode = supervisor;
374: forceUpdate = true;
375: if (ddpSupervisorCheckBox.isSelected () != (supervisor != 0)) {
376: ddpSupervisorCheckBox.setSelected (supervisor != 0);
377: }
378: }
379:
380: if (forceUpdate) {
381: ddpItemCount = 0;
382: }
383:
384: address &= DDP_ITEM_MASK;
385:
386:
387: if (BranchLog.BLG_ON) {
388: if (XEiJ.mpuTask == null) {
389: long newestRecord = BranchLog.blgNewestRecord;
390: long oldestRecord = Math.max (0L, newestRecord - 65535);
391: if (
392: ddpBacktraceRecord < oldestRecord || newestRecord < ddpBacktraceRecord) {
393: ddpBacktraceRecord = newestRecord;
394: ddpBacktraceModel.setMaximum (Long.valueOf (newestRecord));
395: ddpBacktraceModel.setValue (Long.valueOf (newestRecord));
396: }
397: if (ddpBacktraceOn) {
398: int i = (char) ddpBacktraceRecord << BranchLog.BLG_RECORD_SHIFT;
399: if (address >>> 1 < BranchLog.blgArray[i] >>> 1) {
400: if (oldestRecord < ddpBacktraceRecord) {
401: ddpBacktraceRecord--;
402: ddpBacktraceModel.setValue (Long.valueOf (ddpBacktraceRecord));
403: address = BranchLog.blgArray[((char) ddpBacktraceRecord << BranchLog.BLG_RECORD_SHIFT) + 1] & ~1;
404: }
405: } else if (BranchLog.blgArray[i + 1] >>> 1 < address >>> 1) {
406: if (ddpBacktraceRecord < newestRecord) {
407: ddpBacktraceRecord++;
408: ddpBacktraceModel.setValue (Long.valueOf (ddpBacktraceRecord));
409: address = BranchLog.blgArray[(char) ddpBacktraceRecord << BranchLog.BLG_RECORD_SHIFT] & ~1;
410: }
411: }
412: }
413: }
414: }
415:
416: if (ddpItemCount != 0) {
417: int i = Arrays.binarySearch (ddpAddressArray, 1, ddpItemCount, address + 1);
418: i = (i >> 31 ^ i) - 1;
419: if (0 < i && i < ddpItemCount - 1 &&
420: ddpAddressArray[i] == address &&
421: !ddpDCWArray[i]) {
422:
423:
424:
425: ddpItemAddress = address;
426: if (ddpItemIndex != i) {
427: ddpItemIndex = i;
428: ddpTextArea.setCaretPosition (ddpCaretArray[i]);
429: }
430:
431:
432:
433:
434: XEiJ.dbgEventMask--;
435: return;
436: }
437: }
438:
439:
440: ddpItemAddress = address;
441:
442:
443:
444: ddpPageAddress = address & DDP_PAGE_MASK;
445: int pageEndAddress = ddpPageAddress + DDP_PAGE_SIZE;
446:
447:
448: int dataBytes = 10;
449: int addressWidth;
450: int codeWidth;
451: if (ddpProgramMode == 0) {
452:
453:
454:
455:
456:
457: addressWidth = 8;
458: codeWidth = 36;
459: } else if (ddpProgramMode == 1) {
460:
461:
462:
463:
464:
465: addressWidth = 7;
466: codeWidth = 37;
467: } else {
468:
469:
470:
471:
472:
473: addressWidth = 16;
474: codeWidth = 48;
475: }
476: String header = (new StringBuilder ().
477: append (XEiJ.DBG_SPACES, 0, addressWidth + 2).
478: append ("+0+1+2+3+4+5+6+7+8+9").
479: append (XEiJ.DBG_SPACES, 0, 2 + codeWidth + dataBytes - 2).
480: append ("▲\n")).toString ();
481: String footer = (new StringBuilder ().
482: append (XEiJ.DBG_SPACES, 0, addressWidth + 2).
483: append ("+0+1+2+3+4+5+6+7+8+9").
484: append (XEiJ.DBG_SPACES, 0, 2 + codeWidth + dataBytes - 2).
485: append ("▼")).toString ();
486:
487:
488: ddpAddressArray[0] = ddpPageAddress - DDP_ITEM_SIZE;
489: ddpSplitArray[0] = 0;
490: ddpCaretArray[0] = 0;
491: StringBuilder sb = new StringBuilder (header);
492: int itemCount = 1;
493: int itemAddress = ddpPageAddress;
494: int dcwAddress = pageEndAddress;
495: int dcwEndAddress = pageEndAddress;
496: boolean prevBranchFlag = false;
497:
498:
499: if (LabeledAddress.lblProgramCount == 0) {
500: LabeledAddress.lblUpdateProgram ();
501: }
502: if (ddpProgramAge != LabeledAddress.lblProgramAge) {
503: ddpProgramAge = LabeledAddress.lblProgramAge;
504: ddpProgramBox.removeAllItems ();
505: ddpProgramBox.addItem ("raw address");
506: for (int i = 0; i < LabeledAddress.lblProgramCount; i++) {
507: ddpProgramBox.addItem (XEiJ.fmtHex8 (new StringBuilder (), LabeledAddress.lblProgramHead[i]).append (' ').append (LabeledAddress.lblProgramName[i]).toString ());
508: }
509: }
510:
511: TreeMap<Integer,InstructionBreakPoint.InstructionBreakRecord> pointTable;
512: if (InstructionBreakPoint.IBP_ON) {
513: pointTable = InstructionBreakPoint.ibpPointTable;
514: }
515:
516: itemLoop:
517: do {
518: int itemEndAddress;
519: String code;
520:
521:
522:
523:
524:
525:
526:
527: if (dcwAddress <= itemAddress && itemAddress < dcwEndAddress) {
528: Disassembler.disStatus = 0;
529: int oc = MC68060.mmuPeekWordZeroCode (itemAddress, supervisor);
530: if ((oc & 0xfe00) == 0x7000 && MC68060.mmuPeekWordZeroCode (itemAddress + 2, supervisor) == 0x4e4f) {
531:
532: XEiJ.fmtHex2 (DDP_MOVEQD0_BASE, 10, oc);
533: code = String.valueOf (DDP_MOVEQD0_BASE);
534: } else {
535: XEiJ.fmtHex4 (DDP_DCW_BASE, 9, oc);
536: code = String.valueOf (DDP_DCW_BASE);
537: }
538: itemEndAddress = itemAddress + 2;
539: ddpDCWArray[itemCount] = true;
540: } else {
541: LabeledAddress.lblGetIndex (itemAddress);
542: code = Disassembler.disDisassemble (new StringBuilder (), itemAddress, supervisor,
543: LabeledAddress.lblLastGetHead, LabeledAddress.lblLastGetTail, ddpProgramMode).toString ();
544: for (int t = itemAddress + 2; t < Disassembler.disPC; t += 2) {
545: if (t == address ||
546: InstructionBreakPoint.IBP_ON && pointTable.containsKey (t)) {
547:
548:
549:
550: dcwAddress = itemAddress;
551: dcwEndAddress = t;
552: continue itemLoop;
553: }
554: }
555: itemEndAddress = Disassembler.disPC;
556: ddpDCWArray[itemCount] = false;
557: }
558:
559:
560: if (prevBranchFlag) {
561: sb.append ('\n');
562: }
563:
564:
565: if (itemAddress == address) {
566: ddpItemIndex = itemCount;
567: }
568: ddpAddressArray[itemCount] = itemAddress;
569: ddpSplitArray[itemCount] = sb.length ();
570:
571: if (prevBranchFlag) {
572:
573: if (true) {
574: int i = sb.length ();
575: LabeledAddress.lblSearch (sb, itemAddress);
576: if (i < sb.length ()) {
577: sb.append ('\n');
578: }
579: }
580: }
581:
582:
583: if (itemAddress == ddpStoppedAddress && ddpStoppedBy != null) {
584: sb.append (ddpStoppedBy).append ('\n');
585: }
586:
587: ddpCaretArray[itemCount] = sb.length ();
588:
589:
590: int lineAddress = itemAddress;
591: int lineEndAddress = Math.min (lineAddress + dataBytes, itemEndAddress);
592: {
593:
594:
595:
596: if (ddpProgramMode == 0 ||
597: ddpProgramMode == 2) {
598: XEiJ.fmtHex8 (sb, lineAddress);
599: }
600:
601:
602:
603:
604:
605:
606:
607:
608:
609:
610:
611: if (ddpProgramMode == 1 ||
612: ddpProgramMode == 2) {
613: int index = LabeledAddress.lblGetIndex (lineAddress);
614: if (index != -1 &&
615: LabeledAddress.lblLastGetHead != 0) {
616: if (ddpProgramMode == 2) {
617: sb.append (':');
618: }
619: XEiJ.fmtHex6 (sb.append ('L'), lineAddress - LabeledAddress.lblLastGetHead);
620: } else {
621: if (ddpProgramMode == 1) {
622: XEiJ.fmtHex8 (sb, lineAddress);
623: } else {
624:
625: sb.append (" ");
626: }
627: }
628: }
629: sb.append (" ");
630: }
631:
632: for (int a = lineAddress; a < lineEndAddress; a += 2) {
633: XEiJ.fmtHex4 (sb, MC68060.mmuPeekWordZeroCode (a, supervisor));
634: }
635: sb.append (XEiJ.DBG_SPACES, 0, 2 * Math.max (0, lineAddress + dataBytes - lineEndAddress) + 2);
636:
637: sb.append (code).append (XEiJ.DBG_SPACES, 0, Math.max (1, codeWidth - code.length ()));
638:
639: InstructionBreakPoint.InstructionBreakRecord r = InstructionBreakPoint.IBP_ON ? pointTable.get (itemAddress) : null;
640: if (r != null) {
641: if (r.ibrWaitInstruction != null) {
642: sb.append ("----");
643: }
644: if (r.ibrThreshold < 0) {
645: sb.append ("******");
646: } else if (r.ibrThreshold != 0x7fffffff) {
647: sb.append (r.ibrValue).append ('/').append (r.ibrThreshold);
648: }
649: } else {
650: for (int a = lineAddress; a < lineEndAddress; a++) {
651: int h = MC68060.mmuPeekByteZeroCode (a, supervisor);
652: int c;
653: if (0x81 <= h && h <= 0x9f || 0xe0 <= h && h <= 0xef) {
654: int l = MC68060.mmuPeekByteZeroCode (a + 1, supervisor);
655: if (0x40 <= l && l != 0x7f && l <= 0xfc) {
656: c = CharacterCode.chrSJISToChar[h << 8 | l];
657: if (c == 0) {
658: c = '※';
659: }
660: a++;
661: } else {
662: c = '.';
663: }
664: } else {
665: c = CharacterCode.chrSJISToChar[h];
666: if (c < 0x20 || c == 0x7f) {
667: c = '.';
668: }
669: }
670: sb.append ((char) c);
671: }
672: }
673: sb.append ('\n');
674:
675:
676: while (lineEndAddress < itemEndAddress) {
677: lineAddress = lineEndAddress;
678: lineEndAddress = Math.min (lineAddress + dataBytes, itemEndAddress);
679:
680:
681:
682: if (ddpProgramMode == 0 ||
683: ddpProgramMode == 2) {
684: XEiJ.fmtHex8 (sb, lineAddress);
685: }
686:
687:
688:
689:
690:
691:
692:
693:
694:
695:
696:
697: if (ddpProgramMode == 1 ||
698: ddpProgramMode == 2) {
699: int index = LabeledAddress.lblGetIndex (lineAddress);
700: if (index != -1 &&
701: LabeledAddress.lblLastGetHead != 0) {
702: if (ddpProgramMode == 2) {
703: sb.append (':');
704: }
705: XEiJ.fmtHex6 (sb.append ('L'), lineAddress - LabeledAddress.lblLastGetHead);
706: } else {
707: if (ddpProgramMode == 1) {
708: XEiJ.fmtHex8 (sb, lineAddress);
709: } else {
710:
711: sb.append (" ");
712: }
713: }
714: }
715: sb.append (" ");
716:
717: for (int a = lineAddress; a < lineEndAddress; a += 2) {
718: XEiJ.fmtHex4 (sb, MC68060.mmuPeekWordZeroCode (a, supervisor));
719: }
720: sb.append (XEiJ.DBG_SPACES, 0, 2 * Math.max (0, lineAddress + dataBytes - lineEndAddress) + 2 + codeWidth);
721:
722: for (int a = lineAddress; a < lineEndAddress; a++) {
723: int h = MC68060.mmuPeekByteZeroCode (a, supervisor);
724: int c;
725: if (0x81 <= h && h <= 0x9f || 0xe0 <= h && h <= 0xef) {
726: int l = MC68060.mmuPeekByteZeroCode (a + 1, supervisor);
727: if (0x40 <= l && l != 0x7f && l <= 0xfc) {
728: c = CharacterCode.chrSJISToChar[h << 8 | l];
729: if (c == 0) {
730: c = '※';
731: }
732: a++;
733: } else {
734: c = '.';
735: }
736: } else {
737: c = CharacterCode.chrSJISToChar[h];
738: if (c < 0x20 || c == 0x7f) {
739: c = '.';
740: }
741: }
742: sb.append ((char) c);
743: }
744: sb.append ('\n');
745: }
746:
747:
748: itemCount++;
749: itemAddress = itemEndAddress;
750:
751:
752: prevBranchFlag = (Disassembler.disStatus & Disassembler.DIS_ALWAYS_BRANCH) != 0;
753:
754: } while (itemAddress < pageEndAddress);
755:
756:
757: ddpAddressArray[itemCount] = itemAddress;
758: ddpSplitArray[itemCount] = sb.length ();
759: ddpCaretArray[itemCount] = sb.length ();
760: sb.append (footer);
761: itemCount++;
762: ddpItemCount = itemCount;
763:
764:
765: ddpTextArea.setText (sb.toString ());
766: ddpTextArea.setCaretPosition (ddpCaretArray[ddpItemIndex]);
767:
768:
769:
770:
771:
772: ddpSpinner.setHintArray (ddpAddressArray, itemCount);
773: ddpSpinner.setHintIndex (ddpItemIndex);
774:
775: XEiJ.dbgEventMask--;
776:
777: }
778:
779: }
780:
781:
782: