SUK.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13: package xeij;
14:
15: import java.awt.event.*;
16: import java.util.*;
17: import javax.swing.*;
18:
19: import com.fazecast.jSerialComm.*;
20:
21: public class SUK {
22:
23:
24: public static final int SPC_BDID = 0x01;
25: public static final int SPC_SCTL = 0x03;
26: public static final int SPC_SCTL_RD = 0b10000000;
27: public static final int SPC_SCTL_CR = 0b01000000;
28: public static final int SPC_SCTL_DM = 0b00100000;
29: public static final int SPC_SCTL_AE = 0b00010000;
30: public static final int SPC_SCTL_PE = 0b00001000;
31: public static final int SPC_SCTL_SE = 0b00000100;
32: public static final int SPC_SCTL_RE = 0b00000010;
33: public static final int SPC_SCTL_IE = 0b00000001;
34: public static final int SPC_SCMD = 0x05;
35: public static final int SPC_SCMD_CC = 0b11100000;
36: public static final int SPC_SCMD_CC_BR = 0b00000000;
37: public static final int SPC_SCMD_CC_SL = 0b00100000;
38: public static final int SPC_SCMD_CC_RA = 0b01000000;
39: public static final int SPC_SCMD_CC_SA = 0b01100000;
40: public static final int SPC_SCMD_CC_TR = 0b10000000;
41: public static final int SPC_SCMD_CC_TP = 0b10100000;
42: public static final int SPC_SCMD_CC_RR = 0b11000000;
43: public static final int SPC_SCMD_CC_SR = 0b11100000;
44: public static final int SPC_SCMD_RO = 0b00010000;
45: public static final int SPC_SCMD_IT = 0b00001000;
46: public static final int SPC_SCMD_PT = 0b00000100;
47: public static final int SPC_SCMD_TM = 0b00000001;
48: public static final int SPC_INTS = 0x09;
49: public static final int SPC_INTS_SL = 0b10000000;
50: public static final int SPC_INTS_RS = 0b01000000;
51: public static final int SPC_INTS_DC = 0b00100000;
52: public static final int SPC_INTS_CC = 0b00010000;
53: public static final int SPC_INTS_SR = 0b00001000;
54: public static final int SPC_INTS_TO = 0b00000100;
55: public static final int SPC_INTS_HE = 0b00000010;
56: public static final int SPC_INTS_RC = 0b00000001;
57: public static final int SPC_PSNS = 0x0b;
58: public static final int SPC_PSNS_REQ = 0b10000000;
59: public static final int SPC_PSNS_ACK = 0b01000000;
60: public static final int SPC_PSNS_ATN = 0b00100000;
61: public static final int SPC_PSNS_SEL = 0b00010000;
62: public static final int SPC_PSNS_BSY = 0b00001000;
63: public static final int SPC_SDGC = 0x0b;
64: public static final int SPC_SDGC_REQ = 0b10000000;
65: public static final int SPC_SDGC_ACK = 0b01000000;
66: public static final int SPC_SDGC_XFER = 0b00100000;
67: public static final int SPC_SDGC_BSY = 0b00001000;
68: public static final int SPC_SDGC_MSG = 0b00000100;
69: public static final int SPC_SDGC_CD = 0b00000010;
70: public static final int SPC_SDGC_IO = 0b00000001;
71: public static final int SPC_SSTS = 0x0d;
72: public static final int SPC_SSTS_INIT = 0b10000000;
73: public static final int SPC_SSTS_TARG = 0b01000000;
74: public static final int SPC_SSTS_BUSY = 0b00100000;
75: public static final int SPC_SSTS_TRIP = 0b00010000;
76: public static final int SPC_SSTS_RSIN = 0b00001000;
77: public static final int SPC_SSTS_TC0 = 0b00000100;
78: public static final int SPC_SSTS_DF = 0b00000010;
79: public static final int SPC_SSTS_DE = 0b00000001;
80: public static final int SPC_SERR = 0x0f;
81: public static final int SPC_SERR_DI = 0b10000000;
82: public static final int SPC_SERR_DO = 0b01000000;
83: public static final int SPC_SERR_XO = 0b00100000;
84: public static final int SPC_SERR_PE = 0b00001000;
85: public static final int SPC_SERR_ST = 0b00000010;
86: public static final int SPC_PCTL = 0x11;
87: public static final int SPC_PCTL_IE = 0b10000000;
88: public static final int SPC_PCTL_SR = 0b00000001;
89: public static final int SPC_PCTL_SR_R = 0b00000001;
90: public static final int SPC_PCTL_SR_S = 0b00000000;
91: public static final int SPC_MBC = 0x13;
92: public static final int SPC_DREG = 0x15;
93: public static final int SPC_TEMP = 0x17;
94: public static final int SPC_TCH = 0x19;
95: public static final int SPC_TCM = 0x1b;
96: public static final int SPC_TCL = 0x1d;
97: public static final int SPC_BYPASS = 0x1f;
98: public static final int SPC_PHASE_MASK = 0b00000111;
99: public static final int SPC_DATAOUT_PHASE = 0b00000000;
100: public static final int SPC_DATAIN_PHASE = 0b00000001;
101: public static final int SPC_CMDOUT_PHASE = 0b00000010;
102: public static final int SPC_STSIN_PHASE = 0b00000011;
103: public static final int SPC_MSGOUT_PHASE = 0b00000110;
104: public static final int SPC_MSGIN_PHASE = 0b00000111;
105:
106:
107: public static final String[] SPC_REG_NAME = {
108: "[0x00]", "BDID", "[0x02]", "SCTL", "[0x04]", "SCMD", "[0x06]", "[0x07]",
109: "[0x08]", "INTS", "[0x0a]", "PSNS", "[0x0c]", "SSTS", "[0x0e]", "SERR",
110: "[0x10]", "PCTL", "[0x12]", "MBC", "[0x14]", "DREG", "[0x16]", "TEMP",
111: "[0x18]", "TCH", "[0x1a]", "TCM", "[0x1c]", "TCL", "[0x1e]", "BYPASS",
112: };
113:
114:
115: public static final String[] SPC_PHASE_NAME = {
116: "data-out-phase",
117: "data-in-phase",
118: "command-out-phase",
119: "status-in-phase",
120: "???",
121: "???",
122: "message-out-phase",
123: "message-in-phase",
124: };
125:
126:
127: public static final boolean SUK_ON = true;
128: public static boolean sukOnRequest;
129: public static boolean sukOn;
130: public static boolean sukExpansionRequest;
131: public static boolean sukExpansion;
132:
133:
134: public static final int SUK_VID = 0x04d8;
135: public static final int SUK_PID = 0xe6b2;
136: public static SerialPort sukPort1;
137: public static SerialPort sukPort2;
138:
139:
140: public static final byte[] sukRegister = new byte[32];
141: public static boolean sukReading;
142:
143:
144: public static JMenu sukMenu;
145: public static JCheckBoxMenuItem sukConnectCheckBox;
146: public static JCheckBoxMenuItem sukExpansionCheckBox;
147: public static JCheckBoxMenuItem sukDebugCheckBox;
148: public static JCheckBoxMenuItem sukDumpCheckBox;
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165: public static final boolean SUK_BYPASS = true;
166: public static final int SUK_BYPASS_AHEAD = 256;
167:
168:
169:
170: public static int sukBypassNotRead;
171:
172:
173:
174: public static int sukBypassNotWritten;
175:
176:
177:
178: public static void sukInit () {
179: sukOnRequest = Settings.sgsGetOnOff ("suk");
180: sukOn = false;
181: sukExpansionRequest = Settings.sgsGetOnOff ("sukex");
182: sukExpansion = false;
183: sukPort1 = null;
184: sukPort2 = null;
185:
186: if (SUK_DEBUG) {
187: sukDebugInit ();
188: }
189: if (SUK_DUMP) {
190: sukDumpInit ();
191: }
192: }
193:
194:
195:
196: public static void sukTini () {
197: if (sukOn) {
198: sukDisconnect ();
199: sukOn = false;
200: }
201: Settings.sgsPutOnOff ("suk", sukOnRequest);
202: Settings.sgsPutOnOff ("sukex", sukExpansionRequest);
203: if (SUK_DEBUG) {
204: sukDebugTini ();
205: }
206: if (SUK_DUMP) {
207: sukDumpTini ();
208: }
209: }
210:
211:
212:
213: public static JMenu sukGetMenu () {
214: if (sukMenu != null) {
215: return sukMenu;
216: }
217:
218: ActionListener actionListener = new ActionListener () {
219: @Override public void actionPerformed (ActionEvent ae) {
220: Object source = ae.getSource ();
221: String command = ae.getActionCommand ();
222: switch (command) {
223: case "Connect":
224: sukOnRequest = ((JCheckBoxMenuItem) ae.getSource ()).isSelected ();
225: break;
226: case "Expansion SCSI port":
227: sukExpansionRequest = ((JCheckBoxMenuItem) ae.getSource ()).isSelected ();
228: break;
229: case "Debug output":
230: sukDebugOn = ((JCheckBoxMenuItem) ae.getSource ()).isSelected ();
231: break;
232: case "Dump output":
233: sukDumpOn = ((JCheckBoxMenuItem) ae.getSource ()).isSelected ();
234: break;
235: default:
236: System.out.println ("unknown action command " + command);
237: }
238: }
239: };
240:
241: sukMenu = Multilingual.mlnText (
242: ComponentFactory.createMenu (
243: "SCSI Ukun Kai (experimental)",
244: sukConnectCheckBox = Multilingual.mlnText (
245: ComponentFactory.createCheckBoxMenuItem (sukOnRequest, "Connect", actionListener),
246: "ja", "接続"),
247: sukExpansionCheckBox = Multilingual.mlnText (
248: ComponentFactory.createCheckBoxMenuItem (sukExpansionRequest, "Expansion SCSI port", actionListener),
249: "ja", "拡張 SCSI ポート"),
250: !SUK_DEBUG ? null :
251: (sukDebugCheckBox = Multilingual.mlnText (
252: ComponentFactory.createCheckBoxMenuItem (sukDebugOn, "Debug output", actionListener),
253: "ja", "デバッグ出力")),
254: !SUK_DUMP ? null :
255: (sukDumpCheckBox = Multilingual.mlnText (
256: ComponentFactory.createCheckBoxMenuItem (sukDumpOn, "Dump output", actionListener),
257: "ja", "ダンプ出力"))
258: ),
259: "ja", "すかじー U 君改 (実験中)");
260: return sukMenu;
261: }
262:
263:
264:
265: public static void sukReset () {
266: if (sukOnRequest) {
267: if (!sukConnect ()) {
268: sukOnRequest = false;
269: if (sukConnectCheckBox != null) {
270: sukConnectCheckBox.setSelected (false);
271: }
272: }
273: } else {
274: sukDisconnect ();
275: }
276: sukOn = sukOnRequest;
277: sukExpansion = sukExpansionRequest;
278: }
279:
280:
281:
282: public static boolean sukConnect () {
283: if (sukPort1 != null) {
284: return true;
285: }
286:
287: SerialPort port1 = null;
288: SerialPort port2 = null;
289: for (SerialPort port : SerialPort.getCommPorts ()) {
290: if (SUK_DEBUG && sukDebugOn) {
291: System.out.printf ("systemPortName=%s vid=0x%04x pid=0x%04x\n",
292: port.getSystemPortName (),
293: port.getVendorID (),
294: port.getProductID ());
295: }
296: if (port.getVendorID () == SUK_VID &&
297: port.getProductID () == SUK_PID) {
298: if (port1 == null) {
299: port1 = port;
300: } else if (port2 == null) {
301: port2 = port;
302: } else {
303:
304:
305: System.out.println (Multilingual.mlnJapanese ?
306: "すかじー U 君改のポートが多すぎます" :
307: "Too many MB89352 bridger");
308: return false;
309: }
310: }
311: }
312: if (port2 == null) {
313: System.out.println (Multilingual.mlnJapanese ?
314: "すかじー U 君改のポートが見つかりません" :
315: "MB89352 bridger not found");
316: return false;
317: }
318:
319: if (!port1.openPort (0, 65536, 65536)) {
320: System.out.println (Multilingual.mlnJapanese ?
321: "すかじー U 君改のポートを開けません" :
322: "Cannot open MB89352 bridger");
323: return false;
324: }
325: if (!port2.openPort (0, 65536, 65536)) {
326: port1.closePort ();
327: System.out.println (Multilingual.mlnJapanese ?
328: "すかじー U 君改のポートを開けません" :
329: "Cannot open MB89352 bridger");
330: return false;
331: }
332:
333:
334: port1.setComPortParameters (480000000, 8, SerialPort.ONE_STOP_BIT, SerialPort.NO_PARITY);
335: port2.setComPortParameters (480000000, 8, SerialPort.ONE_STOP_BIT, SerialPort.NO_PARITY);
336:
337:
338:
339: port1.setComPortTimeouts (SerialPort.TIMEOUT_READ_BLOCKING, 50, 0);
340: port2.setComPortTimeouts (SerialPort.TIMEOUT_READ_BLOCKING, 50, 0);
341:
342:
343: byte[] b = new byte[] { 0x00, 0x00 };
344: port1.writeBytes (b, 1, 0);
345: port1.readBytes (b, 1, 0);
346: port2.writeBytes (b, 1, 1);
347: port2.readBytes (b, 1, 1);
348: if (b[0] == 's' && b[1] == 'S') {
349: } else if (b[0] == 'S' && b[1] == 's') {
350:
351: SerialPort port = port1;
352: port1 = port2;
353: port2 = port;
354: } else {
355: port1.closePort ();
356: port2.closePort ();
357: System.out.println (Multilingual.mlnJapanese ?
358: "すかじー U 君改のポートを判別できません" :
359: "Unable to identify MB89352 bridger");
360: return false;
361: }
362:
363:
364:
365: port1.setComPortTimeouts (SerialPort.TIMEOUT_READ_BLOCKING, 0, 0);
366: port2.setComPortTimeouts (SerialPort.TIMEOUT_READ_BLOCKING, 0, 0);
367:
368:
369:
370: port1.writeBytes (new byte[] { (byte) 0x80 }, 1);
371: port1.writeBytes (new byte[] { (byte) 0xfe }, 1);
372:
373: sukPort1 = port1;
374: sukPort2 = port2;
375: Arrays.fill (sukRegister, (byte) 0x00);
376: sukReading = false;
377: System.out.printf (Multilingual.mlnJapanese ?
378: "すかじー U 君改 (%s,%s) に接続しました\n" :
379: "MB89352 bridger (%s,%s) connected\n",
380: sukPort1.getSystemPortName (),
381: sukPort2.getSystemPortName ());
382:
383: sukQueueInit ();
384:
385: sukPoolInit ();
386:
387: sukDregInit ();
388: if (SUK_BYPASS) {
389:
390: sukBypassNotRead = 0;
391: sukBypassNotWritten = 0;
392: }
393:
394: sukPort1.addDataListener (sukDataListener1);
395: sukPort2.addDataListener (sukDataListener2);
396: return true;
397: }
398:
399:
400:
401: public static void sukDisconnect () {
402: if (sukPort1 == null) {
403: return;
404: }
405:
406: sukPort1.removeDataListener ();
407: sukPort2.removeDataListener ();
408:
409: System.out.printf (Multilingual.mlnJapanese ?
410: "すかじー U 君改 (%s,%s) を切り離しました\n" :
411: "MB89352 bridger (%s,%s) disconnected\n",
412: sukPort1.getSystemPortName (),
413: sukPort2.getSystemPortName ());
414: sukPort1.clearRTS ();
415: sukPort2.clearRTS ();
416: sukPort1.clearDTR ();
417: sukPort2.clearDTR ();
418: sukPort1.closePort ();
419: sukPort2.closePort ();
420: sukPort1 = null;
421: sukPort2 = null;
422: }
423:
424:
425:
426: public static int sukPeek (int a) {
427: a &= 0x1f;
428:
429: return 0xff & sukRegister[a];
430: }
431:
432:
433:
434: public static int sukRead (int a) throws M68kException {
435: a &= 0x1f;
436: if (SUK_BYPASS) {
437: if (0 < sukBypassNotRead) {
438: if (a != SPC_BYPASS) {
439: System.out.printf ("%08x sukRead() attempted to read from a register other than bypass during receiving bypass\n", XEiJ.regPC0);
440: }
441: int d = sukQueueData ();
442: if (d < 0) {
443: System.out.printf ("%08x sukRead() queue is empty\n", XEiJ.regPC0);
444: d = 0;
445: }
446: if (SUK_DEBUG && sukDebugOn) {
447: System.out.printf ("%08x sukRead() bypass data=0x%02x\n", XEiJ.regPC0, d);
448: }
449: sukBypassNotRead--;
450: if (sukBypassNotRead == 0) {
451: if (SUK_DEBUG && sukDebugOn) {
452: System.out.printf ("%08x sukRead() sukBypassNotRead=%d\n", XEiJ.regPC0, sukBypassNotRead);
453: }
454: } else if ((sukQueueWrite - sukQueueRead) == 0) {
455:
456: sukQueueRequired = Math.min (SUK_BYPASS_AHEAD, sukBypassNotRead);
457: TickerQueue.tkqAdd (sukQueueTicker, XEiJ.mpuClockTime);
458: }
459: return d;
460: }
461: if (a == SPC_BYPASS) {
462: if (sukBypassNotRead == 0) {
463: sukBypassNotRead = -1;
464:
465: sukPoolAdd1 (a);
466: sukPoolFlush ();
467:
468:
469: sukQueueRequired = 3;
470: InstructionBreakPoint.ibpAddWaitPoint (XEiJ.regPC0, XEiJ.regSRS, sukQueueInstruction);
471: if (SUK_DEBUG && sukDebugOn) {
472: System.out.printf ("%08x sukRead() queue instruction at pc=0x%08x required=%d\n", XEiJ.regPC0, XEiJ.regPC0, sukQueueRequired);
473: }
474:
475: M68kException.m6eNumber = M68kException.M6E_WAIT_EXCEPTION;
476: throw M68kException.m6eSignal;
477: }
478: if (sukBypassNotRead < 0) {
479: int l = sukQueueData ();
480: int h = sukQueueData ();
481: int d = sukQueueData ();
482: if (d < 0) {
483: System.out.printf ("%08x sukRead() queue is empty\n", XEiJ.regPC0);
484: l = 1;
485: h = 0;
486: d = 0;
487: }
488: sukBypassNotRead = h << 8 | l;
489: if (SUK_DEBUG && sukDebugOn) {
490: System.out.printf ("%08x sukRead() bypass lower=0x%02x\n", XEiJ.regPC0, l);
491: System.out.printf ("%08x sukRead() bypass upper=0x%02x\n", XEiJ.regPC0, h);
492: System.out.printf ("%08x sukRead() sukBypassNotRead=0x%02x\n", XEiJ.regPC0, sukBypassNotRead);
493: System.out.printf ("%08x sukRead() bypass data=0x%02x\n", XEiJ.regPC0, d);
494: }
495: sukBypassNotRead--;
496: if (sukBypassNotRead == 0) {
497: if (SUK_DEBUG && sukDebugOn) {
498: System.out.printf ("%08x sukRead() sukBypassNotRead=%d\n", XEiJ.regPC0, sukBypassNotRead);
499: }
500: } else if ((sukQueueWrite - sukQueueRead) == 0) {
501:
502: sukQueueRequired = Math.min (SUK_BYPASS_AHEAD, sukBypassNotRead);
503: TickerQueue.tkqAdd (sukQueueTicker, XEiJ.mpuClockTime);
504: }
505: return d;
506: }
507:
508: }
509: }
510: if ((sukDregLength - sukDregRead) != 0) {
511: if (a == SPC_DREG) {
512:
513: if ((sukDregWrite - sukDregRead) == 0) {
514: System.out.printf ("%08x sukRead() buffer is empty\n", XEiJ.regPC0);
515: return 0xff & sukRegister[a];
516: }
517: int d = 0xff & sukDregBuffer[sukDregRead++];
518: if ((sukDregLength - sukDregRead) == 0) {
519:
520: sukRegister[SPC_TCH] = 0x00;
521: sukRegister[SPC_TCM] = 0x00;
522: sukRegister[SPC_TCL] = 0x00;
523: if (SUK_DEBUG && sukDebugOn) {
524: sukDebugRegister (true, SPC_TCH);
525: sukDebugRegister (true, SPC_TCM);
526: sukDebugRegister (true, SPC_TCL);
527: System.out.printf ("%08x sukRead() sukDregRead=%d\n", XEiJ.regPC0, sukDregRead);
528: }
529: }
530: sukRegister[a] = (byte) d;
531:
532: if ((XEiJ.busWaitTime == XEiJ.mpuWaitTime ||
533: XEiJ.busWaitTime == XEiJ.mpuNoWaitTime) &&
534: (sukDregLength - sukDregRead) != 0 &&
535: (sukDregWrite - sukDregRead) == 0) {
536:
537:
538: sukDregRequired = Math.min (SUK_MPU_AHEAD, sukDregLength - sukDregRead);
539: sukDregCounter = 0;
540: TickerQueue.tkqAdd (sukDregMPUTicker, XEiJ.mpuClockTime);
541: }
542: if (SUK_DUMP && sukDumpOn) {
543: sukDumpAdd (d);
544: }
545: } else if (a == SPC_INTS) {
546: sukRegister[a] = 0x00;
547: } else if (a == SPC_SSTS) {
548: sukRegister[a] = (byte) (SPC_SSTS_INIT | SPC_SSTS_BUSY | SPC_SSTS_TRIP | ((sukDregLength - sukDregRead) < 8 ? 0 : SPC_SSTS_DF));
549: } else if (a == SPC_TCH) {
550: sukRegister[a] = (byte) ((sukDregLength - sukDregRead) >> 16);
551: } else if (a == SPC_TCM) {
552: sukRegister[a] = (byte) ((sukDregLength - sukDregRead) >> 8);
553: } else if (a == SPC_TCL) {
554: sukRegister[a] = (byte) (sukDregLength - sukDregRead);
555: }
556: if (SUK_DEBUG && sukDebugOn) {
557: sukDebugRegister (true, a);
558: }
559: return 0xff & sukRegister[a];
560: }
561:
562: if (XEiJ.busWaitTime == XEiJ.dmaWaitTime ||
563: XEiJ.busWaitTime == XEiJ.dmaNoWaitTime) {
564: System.out.printf ("%08x sukRead() DMAC attempted to read while not in data-in-phase\n", XEiJ.regPC0);
565: return 0xff & sukRegister[a];
566: }
567:
568: if (a == SPC_DREG) {
569: if (!sukDregStandby) {
570: System.out.printf ("%08x sukRead() MPU attempted to read while not in data-in-phase\n", XEiJ.regPC0);
571: }
572:
573: sukDregStart ();
574:
575: int d = sukDregMPUStart ();
576: sukRegister[a] = (byte) d;
577: if (SUK_DEBUG && sukDebugOn) {
578: sukDebugRegister (true, a);
579: }
580: if (SUK_DUMP && sukDumpOn) {
581: sukDumpAdd (d);
582: }
583: return d;
584: }
585: if (!sukReading) {
586: sukReading = true;
587:
588: sukPoolAdd1 (a);
589: sukPoolFlush ();
590:
591: sukQueueRequired = 1;
592: InstructionBreakPoint.ibpAddWaitPoint (XEiJ.regPC0, XEiJ.regSRS, sukQueueInstruction);
593: if (false) {
594: if (SUK_DEBUG && sukDebugOn) {
595: System.out.printf ("%08x sukRead() queue instruction at pc=0x%08x required=%d\n", XEiJ.regPC0, XEiJ.regPC0, sukQueueRequired);
596: }
597: }
598:
599: M68kException.m6eNumber = M68kException.M6E_WAIT_EXCEPTION;
600: throw M68kException.m6eSignal;
601: }
602:
603:
604: int d = sukQueueData ();
605: if (d < 0) {
606: System.out.printf ("%08x sukRead() queue is empty\n", XEiJ.regPC0);
607: return 0xff & sukRegister[a];
608: }
609:
610:
611:
612:
613:
614:
615: if (a == SPC_SSTS && d == 0x00) {
616: d = ((sukRegister[SPC_TCH] | sukRegister[SPC_TCM] | sukRegister[SPC_TCL]) == 0 ? SPC_SSTS_TC0 : 0) | SPC_SSTS_DE;
617: }
618: sukRegister[a] = (byte) d;
619: if (SUK_DEBUG && sukDebugOn) {
620: sukDebugRegister (true, a);
621: }
622: if (SUK_DUMP && sukDumpOn) {
623: if (a == SPC_TEMP) {
624: int psns = 0xff & sukRegister[SPC_PSNS];
625: if (psns == (SPC_PSNS_ACK | SPC_PSNS_BSY | SPC_DATAIN_PHASE) ||
626: psns == (SPC_PSNS_ACK | SPC_PSNS_BSY | SPC_STSIN_PHASE) ||
627: psns == (SPC_PSNS_ACK | SPC_PSNS_BSY | SPC_MSGIN_PHASE)) {
628: sukDumpAdd (0xff & sukRegister[a]);
629: }
630: }
631: }
632: sukReading = false;
633: return d;
634: }
635:
636:
637:
638: public static void sukWrite (int a, int d) {
639: a &= 0x1f;
640: d &= 0xff;
641: if (SUK_BYPASS) {
642: if (sukBypassNotWritten != 0) {
643: if (a != SPC_BYPASS) {
644: System.out.printf ("%08x sukWrite() attempted to write to a register other than bypass during bypass transmission\n", XEiJ.regPC0);
645: }
646: sukPoolAdd1 (d);
647: if (sukBypassNotWritten < 0) {
648: sukBypassNotWritten = d << 8 | (0xff & sukBypassNotWritten);
649: if (SUK_DEBUG && sukDebugOn) {
650: System.out.printf ("%08x sukWrite() bypass upper=0x%02x\n", XEiJ.regPC0, d);
651: System.out.printf ("%08x sukWrite() sukBypassNotWritten=%d\n", XEiJ.regPC0, sukBypassNotWritten);
652: }
653: } else {
654: if (SUK_DEBUG && sukDebugOn) {
655: System.out.printf ("%08x sukWrite() bypass data=0x%02x\n", XEiJ.regPC0, d);
656: }
657: sukBypassNotWritten--;
658: if (sukBypassNotWritten == 0) {
659: if (SUK_DEBUG && sukDebugOn) {
660: System.out.printf ("%08x sukWrite() sukBypassNotWritten=%d\n", XEiJ.regPC0, sukBypassNotWritten);
661: }
662: }
663: }
664: return;
665: }
666: }
667: sukRegister[a] = (byte) d;
668: if (SUK_DEBUG && sukDebugOn) {
669: sukDebugRegister (false, a);
670: }
671:
672: sukPoolAdd2 (0x80 + a, d);
673: if (SUK_BYPASS) {
674: if (a == SPC_BYPASS) {
675: sukBypassNotWritten = 0xffff0000 + d;
676: if (SUK_DEBUG && sukDebugOn) {
677: System.out.printf ("%08x sukWrite() bypass lower=0x%02x\n", XEiJ.regPC0, d);
678: }
679: }
680: }
681: if (SUK_DUMP && sukDumpOn) {
682: if (a == SPC_DREG) {
683: sukDumpAdd (d);
684: } else if (a == SPC_TEMP) {
685: int psns = 0xff & sukRegister[SPC_PSNS];
686: if (psns == (SPC_PSNS_REQ | SPC_PSNS_BSY | SPC_DATAOUT_PHASE) ||
687: psns == (SPC_PSNS_REQ | SPC_PSNS_BSY | SPC_CMDOUT_PHASE) ||
688: psns == (SPC_PSNS_REQ | SPC_PSNS_BSY | SPC_MSGOUT_PHASE)) {
689: sukDumpAdd (d);
690: }
691: } else if (a == SPC_PCTL) {
692: sukDumpDump (d & SPC_PHASE_MASK);
693: }
694: }
695:
696: int us = (a == SPC_SCMD && (d & SPC_SCMD_RO) != 0 ? 250 :
697: a == SPC_SCMD && (d & SPC_SCMD_CC) == SPC_SCMD_CC_SL ? 50 :
698: a == SPC_INTS && (d & SPC_INTS_TO) != 0 ? 50 :
699: 0);
700: if (us != 0) {
701: sukPoolFlush ();
702:
703: sukIntervalTime = System.nanoTime () + us * 1000;
704: sukIntervalCounter = 0;
705: InstructionBreakPoint.ibpAddWaitPoint (XEiJ.regPC, XEiJ.regSRS, sukIntervalInstruction);
706: if (SUK_DEBUG && sukDebugOn) {
707: System.out.printf ("%08x sukWrite() interval instruction at pc=0x%08x time=%d\n", XEiJ.regPC0, XEiJ.regPC, sukIntervalTime);
708: }
709: }
710:
711: if ((sukRegister[SPC_PCTL] & SPC_PHASE_MASK) == SPC_DATAIN_PHASE &&
712: a == SPC_SCMD && (d & SPC_SCMD_CC) == SPC_SCMD_CC_TR) {
713: sukDregStandby = true;
714: if (SUK_DEBUG && sukDebugOn) {
715: System.out.printf ("%08x sukWrite() SPC has started receiving\n", XEiJ.regPC0);
716: }
717: }
718: }
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730: public static final SerialPortDataListener sukDataListener1 = new SerialPortDataListener () {
731: @Override public int getListeningEvents () {
732: return SerialPort.LISTENING_EVENT_DATA_AVAILABLE;
733: }
734: @Override public void serialEvent (SerialPortEvent spe) {
735: if (spe.getEventType () != SerialPort.LISTENING_EVENT_DATA_AVAILABLE) {
736: return;
737: }
738:
739: int n = sukPort1.bytesAvailable ();
740: byte[] b = new byte[n];
741: sukPort1.readBytes (b, n);
742: int w = sukQueueWrite;
743: int r = sukQueueRead;
744:
745: if ((SUK_QUEUE_SIZE - (w - r)) < n) {
746: System.out.printf ("%08x sukDataListener1.serialEvent() queue is full\n", XEiJ.regPC0);
747: return;
748: }
749:
750: int i = w & (SUK_QUEUE_SIZE - 1);
751: int k = Math.min (n, SUK_QUEUE_SIZE - i);
752: System.arraycopy (b, 0,
753: sukQueueArray, i,
754: k);
755: if (k < n) {
756: System.arraycopy (b, k,
757: sukQueueArray, 0,
758: n - k);
759: }
760: sukQueueWrite = w += n;
761: }
762: };
763:
764:
765:
766: public static final SerialPortDataListener sukDataListener2 = new SerialPortDataListener () {
767: @Override public int getListeningEvents () {
768: return SerialPort.LISTENING_EVENT_DATA_AVAILABLE;
769: }
770: @Override public void serialEvent (SerialPortEvent spe) {
771: if (spe.getEventType () != SerialPort.LISTENING_EVENT_DATA_AVAILABLE) {
772: return;
773: }
774:
775: byte[] b = spe.getReceivedData ();
776: if (b == null) {
777: return;
778: }
779: int n = b.length;
780: for (int i = 0; i < n; i++) {
781: if (b[i] == 'I') {
782: if (SUK_DEBUG && sukDebugOn) {
783: System.out.printf ("%08x serialEvent() interrupt\n", XEiJ.regPC0);
784: }
785: if (sukExpansion) {
786: XEiJ.eb2Interrupt (XEiJ.EB2_SPC_REQUEST);
787: } else {
788: IOInterrupt.ioiSpcFall ();
789: IOInterrupt.ioiSpcRise ();
790: }
791: }
792: }
793: }
794: };
795:
796:
797:
798:
799:
800:
801: public static final int SUK_QUEUE_SIZE = 1048576;
802: public static final byte[] sukQueueArray = new byte[SUK_QUEUE_SIZE];
803: public static volatile int sukQueueWrite;
804: public static volatile int sukQueueRead;
805: public static int sukQueueRequired;
806:
807:
808:
809: public static void sukQueueInit () {
810:
811: sukQueueWrite = 0;
812: sukQueueRead = 0;
813: sukQueueRequired = 0;
814: }
815:
816:
817:
818:
819: public static int sukQueueData () {
820: int w = sukQueueWrite;
821: int r = sukQueueRead;
822: if ((w - r) == 0) {
823: return -1;
824: }
825: int d = 0xff & sukQueueArray[r++ & (SUK_QUEUE_SIZE - 1)];
826: sukQueueRead = r;
827: return d;
828: }
829:
830:
831:
832: public static final TickerQueue.Ticker sukQueueTicker = new TickerQueue.Ticker () {
833: @Override protected void tick () {
834:
835:
836: int pc = XEiJ.regPC;
837: InstructionBreakPoint.ibpAddWaitPoint (pc, XEiJ.regSRS, sukQueueInstruction);
838: if (SUK_DEBUG && sukDebugOn) {
839: int required = sukQueueRequired;
840: System.out.printf ("%08x sukQueueTicker.tick() queue instruction at pc=0x%08x required=%d\n", XEiJ.regPC0, pc, required);
841: }
842: }
843: };
844:
845:
846:
847: public static final WaitInstruction sukQueueInstruction = new WaitInstruction () {
848: @Override public boolean terminate () {
849: return sukQueueRequired <= (sukQueueWrite - sukQueueRead);
850: }
851: };
852:
853:
854:
855:
856:
857:
858:
859: public static boolean sukDregStandby;
860: public static int sukDregLength;
861: public static int sukDregMajor;
862: public static int sukDregMinor;
863: public static byte[] sukDregBuffer;
864: public static int sukDregWrite;
865: public static int sukDregRead;
866: public static int sukDregRequired;
867: public static int sukDregCounter;
868:
869:
870:
871: public static void sukDregInit () {
872: sukDregStandby = false;
873: sukDregLength = 0;
874: sukDregMajor = 0;
875: sukDregMinor = 0;
876: sukDregBuffer = new byte[0];
877: sukDregWrite = 0;
878: sukDregRead = 0;
879: sukDregRequired = 0;
880: sukDregCounter = 0;
881: }
882:
883:
884:
885:
886:
887:
888:
889:
890:
891:
892:
893:
894:
895:
896:
897:
898: public static void sukDregStart () {
899:
900: sukDregStandby = false;
901:
902: sukDregLength = ((0xff & sukRegister[SPC_TCH]) << 16 |
903: (0xff & sukRegister[SPC_TCM]) << 8 |
904: (0xff & sukRegister[SPC_TCL]));
905:
906: sukDregMajor = sukDregLength;
907: sukDregMinor = 0;
908: if (SUK_DEBUG && sukDebugOn) {
909: System.out.printf ("%08x sukDregStart() sukDregLength=%d\n", XEiJ.regPC0, sukDregLength);
910: System.out.printf ("%08x sukDregStart() sukDregMajor=%d\n", XEiJ.regPC0, sukDregMajor);
911: System.out.printf ("%08x sukDregStart() sukDregMinor=%d\n", XEiJ.regPC0, sukDregMinor);
912: }
913:
914: if (sukDregBuffer.length < sukDregLength) {
915: sukDregBuffer = new byte[sukDregLength];
916: }
917:
918: sukDregWrite = 0;
919: sukDregRead = 0;
920: if (SUK_DEBUG && sukDebugOn) {
921: System.out.printf ("%08x sukDregStart() sukDregWrite=%d\n", XEiJ.regPC0, sukDregWrite);
922: System.out.printf ("%08x sukDregStart() sukDregRead=%d\n", XEiJ.regPC0, sukDregRead);
923: }
924:
925: if (sukDregLength != 0) {
926:
927: sukDregMinor = -1;
928: if (SUK_DEBUG && sukDebugOn) {
929: System.out.printf ("%08x sukDregStart() sukDregMinor=%d\n", XEiJ.regPC0, sukDregMinor);
930: }
931:
932: sukPort1.writeBytes (new byte[] { 0x41 }, 1);
933: }
934: }
935:
936:
937:
938:
939:
940:
941:
942:
943:
944:
945:
946:
947:
948:
949:
950:
951:
952: public static int sukDregAvailable () {
953: int w = sukQueueWrite;
954: int r = sukQueueRead;
955:
956: if (sukDregMinor == -1 && 2 <= (w - r)) {
957:
958: int l = 0xff & sukQueueArray[r++ & (SUK_QUEUE_SIZE - 1)];
959: int h = 0xff & sukQueueArray[r++ & (SUK_QUEUE_SIZE - 1)];
960: sukQueueRead = r;
961: sukDregMinor = h << 8 | l;
962: if (SUK_DEBUG && sukDebugOn) {
963: System.out.printf ("%08x sukDregAvailable() sukDregMinor=%d\n", XEiJ.regPC0, sukDregMinor);
964: }
965:
966: if (sukDregMajor < sukDregMinor) {
967: System.out.printf ("%08x sukDregAvailable() total overrun\n", XEiJ.regPC0);
968: sukDregMinor = sukDregMajor;
969: if (SUK_DEBUG && sukDebugOn) {
970: System.out.printf ("%08x sukDregAvailable() sukDregMinor=%d\n", XEiJ.regPC0, sukDregMinor);
971: }
972: }
973:
974: sukDregMajor -= sukDregMinor;
975: if (SUK_DEBUG && sukDebugOn) {
976: System.out.printf ("%08x sukDregAvailable() sukDregMajor=%d\n", XEiJ.regPC0, sukDregMajor);
977: }
978: }
979: int n = w - r;
980:
981: if (1 <= sukDregMinor && 1 <= n) {
982:
983: if (sukDregMinor < n) {
984: System.out.printf ("%08x sukDregAvailable() block overrun\n", XEiJ.regPC0);
985: n = sukDregMinor;
986: }
987:
988: int i = r & (SUK_QUEUE_SIZE - 1);
989: int k = Math.min (n, SUK_QUEUE_SIZE - i);
990: System.arraycopy (sukQueueArray, i,
991: sukDregBuffer, sukDregWrite,
992: k);
993: if (k < n) {
994: System.arraycopy (sukQueueArray, 0,
995: sukDregBuffer, sukDregWrite + k,
996: n - k);
997: }
998:
999: sukQueueRead = r += n;
1000:
1001: sukDregMinor -= n;
1002: if (SUK_DEBUG && sukDebugOn) {
1003: System.out.printf ("%08x sukDregAvailable() sukDregMinor=%d\n", XEiJ.regPC0, sukDregMinor);
1004: }
1005:
1006: sukDregWrite += n;
1007: if ((sukDregLength - sukDregWrite) == 0) {
1008: if (SUK_DEBUG && sukDebugOn) {
1009: System.out.printf ("%08x sukDregAvailable() sukDregWrite=%d\n", XEiJ.regPC0, sukDregWrite);
1010: }
1011: }
1012: }
1013:
1014: if (sukDregMinor == 0 && sukDregMajor != 0) {
1015:
1016: sukDregMinor = -1;
1017: if (SUK_DEBUG && sukDebugOn) {
1018: System.out.printf ("%08x sukDregAvailable() sukDregMinor=%d\n", XEiJ.regPC0, sukDregMinor);
1019: }
1020:
1021: sukPort1.writeBytes (new byte[] { 0x41 }, 1);
1022: }
1023: return sukDregWrite - sukDregRead;
1024: }
1025:
1026:
1027:
1028:
1029: public static final int SUK_MPU_AHEAD = 256;
1030:
1031:
1032:
1033: public static int sukDregMPUStart () throws M68kException {
1034: if (SUK_DEBUG && sukDebugOn) {
1035: System.out.printf ("%08x sukDregMPUStart() MPU has started receiving\n", XEiJ.regPC0);
1036: }
1037: int required = Math.min (SUK_MPU_AHEAD, sukDregLength - sukDregRead);
1038: if (required <= (sukDregWrite - sukDregRead)) {
1039: int d = 0xff & sukDregBuffer[sukDregRead++];
1040: if ((sukDregLength - sukDregRead) == 0) {
1041: if (SUK_DEBUG && sukDebugOn) {
1042: System.out.printf ("%08x sukDregMPUStart() sukDregRead=%d\n", XEiJ.regPC0, sukDregRead);
1043: }
1044: }
1045: return d;
1046: }
1047:
1048: sukDregRequired = required;
1049: sukDregCounter = 0;
1050: InstructionBreakPoint.ibpAddWaitPoint (XEiJ.regPC0, XEiJ.regSRS, sukDregMPUInstruction);
1051: if (SUK_DEBUG && sukDebugOn) {
1052: System.out.printf ("%08x sukDregMPUStart() pc=0x%08x required=%d\n", XEiJ.regPC0, XEiJ.regPC0, required);
1053: }
1054:
1055: M68kException.m6eNumber = M68kException.M6E_WAIT_EXCEPTION;
1056: throw M68kException.m6eSignal;
1057: }
1058:
1059:
1060:
1061: public static final TickerQueue.Ticker sukDregMPUTicker = new TickerQueue.Ticker () {
1062: @Override protected void tick () {
1063:
1064:
1065: int pc = XEiJ.regPC;
1066: InstructionBreakPoint.ibpAddWaitPoint (pc, XEiJ.regSRS, sukDregMPUInstruction);
1067: if (SUK_DEBUG && sukDebugOn) {
1068: int required = sukDregRequired;
1069: System.out.printf ("%08x sukDregMPUTicker.tick() dreg mpu instruction at pc=0x%08x required=%d\n", XEiJ.regPC0, pc, required);
1070: }
1071: }
1072: };
1073:
1074:
1075:
1076: public static final WaitInstruction sukDregMPUInstruction = new WaitInstruction () {
1077: @Override public boolean terminate () {
1078: return ((++sukDregCounter & 15) == 0 &&
1079: sukDregRequired <= sukDregAvailable ());
1080: }
1081: };
1082:
1083:
1084:
1085:
1086: public static final int SUK_DREG_CHANNEL = 1;
1087:
1088:
1089:
1090: public static void sukDregDMACStart () {
1091: if (sukDregStandby) {
1092: if (SUK_DEBUG && sukDebugOn) {
1093: System.out.printf ("%08x sukDregDMACStart() DMAC has started receiving\n", XEiJ.regPC0);
1094: }
1095:
1096: sukDregStart ();
1097: }
1098: if ((sukDregLength - sukDregRead) == 0) {
1099: System.out.printf ("%08x sukDregDMACStart() DMAC attempted to read while not in data-in-phase\n", XEiJ.regPC0);
1100:
1101: }
1102: int required = HD63450.dmaMTC[SUK_DREG_CHANNEL];
1103: if (required <= (sukDregWrite - sukDregRead)) {
1104: HD63450.dmaTransfer (SUK_DREG_CHANNEL);
1105: } else {
1106:
1107: int pc = XEiJ.regPC;
1108: sukDregRequired = required;
1109: sukDregCounter = 0;
1110: InstructionBreakPoint.ibpAddWaitPoint (pc, XEiJ.regSRS, sukDregDMACInstruction);
1111: if (SUK_DEBUG && sukDebugOn) {
1112: System.out.printf ("%08x sukDregDMACStart() dreg dmac instruction at pc=0x%08x required=%d\n", XEiJ.regPC0, XEiJ.regPC, required);
1113: }
1114: }
1115: }
1116:
1117:
1118:
1119: public static final WaitInstruction sukDregDMACInstruction = new WaitInstruction () {
1120: @Override public boolean terminate () {
1121: boolean b = ((++sukDregCounter & 15) == 0 &&
1122: sukDregRequired <= sukDregAvailable ());
1123: if (b) {
1124: HD63450.dmaTransfer (SUK_DREG_CHANNEL);
1125: }
1126: return b;
1127: }
1128: };
1129:
1130:
1131:
1132:
1133:
1134:
1135:
1136: public static final int SUK_POOL_SIZE = 511;
1137: public static final long SUK_POOL_SPAN = XEiJ.TMR_FREQ / 1000;
1138: public static final byte[] sukPoolBuffer = new byte[SUK_POOL_SIZE];
1139: public static int sukPoolLength;
1140:
1141:
1142:
1143: public static void sukPoolInit () {
1144:
1145: sukPoolLength = 0;
1146: }
1147:
1148:
1149:
1150: public static void sukPoolAdd1 (int d1) {
1151: if (SUK_POOL_SIZE - 1 < sukPoolLength) {
1152: sukPoolFlush ();
1153: }
1154: sukPoolBuffer[sukPoolLength++] = (byte) d1;
1155: TickerQueue.tkqAdd (sukPoolTicker, XEiJ.mpuClockTime + SUK_POOL_SPAN);
1156: }
1157:
1158:
1159:
1160: public static void sukPoolAdd2 (int d1, int d2) {
1161: if (SUK_POOL_SIZE - 2 < sukPoolLength) {
1162: sukPoolFlush ();
1163: }
1164: sukPoolBuffer[sukPoolLength++] = (byte) d1;
1165: sukPoolBuffer[sukPoolLength++] = (byte) d2;
1166: TickerQueue.tkqAdd (sukPoolTicker, XEiJ.mpuClockTime + SUK_POOL_SPAN);
1167: }
1168:
1169:
1170:
1171: public static final TickerQueue.Ticker sukPoolTicker = new TickerQueue.Ticker () {
1172: @Override protected void tick () {
1173:
1174: sukPoolFlush ();
1175: }
1176: };
1177:
1178:
1179:
1180: public static void sukPoolFlush () {
1181: if (0 < sukPoolLength) {
1182: sukPort1.writeBytes (sukPoolBuffer, sukPoolLength);
1183: sukPoolLength = 0;
1184: }
1185: }
1186:
1187:
1188:
1189:
1190:
1191:
1192:
1193:
1194: public static long sukIntervalTime;
1195: public static int sukIntervalCounter;
1196:
1197:
1198:
1199: public static final WaitInstruction sukIntervalInstruction = new WaitInstruction () {
1200: @Override public boolean terminate () {
1201: return ((++sukIntervalCounter & 15) == 0 &&
1202: 0 <= (System.nanoTime () - sukIntervalTime));
1203: }
1204: };
1205:
1206:
1207:
1208:
1209: public static final boolean SUK_DEBUG = true;
1210: public static boolean sukDebugOn;
1211: public static final byte[] sukDebugLastRegister = new byte[32];
1212:
1213:
1214:
1215: public static void sukDebugInit () {
1216: sukDebugOn = Settings.sgsGetOnOff ("sukdebug");
1217:
1218: }
1219:
1220:
1221:
1222: public static void sukDebugTini () {
1223: Settings.sgsPutOnOff ("sukdebug", sukDebugOn);
1224: }
1225:
1226:
1227:
1228: public static void sukDebugRegister (boolean read, int a) {
1229: if (a != SPC_DREG && a != SPC_BYPASS &&
1230: sukDebugLastRegister[a] != sukRegister[a]) {
1231: System.out.printf ("%08x suk%s() %s=0x%02x\n", XEiJ.regPC0, read ? "Read" : "Write", SPC_REG_NAME[a], 0xff & sukRegister[a]);
1232: sukDebugLastRegister[a] = sukRegister[a];
1233: }
1234: }
1235:
1236:
1237:
1238:
1239:
1240: public static final boolean SUK_DUMP = true;
1241: public static boolean sukDumpOn;
1242: public static final int SUK_DUMP_LIMIT = 4096;
1243: public static final byte[] sukDumpBuffer = new byte[SUK_DUMP_LIMIT];
1244: public static int sukDumpLength;
1245: public static int sukDataPhase;
1246:
1247:
1248:
1249: public static void sukDumpInit () {
1250: sukDumpOn = Settings.sgsGetOnOff ("sukdump");
1251:
1252: sukDumpLength = 0;
1253: sukDataPhase = -1;
1254: }
1255:
1256:
1257:
1258: public static void sukDumpTini () {
1259: Settings.sgsPutOnOff ("sukdump", sukDumpOn);
1260: }
1261:
1262:
1263:
1264: public static void sukDumpAdd (int d) {
1265: sukDumpDump (sukRegister[SPC_PSNS] & SPC_PHASE_MASK);
1266: if (sukDumpLength < SUK_DUMP_LIMIT) {
1267: sukDumpBuffer[sukDumpLength++] = (byte) d;
1268: }
1269: }
1270:
1271:
1272:
1273: public static void sukDumpDump (int phase) {
1274: if (sukDataPhase != phase) {
1275: if (0 <= sukDataPhase) {
1276: System.out.printf ("%08x %s\n", XEiJ.regPC0, SPC_PHASE_NAME[sukDataPhase]);
1277: int m = (sukDumpLength + 15) & -16;
1278: for (int i = 0; i < m; i += 16) {
1279: System.out.printf ("%08x ", i);
1280: for (int j = 0; j < 16; j++) {
1281: if (i + j < sukDumpLength) {
1282: System.out.printf ("%02x ", 0xff & sukDumpBuffer[i + j]);
1283: } else {
1284: System.out.print (" ");
1285: }
1286: }
1287: for (int j = 0; j < 16; j++) {
1288: if (i + j < sukDumpLength) {
1289: if (0x20 <= sukDumpBuffer[i + j] && sukDumpBuffer[i + j] <= 0x7e) {
1290: System.out.printf ("%c", 0xff & sukDumpBuffer[i + j]);
1291: } else {
1292: System.out.print (".");
1293: }
1294: } else {
1295: System.out.print (" ");
1296: }
1297: }
1298: System.out.println ();
1299: }
1300: }
1301: if (sukDataPhase == SPC_MSGIN_PHASE && phase == SPC_DATAOUT_PHASE) {
1302: sukDataPhase = -1;
1303: } else {
1304: sukDataPhase = phase;
1305: }
1306: sukDumpLength = 0;
1307: }
1308: }
1309:
1310:
1311:
1312: }