HDC.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18: package xeij;
19:
20: import java.awt.event.*;
21: import java.io.*;
22: import java.lang.*;
23: import java.util.*;
24: import java.util.zip.*;
25: import javax.swing.*;
26:
27: public class HDC {
28:
29: public static final boolean HDC_DEBUG_TRACE = false;
30: public static final boolean HDC_DEBUG_COMMAND = false;
31: public static final boolean HDC_DEBUG_UNIMPLEMENTED_COMMAND = true;
32:
33: public static final int HDC_BASE = 0x00e96000;
34: public static final int HDC_DATA_PORT = 0x00e96001;
35: public static final int HDC_STATUS_PORT = 0x00e96003;
36: public static final int HDC_RESET_PORT = 0x00e96005;
37: public static final int HDC_SELECTION_PORT = 0x00e96007;
38:
39: public static final int HDC_STATUS_MESSAGE = 0b10000;
40: public static final int HDC_STATUS_C_D = 0b01000;
41: public static final int HDC_STATUS_COMMAND = 0b01000;
42: public static final int HDC_STATUS_DATA = 0b00000;
43: public static final int HDC_STATUS_I_O = 0b00100;
44: public static final int HDC_STATUS_OUTPUT = 0b00000;
45: public static final int HDC_STATUS_INPUT = 0b00100;
46: public static final int HDC_STATUS_BUSY = 0b00010;
47: public static final int HDC_STATUS_FREE = 0b00000;
48: public static final int HDC_STATUS_REQUEST = 0b00001;
49:
50: public static final String[] HDC_COMMAND_NAME = (
51: "TestDriveReady" + "," +
52: "Recalibrate" + "," +
53: "" + "," +
54: "RequestSenseStatus" + "," +
55: "FormatDrive" + "," +
56: "CheckTrackFormat" + "," +
57: "FormatBlock" + "," +
58: "BadTrackFormat" + "," +
59: "Read" + "," +
60: "" + "," +
61: "Write" + "," +
62: "Seek" + "," +
63: "InitializeDriveCharacteristic" + "," +
64: "LastCorrectedBurstLength" + "," +
65: "AssignTrack" + "," +
66: "WriteSectorBuffer" + "," +
67: "ReadSectorBuffer" + "," +
68:
69: ",,,,,,,,,,,,,,," +
70: ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," +
71: ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," +
72: ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," +
73: ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," +
74: ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," +
75: ",," +
76: "AssignDrive" + "," +
77: ",,,,,,,,,,,,,,,,,,,,,,,,,,,,," +
78: ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
79: ).split (",", 256);
80:
81:
82:
83:
84:
85:
86: public static final long HDC_DELAY_TIME = XEiJ.TMR_FREQ * 100 / 1000000;
87: public static final TickerQueue.Ticker hdcDelayTicker = new TickerQueue.Ticker () {
88: @Override protected void tick () {
89: HD63450.dmaFallREQ (1);
90: }
91: };
92:
93:
94:
95: public static JMenu hdcMenu;
96:
97:
98: public static javax.swing.filechooser.FileFilter hdcFileFilter;
99:
100:
101: public static OpenDialog hdcOpenDialog;
102: public static int hdcOpenUnit;
103: public static ArrayList<File[]> hdcOpenHistory;
104:
105:
106: public static JDialog hdcFormatDialog;
107: public static JFileChooser2 hdcFormatFileChooser;
108: public static HDMedia hdcFormatMedia;
109: public static boolean hdcFormatCopySystemFiles;
110:
111:
112: public static final HDUnit[] hdcUnitArray = new HDUnit[16];
113: public static int hdcHDMax;
114:
115: public static int hdcSelectedID;
116: public static int hdcSelectedLUN;
117: public static HDUnit hdcTargetUnit;
118: public static int hdcBusStatus;
119:
120: public static byte[] hdcReadHandle;
121: public static byte[] hdcWriteHandle;
122: public static int hdcIndex;
123: public static int hdcLimit;
124: public static final byte[] hdcCommandBuffer = new byte[6];
125: public static final byte[] hdcStatusBuffer = new byte[1];
126: public static final byte[] hdcMessageBuffer = new byte[1];
127: public static final byte[] hdcSenseBuffer = new byte[4];
128: public static final byte[] hdcAssignDriveBuffer = new byte[10];
129:
130: public static int hdcLastFormatBlodkEnd;
131:
132: public static JCheckBoxMenuItem hdcSASIMenuItem;
133:
134:
135:
136: public static void hdcInit () {
137:
138:
139:
140:
141: hdcFileFilter = new javax.swing.filechooser.FileFilter () {
142: @Override public boolean accept (File file) {
143: if (file.isDirectory ()) {
144: return true;
145: }
146: if (!file.isFile ()) {
147: return false;
148: }
149: String path = file.getPath ();
150: if (hdcIsInserted (path)) {
151: return false;
152: }
153: long longLength = file.length ();
154: for (HDMedia media : HDMedia.HDM_ARRAY) {
155: if (media.humDiskEndByte == longLength) {
156: return true;
157: }
158: }
159: return false;
160: }
161: @Override public String getDescription () {
162: return (Multilingual.mlnJapanese ?
163: "SASI ハードディスクのイメージファイル (*.HDF)" :
164: "SASI hard disk image files (*.HDF)");
165: }
166: };
167:
168:
169: hdcOpenDialog = null;
170: hdcOpenUnit = 0;
171: hdcOpenHistory = new ArrayList<File[]> ();
172: for (int i = JFileChooser2.MAXIMUM_HISTORY_COUNT - 1; 0 <= i; i--) {
173: hdcAddHistory (JFileChooser2.pathsToFiles (Settings.sgsGetString ("sahistory" + i)));
174: }
175:
176:
177:
178:
179: hdcHDMax = 0;
180: for (int u = 0; u < 16; u++) {
181: HDUnit unit = hdcUnitArray[u] = new HDUnit (u);
182: if (u == 0) {
183: unit.connect (false);
184: }
185: String path = Settings.sgsGetString ("sa" + u);
186: String hdN = Settings.sgsGetString ("hd" + u);
187: if (!(hdN.equals ("") || hdN.equals ("none"))) {
188: String hdNWithoutR = hdN.endsWith (":R") || hdN.endsWith (":r") ? hdN.substring (0, hdN.length () - 2) : hdN;
189: int dotIndex = hdNWithoutR.lastIndexOf ('.');
190: String ext = dotIndex < 0 ? "" : hdNWithoutR.substring (dotIndex + 1);
191: if (ext.equalsIgnoreCase ("HDF") ||
192: HDMedia.hdmPathToMedia (hdNWithoutR, null) != null) {
193: path = hdN;
194: Settings.sgsPutString ("hd" + u, "");
195: }
196: }
197: boolean userWriteProtect = false;
198: if (path.toUpperCase ().endsWith (":R")) {
199: path = path.substring (0, path.length () - 2);
200: userWriteProtect = true;
201: }
202: boolean hostWriteProtect = !new File (path).canWrite ();
203: if (path.length () != 0) {
204: unit.connect (true);
205: if (unit.insert (path,
206: userWriteProtect || hostWriteProtect)) {
207: hdcAddHistory (new File (path).getAbsoluteFile ());
208: }
209: }
210: }
211:
212:
213: hdcFormatDialog = null;
214: hdcFormatFileChooser = null;
215: hdcFormatMedia = HDMedia.HDM_40MB;
216: hdcFormatCopySystemFiles = true;
217:
218: hdcSelectedID = -1;
219: hdcSelectedLUN = -1;
220: hdcTargetUnit = null;
221: hdcBusStatus = HDC_STATUS_FREE;
222:
223: hdcReadHandle = null;
224: hdcWriteHandle = null;
225: hdcIndex = 0;
226: hdcLimit = 0;
227:
228:
229:
230:
231:
232:
233: hdcLastFormatBlodkEnd = -1;
234:
235: }
236:
237:
238:
239: public static void hdcTini () {
240:
241:
242: for (HDUnit unit : hdcUnitArray) {
243: unit.hduTini ();
244: }
245:
246:
247:
248: if (hdcOpenDialog != null) {
249: Settings.sgsPutOnOff ("sareadonly", hdcOpenDialog.getReadOnly ());
250: Settings.sgsPutOnOff ("saappreboot", hdcOpenDialog.getReboot ());
251: ArrayList<String> pathsList = hdcOpenDialog.getHistory ();
252: int n = pathsList.size ();
253: for (int i = 0; i < n; i++) {
254: Settings.sgsPutString ("sahistory" + i, pathsList.get (i));
255: }
256: for (int i = n; i < 16; i++) {
257: Settings.sgsPutString ("sahistory" + i, "");
258: }
259: }
260:
261:
262: for (int u = 0; u < 16; u++) {
263: AbstractUnit unit = hdcUnitArray[u];
264: Settings.sgsPutString (
265: "sa" + u,
266: unit.abuConnected && unit.abuInserted ?
267: unit.abuWriteProtected ? unit.abuPath + ":R" : unit.abuPath :
268: "");
269: }
270:
271: }
272:
273: public static void hdcMakeMenu () {
274:
275:
276: ActionListener listener = new ActionListener () {
277: @Override public void actionPerformed (ActionEvent ae) {
278: Object source = ae.getSource ();
279: String command = ae.getActionCommand ();
280: switch (command) {
281: case "Create new SASI hard disk image files":
282: hdcOpenFormatDialog ();
283: break;
284: }
285: }
286: };
287:
288:
289: hdcMenu = ComponentFactory.createMenu ("SASI");
290: ComponentFactory.addComponents (
291: hdcMenu,
292: ComponentFactory.createHorizontalBox (
293: Multilingual.mlnText (
294: ComponentFactory.createLabel ("SASI hard disk"),
295: "ja", "SASI ハードディスク")),
296: ComponentFactory.createHorizontalSeparator ()
297: );
298: for (int u = 0; u < 16; u++) {
299: hdcMenu.add (hdcUnitArray[u].getMenuBox ());
300: }
301: ComponentFactory.addComponents (
302: hdcMenu,
303: ComponentFactory.createHorizontalSeparator (),
304: hdcSASIMenuItem = ComponentFactory.setEnabled (
305: Multilingual.mlnText (ComponentFactory.createCheckBoxMenuItem (!XEiJ.currentModel.isSCSI (), "Built-in SASI port", listener), "ja", "内蔵 SASI ポート"),
306: false),
307: ComponentFactory.createHorizontalSeparator (),
308: Multilingual.mlnText (ComponentFactory.createMenuItem ("Create new SASI hard disk image files", listener),
309: "ja", "SASI ハードディスクのイメージファイルの新規作成")
310: );
311:
312: }
313:
314:
315:
316: public static boolean hdcIsInserted (String path) {
317: for (HDUnit unit : hdcUnitArray) {
318: if (unit != null &&
319: unit.abuConnected &&
320: unit.abuInserted &&
321: unit.abuPath.equals (path)) {
322: return true;
323: }
324: }
325: return false;
326: }
327:
328: static class OpenDialog extends AbstractOpenDialog {
329: public OpenDialog () {
330: super (XEiJ.frmFrame,
331: "Open SASI hard disk image files",
332: "SASI ハードディスクのイメージファイルを開く",
333: false,
334: hdcFileFilter);
335: }
336: @Override public void openFiles (File[] files, boolean reboot) {
337: hdcOpenFiles (files, reboot);
338: }
339: }
340:
341:
342:
343: public static void hdcOpenFiles (File[] list, boolean reset) {
344: boolean success = true;
345: for (int u = hdcOpenUnit, k = 0; k < list.length; ) {
346: if (16 <= u) {
347: success = false;
348: break;
349: }
350: HDUnit unit = hdcUnitArray[u];
351: if (!unit.abuConnected) {
352: u++;
353: continue;
354: }
355: File file = list[k++];
356: if (!file.isFile ()) {
357: success = false;
358: continue;
359: }
360: if (!unit.insert (file.getPath (),
361: hdcOpenDialog.getReadOnly () || !file.canWrite ())) {
362: success = false;
363: continue;
364: }
365: u++;
366: }
367: if (success) {
368: hdcAddHistory (list);
369: if (reset) {
370: XEiJ.mpuReset (0x8000 | hdcOpenUnit << 8, -1);
371: }
372: }
373: }
374:
375:
376:
377:
378: public static void hdcMakeFormatDialog () {
379:
380:
381: ActionListener listener = new ActionListener () {
382: @Override public void actionPerformed (ActionEvent ae) {
383: switch (ae.getActionCommand ()) {
384: case JFileChooser.APPROVE_SELECTION:
385: case "Start formatting":
386: {
387: File[] list = hdcFormatFileChooser.getSelectedFiles ();
388: if (list.length > 0) {
389: hdcFormatDialog.setVisible (false);
390: if (!hdcFormatFiles (list)) {
391:
392: }
393: }
394: }
395: break;
396: case JFileChooser.CANCEL_SELECTION:
397: case "Cancel":
398: hdcFormatDialog.setVisible (false);
399: break;
400: case "10MB":
401: hdcFormatMedia = HDMedia.HDM_10MB;
402: break;
403: case "20MB":
404: hdcFormatMedia = HDMedia.HDM_20MB;
405: break;
406: case "40MB":
407: hdcFormatMedia = HDMedia.HDM_40MB;
408: break;
409: case "Copy system files":
410: hdcFormatCopySystemFiles = ((JCheckBox) ae.getSource ()).isSelected ();
411: break;
412: }
413: }
414: };
415:
416:
417: hdcMakeFormatFileChooser ();
418: hdcFormatFileChooser.setFileFilter (hdcFileFilter);
419: hdcFormatFileChooser.addActionListener (listener);
420:
421:
422: ButtonGroup mediaGroup = new ButtonGroup ();
423: hdcFormatDialog = Multilingual.mlnTitle (
424: ComponentFactory.createModalDialog (
425: XEiJ.frmFrame,
426: "Create new SASI hard disk image files",
427: ComponentFactory.createBorderPanel (
428: 0, 0,
429: ComponentFactory.createVerticalBox (
430: hdcFormatFileChooser,
431: ComponentFactory.createHorizontalBox (
432: Box.createHorizontalStrut (12),
433: Box.createHorizontalGlue (),
434: ComponentFactory.createRadioButtonMenuItem (mediaGroup, hdcFormatMedia == HDMedia.HDM_10MB, "10MB", listener),
435: ComponentFactory.createRadioButtonMenuItem (mediaGroup, hdcFormatMedia == HDMedia.HDM_20MB, "20MB", listener),
436: ComponentFactory.createRadioButtonMenuItem (mediaGroup, hdcFormatMedia == HDMedia.HDM_40MB, "40MB", listener),
437: Box.createHorizontalGlue (),
438: Box.createHorizontalStrut (12)
439: ),
440: Box.createVerticalStrut (12),
441: ComponentFactory.createHorizontalBox (
442: Box.createHorizontalStrut (12),
443: Box.createHorizontalGlue (),
444: Multilingual.mlnText (ComponentFactory.createCheckBox (hdcFormatCopySystemFiles, "Copy system files", listener), "ja", "システムファイルを転送する"),
445: Box.createHorizontalGlue (),
446: Box.createHorizontalStrut (12),
447: Multilingual.mlnText (ComponentFactory.createButton ("Start formatting", KeyEvent.VK_F, listener), "ja", "フォーマットを開始する"),
448: Box.createHorizontalStrut (12),
449: Multilingual.mlnText (ComponentFactory.createButton ("Cancel", KeyEvent.VK_C, listener), "ja", "キャンセル"),
450: Box.createHorizontalStrut (12)
451: ),
452: Box.createVerticalStrut (12)
453: )
454: )
455: ),
456: "ja", "SASI ハードディスクのイメージファイルの新規作成");
457:
458: }
459:
460:
461:
462: public static void hdcMakeFormatFileChooser () {
463: if (hdcFormatFileChooser == null) {
464: hdcFormatFileChooser = new JFileChooser2 ();
465:
466: hdcFormatFileChooser.setControlButtonsAreShown (false);
467: }
468: }
469:
470:
471:
472: public static void hdcOpenFormatDialog () {
473: if (hdcFormatDialog == null) {
474: hdcMakeFormatDialog ();
475: }
476: XEiJ.pnlExitFullScreen (true);
477: hdcFormatDialog.setVisible (true);
478: }
479:
480:
481:
482:
483: public static boolean hdcFormatFiles (File[] list) {
484: boolean success = true;
485: format:
486: {
487:
488: byte[] bb = new byte[(int) hdcFormatMedia.humDiskEndByte];
489: if (!hdcFormatMedia.hdmMakeFormatData (bb, hdcFormatCopySystemFiles)) {
490: success = false;
491: break format;
492: }
493:
494: int u = 0;
495: for (File file : list) {
496: String path = file.getPath ();
497: if (true) {
498: if (!path.toUpperCase ().endsWith (".HDF")) {
499: path += path.endsWith (".") ? "hdf" : ".hdf";
500: file = new File (path);
501: }
502: }
503: if (hdcIsInserted (path)) {
504: success = false;
505: break format;
506: }
507: if (!XEiJ.rscPutFile (path, bb, 0, bb.length)) {
508: success = false;
509: break format;
510: }
511:
512: while (u < 16) {
513: HDUnit unit = hdcUnitArray[u++];
514: if (unit.abuConnected &&
515: !unit.abuInserted &&
516: unit.insert (path,
517: false)) {
518:
519: break;
520: }
521: }
522: }
523: }
524: if (success) {
525: hdcAddHistory (list);
526: }
527: return success;
528: }
529:
530:
531:
532:
533: public static void hdcAddHistory (File file) {
534: hdcAddHistory (new File[] { file });
535: }
536:
537:
538:
539: public static void hdcAddHistory (File[] files) {
540: if (hdcOpenDialog == null) {
541: hdcOpenHistory.add (files);
542: } else {
543: hdcOpenDialog.addHistory (files);
544: }
545: hdcMakeFormatFileChooser ();
546: hdcFormatFileChooser.addHistory (files);
547: hdcFormatFileChooser.selectLastFiles ();
548: }
549:
550:
551:
552:
553:
554:
555:
556:
557:
558:
559:
560:
561:
562:
563:
564:
565:
566:
567:
568:
569:
570:
571:
572:
573:
574:
575:
576:
577:
578:
579:
580:
581:
582:
583:
584:
585:
586:
587:
588:
589:
590:
591:
592:
593:
594:
595:
596:
597:
598:
599:
600:
601:
602:
603:
604:
605: public static int hdcPeekStatus () {
606: return hdcBusStatus;
607: }
608:
609:
610:
611: public static int hdcReadStatus () {
612: int d = hdcBusStatus;
613: if (HDC_DEBUG_TRACE) {
614: System.out.printf ("%08x hdcReadStatus(%d,%d)=%02x\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, d);
615: }
616: return d;
617: }
618:
619:
620:
621: public static void hdcWriteSelect (int d) {
622: d &= 255;
623: if (HDC_DEBUG_TRACE) {
624: System.out.printf ("%08x hdcWriteSelect(%02x)\n", XEiJ.regPC0, d);
625: }
626: if (d == 0) {
627: return;
628: }
629:
630: hdcSelectedID = Integer.numberOfTrailingZeros (d);
631: hdcSelectedLUN = -1;
632: hdcBusStatus = HDC_STATUS_BUSY;
633: }
634:
635:
636:
637: public static void hdcWriteCommand (int d) {
638: d &= 255;
639: if (HDC_DEBUG_TRACE) {
640: System.out.printf ("%08x hdcWriteCommand(%d,%d,%02x)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, d);
641: }
642:
643: hdcWriteHandle = hdcCommandBuffer;
644: hdcIndex = 0;
645: hdcLimit = 6;
646: hdcBusStatus = HDC_STATUS_COMMAND | HDC_STATUS_OUTPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST;
647: HD63450.dmaFallREQ (1);
648: }
649:
650:
651:
652: public static void hdcWriteReset (int d) {
653: d &= 255;
654: if (HDC_DEBUG_TRACE) {
655: System.out.printf ("%08x hdcWriteReset(%d,%d,%02x)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, d);
656: }
657:
658: hdcBusFreePhase ();
659: }
660:
661:
662:
663: public static int hdcPeekData () {
664: return (hdcReadHandle == null ? 0 :
665: hdcReadHandle[hdcIndex] & 255);
666: }
667:
668:
669:
670: public static int hdcReadData () {
671: if (hdcReadHandle == null) {
672: if (HDC_DEBUG_TRACE) {
673: System.out.printf ("%08x hdcReadData(%d,%d)=%02x\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, 0);
674: }
675: return 0;
676: }
677: int d = hdcReadHandle[hdcIndex++] & 255;
678: HD63450.dmaRiseREQ (1);
679: if (HDC_DEBUG_TRACE) {
680: System.out.printf ("%08x hdcReadData(%d,%d)=%02x\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, d);
681: }
682: if (hdcIndex < hdcLimit) {
683: HD63450.dmaFallREQ (1);
684: } else if (hdcBusStatus == (HDC_STATUS_INPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST)) {
685:
686: hdcStatusPhase (0, 0);
687: } else if (hdcBusStatus == (HDC_STATUS_COMMAND | HDC_STATUS_INPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST)) {
688:
689: hdcReadHandle = hdcMessageBuffer;
690: hdcWriteHandle = null;
691: hdcIndex = 0;
692: hdcLimit = 1;
693: hdcBusStatus = HDC_STATUS_MESSAGE | HDC_STATUS_COMMAND | HDC_STATUS_INPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST;
694: HD63450.dmaFallREQ (1);
695: } else {
696:
697: hdcBusFreePhase ();
698: IOInterrupt.ioiHdcFall ();
699: IOInterrupt.ioiHdcRise ();
700: }
701: return d;
702: }
703:
704:
705:
706: public static void hdcWriteData (int d) {
707: d &= 255;
708: if (HDC_DEBUG_TRACE) {
709: System.out.printf ("%08x hdcWriteData(%d,%d,%02x)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, d);
710: }
711: if (hdcWriteHandle == null) {
712: return;
713: }
714: hdcWriteHandle[hdcIndex++] = (byte) d;
715: HD63450.dmaRiseREQ (1);
716: if (hdcIndex < hdcLimit) {
717: HD63450.dmaFallREQ (1);
718: } else if (hdcBusStatus == (HDC_STATUS_OUTPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST)) {
719: if (hdcWriteHandle == hdcAssignDriveBuffer) {
720: if (HDC_DEBUG_COMMAND) {
721: System.out.printf ("%08x SASI AssignDrive[", XEiJ.regPC0);
722: for (int i = 0; i < 10; i++) {
723: if (i > 0) {
724: System.out.print (',');
725: }
726: System.out.printf ("0x%02x", hdcAssignDriveBuffer[i] & 255);
727: }
728: System.out.println (']');
729: }
730:
731: }
732:
733: hdcStatusPhase (0, 0);
734: } else {
735: int cmd = hdcCommandBuffer[0] & 255;
736: if (HDC_DEBUG_COMMAND) {
737: String name = cmd < HDC_COMMAND_NAME.length ? HDC_COMMAND_NAME[cmd] : "";
738: if (name.length () == 0) {
739: name = "???";
740: }
741: System.out.printf ("%08x SASI %s(", XEiJ.regPC0, name);
742: for (int i = 0; i < hdcLimit; i++) {
743: if (i > 0) {
744: System.out.print (',');
745: }
746: System.out.printf ("0x%02x", hdcCommandBuffer[i] & 255);
747: }
748: System.out.println (')');
749: }
750: hdcSelectedLUN = hdcCommandBuffer[1] >> 5 & 7;
751: if (hdcSelectedLUN > 1) {
752:
753: hdcSenseBuffer[0] = 0x20;
754: hdcStatusPhase (2, 0);
755: return;
756: }
757: hdcTargetUnit = hdcUnitArray[hdcSelectedID << 1 | hdcSelectedLUN];
758: if (!hdcTargetUnit.abuInserted) {
759:
760: hdcSenseBuffer[0] = 0x20;
761: hdcStatusPhase (2, 0);
762: return;
763: }
764: if (hdcLastFormatBlodkEnd >= 0 && cmd != 0x06) {
765: HDMedia media = HDMedia.hdmLengthToMedia (hdcLastFormatBlodkEnd);
766: if (media != null) {
767: hdcTargetUnit.hduMedia = media;
768:
769: }
770: hdcLastFormatBlodkEnd = -1;
771: }
772: switch (cmd) {
773: case 0x00:
774: hdcDoTestDriveReady ();
775: break;
776: case 0x01:
777: hdcDoRecalibrate ();
778: break;
779: case 0x03:
780: hdcDoRequestSenseStatus ();
781: break;
782: case 0x04:
783: hdcDoFormatDrive ();
784: break;
785:
786: case 0x06:
787: hdcDoFormatBlock ();
788: break;
789:
790: case 0x08:
791: hdcDoRead ();
792: break;
793: case 0x0a:
794: hdcDoWrite ();
795: break;
796: case 0x0b:
797: hdcDoSeek ();
798: break;
799:
800:
801:
802:
803:
804: case 0xc2:
805: hdcDoAssignDrive ();
806: break;
807: default:
808: if (HDC_DEBUG_UNIMPLEMENTED_COMMAND) {
809: StringBuilder sb = new StringBuilder ();
810: String name = cmd < HDC_COMMAND_NAME.length ? HDC_COMMAND_NAME[cmd] : "";
811: if (name.length () == 0) {
812: name = "???";
813: }
814: sb.append (String.format ("%08x SASI %s(", XEiJ.regPC0, name));
815: for (int i = 0; i < hdcLimit; i++) {
816: if (i > 0) {
817: sb.append (',');
818: }
819: sb.append (String.format ("0x%02x", hdcCommandBuffer[i] & 255));
820: }
821: sb.append (')');
822: System.out.println (sb.toString ());
823: }
824:
825: hdcSenseBuffer[0] = 0x20;
826: hdcStatusPhase (2, 0);
827: }
828: }
829: }
830:
831:
832: public static void hdcDoTestDriveReady () {
833: if (HDC_DEBUG_TRACE) {
834: System.out.printf ("%08x hdcDoTestDriveReady(%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN);
835: }
836:
837: hdcStatusPhase (0, 0);
838: }
839:
840:
841: public static void hdcDoRecalibrate () {
842: if (HDC_DEBUG_TRACE) {
843: System.out.printf ("%08x hdcDoRecalibrate(%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN);
844: }
845:
846: hdcStatusPhase (0, 0);
847: }
848:
849:
850: public static void hdcDoRequestSenseStatus () {
851: if (HDC_DEBUG_TRACE) {
852: System.out.printf ("%08x hdcDoRequestSenseStatus(%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN);
853: }
854:
855: hdcReadHandle = hdcSenseBuffer;
856: hdcIndex = 0;
857: hdcLimit = 4;
858: hdcBusStatus = HDC_STATUS_INPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST;
859: if (false) {
860: HD63450.dmaFallREQ (1);
861: } else {
862: TickerQueue.tkqAdd (hdcDelayTicker, XEiJ.mpuClockTime + HDC_DELAY_TIME);
863: }
864: }
865:
866:
867: public static void hdcDoFormatDrive () {
868: if (HDC_DEBUG_TRACE) {
869: System.out.printf ("%08x hdcDoFormatDrive(%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN);
870: }
871: if (!hdcTargetUnit.abuInserted || hdcTargetUnit.hduMedia == null ||
872: hdcTargetUnit.abuWriteProtected) {
873:
874: hdcSenseBuffer[0] = 0x20;
875: hdcStatusPhase (2, 0);
876: return;
877: }
878: hdcTargetUnit.hduWritten = true;
879:
880: Arrays.fill (hdcTargetUnit.hduImage, 0, (int) hdcTargetUnit.hduMedia.humDiskEndByte, (byte) 0);
881:
882: hdcStatusPhase (0, 0);
883: }
884:
885:
886:
887: public static void hdcDoFormatBlock () {
888: int i = (hdcCommandBuffer[1] & 31) << 16 | (char) (hdcCommandBuffer[2] << 8 | hdcCommandBuffer[3] & 255);
889: int n = 33;
890: if (HDC_DEBUG_TRACE) {
891: System.out.printf ("%08x hdcDoFormatBlock(%d,%d,%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, i, n);
892: }
893: if (!hdcTargetUnit.abuInserted || hdcTargetUnit.hduMedia == null ||
894: hdcTargetUnit.abuWriteProtected) {
895:
896: hdcSenseBuffer[0] = 0x20;
897: hdcStatusPhase (2, 0);
898: return;
899: }
900: int l = i + n;
901: if (hdcTargetUnit.hduMedia.hdmDiskEndRecord < l) {
902:
903: hdcSenseBuffer[0] = 0x21;
904: hdcStatusPhase (2, 0);
905: return;
906: }
907: int begin = hdcTargetUnit.hduMedia.hdmBytesPerRecord * i;
908: int end = hdcTargetUnit.hduMedia.hdmBytesPerRecord * l;
909: hdcLastFormatBlodkEnd = end;
910: hdcTargetUnit.hduWritten = true;
911:
912: Arrays.fill (hdcTargetUnit.hduImage, begin, end, (byte) 0);
913:
914: hdcStatusPhase (0, 0);
915: }
916:
917:
918: public static void hdcDoRead () {
919: int i = (hdcCommandBuffer[1] & 31) << 16 | (char) (hdcCommandBuffer[2] << 8 | hdcCommandBuffer[3] & 255);
920: int n = hdcCommandBuffer[4] & 255;
921: if (n == 0) {
922: n = 256;
923: }
924: if (HDC_DEBUG_TRACE) {
925: System.out.printf ("%08x hdcDoRead(%d,%d,%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, i, n);
926: }
927: if (!hdcTargetUnit.abuInserted || hdcTargetUnit.hduMedia == null) {
928:
929: hdcSenseBuffer[0] = 0x20;
930: hdcStatusPhase (2, 0);
931: return;
932: }
933: int l = i + n;
934: if (hdcTargetUnit.hduMedia.hdmDiskEndRecord < l) {
935:
936: hdcSenseBuffer[0] = 0x21;
937: hdcStatusPhase (2, 0);
938: return;
939: }
940:
941: hdcReadHandle = hdcTargetUnit.hduImage;
942: hdcIndex = hdcTargetUnit.hduMedia.hdmBytesPerRecord * i;
943: hdcLimit = hdcTargetUnit.hduMedia.hdmBytesPerRecord * l;
944: hdcBusStatus = HDC_STATUS_INPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST;
945: if (false) {
946: HD63450.dmaFallREQ (1);
947: } else {
948: TickerQueue.tkqAdd (hdcDelayTicker, XEiJ.mpuClockTime + HDC_DELAY_TIME);
949: }
950: }
951:
952:
953: public static void hdcDoWrite () {
954: int i = (hdcCommandBuffer[1] & 31) << 16 | (char) (hdcCommandBuffer[2] << 8 | hdcCommandBuffer[3] & 255);
955: int n = hdcCommandBuffer[4] & 255;
956: if (n == 0) {
957: n = 256;
958: }
959: if (HDC_DEBUG_TRACE) {
960: System.out.printf ("%08x hdcDoWrite(%d,%d,%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, i, n);
961: }
962: if (!hdcTargetUnit.abuInserted || hdcTargetUnit.hduMedia == null ||
963: hdcTargetUnit.abuWriteProtected) {
964:
965: hdcSenseBuffer[0] = 0x20;
966: hdcStatusPhase (2, 0);
967: return;
968: }
969: int l = i + n;
970: if (hdcTargetUnit.hduMedia.hdmDiskEndRecord < l) {
971:
972: hdcSenseBuffer[0] = 0x21;
973: hdcStatusPhase (2, 0);
974: return;
975: }
976: hdcTargetUnit.hduWritten = true;
977:
978: hdcWriteHandle = hdcTargetUnit.hduImage;
979: hdcIndex = hdcTargetUnit.hduMedia.hdmBytesPerRecord * i;
980: hdcLimit = hdcTargetUnit.hduMedia.hdmBytesPerRecord * l;
981: hdcBusStatus = HDC_STATUS_OUTPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST;
982: if (false) {
983: HD63450.dmaFallREQ (1);
984: } else {
985: TickerQueue.tkqAdd (hdcDelayTicker, XEiJ.mpuClockTime + HDC_DELAY_TIME);
986: }
987: }
988:
989:
990: public static void hdcDoSeek () {
991: int i = (hdcCommandBuffer[1] & 31) << 16 | (char) (hdcCommandBuffer[2] << 8 | hdcCommandBuffer[3] & 255);
992: if (HDC_DEBUG_TRACE) {
993: System.out.printf ("%08x hdcDoSeek(%d,%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN, i);
994: }
995: if (!hdcTargetUnit.abuInserted || hdcTargetUnit.hduMedia == null) {
996:
997: hdcSenseBuffer[0] = 0x20;
998: hdcStatusPhase (2, 0);
999: return;
1000: }
1001: if (hdcTargetUnit.hduMedia.hdmDiskEndRecord <= i) {
1002:
1003: hdcSenseBuffer[0] = 0x21;
1004: hdcStatusPhase (2, 0);
1005: return;
1006: }
1007:
1008: hdcStatusPhase (0, 0);
1009: }
1010:
1011:
1012: public static void hdcDoAssignDrive () {
1013: if (HDC_DEBUG_TRACE) {
1014: System.out.printf ("%08x hdcDoAssignDrive(%d,%d)\n", XEiJ.regPC0, hdcSelectedID, hdcSelectedLUN);
1015: }
1016:
1017: hdcWriteHandle = hdcAssignDriveBuffer;
1018: hdcIndex = 0;
1019: hdcLimit = 10;
1020: hdcBusStatus = HDC_STATUS_OUTPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST;
1021: if (false) {
1022: HD63450.dmaFallREQ (1);
1023: } else {
1024: TickerQueue.tkqAdd (hdcDelayTicker, XEiJ.mpuClockTime + HDC_DELAY_TIME);
1025: }
1026: }
1027:
1028:
1029:
1030:
1031:
1032: public static void hdcStatusPhase (int status, int message) {
1033: hdcStatusBuffer[0] = (byte) status;
1034: hdcMessageBuffer[0] = (byte) message;
1035: hdcReadHandle = hdcStatusBuffer;
1036: hdcWriteHandle = null;
1037: hdcIndex = 0;
1038: hdcLimit = 1;
1039: hdcBusStatus = HDC_STATUS_COMMAND | HDC_STATUS_INPUT | HDC_STATUS_BUSY | HDC_STATUS_REQUEST;
1040: HD63450.dmaFallREQ (1);
1041: }
1042:
1043:
1044:
1045: public static void hdcBusFreePhase () {
1046: hdcSelectedID = -1;
1047: hdcSelectedLUN = -1;
1048: hdcTargetUnit = null;
1049: hdcBusStatus = HDC_STATUS_FREE;
1050: hdcReadHandle = null;
1051: hdcWriteHandle = null;
1052: hdcIndex = 0;
1053: hdcLimit = 0;
1054: HD63450.dmaRiseREQ (1);
1055: }
1056:
1057:
1058:
1059:
1060:
1061:
1062:
1063:
1064:
1065:
1066:
1067:
1068:
1069:
1070:
1071:
1072:
1073:
1074:
1075:
1076:
1077:
1078:
1079:
1080:
1081:
1082:
1083:
1084:
1085:
1086:
1087:
1088:
1089:
1090:
1091:
1092:
1093:
1094:
1095:
1096:
1097:
1098:
1099:
1100:
1101:
1102:
1103:
1104:
1105:
1106:
1107:
1108:
1109:
1110:
1111:
1112:
1113:
1114:
1115:
1116:
1117:
1118:
1119:
1120:
1121:
1122:
1123:
1124:
1125:
1126:
1127:
1128:
1129:
1130:
1131:
1132:
1133:
1134:
1135: public static final byte[] HDC_DISK_IPL = "`\0\0\312\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\32\33[6;32HX68000 HARD DISK IPL MENU\33[25;22H\203J\201[\203\\\203\213\203L\201[\202\305\221I\221\360\202\265\202\304\203\212\203^\201[\203\223\203L\201[\202\360\211\237\202\265\202\304\202\255\202\276\202\263\202\242\0\33[26;28H\221I\221\360\202\265\202\275\202\340\202\314\202\360\216\251\223\256\213N\223\256\202\306\202\265\202\304\223o\230^\202\265\202\334\202\267\0\0O\372\3772B\205 <\0\0\0\216NO\36\0\341Gt\4&<\0\0\1\0C\372\2\306a\0\0022J\0f\0\1jC\372\2\270G\372\377\n\f\221X68Kf\0\1lt\16BCBDB\206C\351\0\20J\21g\26RF&\311\20)\0\b\b\0\0\0f\bRCJ\0f\2RDQ\312\377\340JCg\0\1Br\np\4NO\b\0\0\4f\22JDg\16SDg\34C\372\376\364a\0\1\304`(C\372\376\352a\0\1\272C\372\377>a\0\1\262`\24G\372\376\234 [$(\0\bJ(\0\bf\364`\0\0\276z\2BCE\372\376\204\"R\20)\0\bg\n\260\5g\6r\2a\0\1va\0\1\26X\212RC\266Fe\342`*a\0\1\6a\0\0\362\260<\0\35g:\260<\0005g\f\260<\0<g\32\260<\0>f\344a\0\0\350RC\266Fe\2BCa\0\0\262f\362`\314a\0\0\324SCj\0046\6SCa\0\0\236f\362`\270G\372\376\30\345C s0\0$(\0\bJ\5g:C\372\1\270r\16C\351\0\20J)\377\370g\22 \21\b\0\0\30f\nB\21\264\200g\4\22\274\0\2Q\311\377\342/\2t\4&<\0\0\1\0C\372\1\200a\0\0\350$\37\304\274\0\377\377\377&<\0\0\4\0C\372\375\274\323\374\0\0\4\0a\0\0\320J\0f\b\f\21\0`f\"N\321E\372\0\332C\372\0\314a\0\0\256\"Ja\0\0\250`\376E\372\0\343`\352E\372\0\372`\344E\372\1\21`\336A\372\375\200 \3\345@ p\0\0\20(\0\b\260\5g\2J\0NuB\200NO\340H\260<\0Nf\2p\35NuaZC\372\375V0\3\345@C\361\0\0r$t\t\324Cp#NO\"Qr(aF$\tA\372\0\342\224\210\350\212\204\374\0\n\324\274\0000\0000r \264|\0000g\0022\2a&HB2\2a r)a\34r a\30t\7BA\22\31a\20Q\312\377\370r\3`\2r\13p\"NONup NONup!NONupE`\2pFH\347x@2\7NOL\337\2\36Nu\32\33[16;33H\0 \203n\201[\203h\203f\203B\203X\203N\202\252\223\307\202\337\202\334\202\271\202\361\0 \212\307\227\235\203u\203\215\203b\203N\202\252\211\363\202\352\202\304\202\242\202\334\202\267\0 \213N\223\256\211\302\224\\\202\310\227\314\210\346\202\252\202\240\202\350\202\334\202\271\202\361\0\202h\202o\202k\203u\203\215\203b\203N\202\314\223\340\227e\202\252\210\331\217\355\202\305\202\267\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0".getBytes (XEiJ.ISO_8859_1);
1136:
1137:
1138:
1139:
1140:
1141:
1142:
1143:
1144:
1145:
1146:
1147:
1148:
1149:
1150:
1151:
1152:
1153:
1154:
1155:
1156:
1157:
1158:
1159:
1160:
1161:
1162:
1163:
1164:
1165:
1166:
1167:
1168:
1169:
1170:
1171:
1172:
1173:
1174:
1175:
1176:
1177:
1178:
1179:
1180:
1181:
1182:
1183:
1184:
1185:
1186:
1187:
1188:
1189:
1190:
1191:
1192:
1193:
1194:
1195:
1196:
1197:
1198:
1199:
1200:
1201:
1202:
1203:
1204:
1205:
1206:
1207:
1208:
1209: public static final byte[] HDC_PARTITION_IPL = "` Hudson soft 2.00\4\0\1\2\0\1\2\0\'r\370\24\0\0\0\0O\372\377\334C\372\0014a\0\1* <\0\0\0\216NO\22\0\341AB\202\24:\377\337B\200\20:\377\321\304\300B\2000:\377\312\324\200\345\202\324\272\377\312&<\0\0\4\0C\372\1\232a\0\0\310J\0f\0\0\320C\372\1\214<<\0\37$IG\372\1u~\n\20\32\200<\0 \260\33f\6Q\317\377\364`\24\323\374\0\0\0 Q\316\377\340C\372\0\310a\0\0\274`\376B\2000)\0\32\341XU@B\207\36:\377h\300\307\345\200\324\200B\2000:\377`\353\200\320\274\0\0\3\377\340\210\344\210\345\200\324\200H\347`\0C\372\1(&<\0\0\1\0aPL\337\0\6J\0fVC\372\1\24\fYHUfVT\211\f\231\0\0h\0fV/\31&\31\326\231/\3/\31\"|\0\0g\300\326\274\0\0\0@a\34\"\37$\37\"_J\0f A\371\0\0h\0\321\302S\201e\4B\30`\370N\321H\347x@pFNOL\337\2\36NuC\372\0Ha\30`\0\377\\C\372\0]a\16`\0\377RC\372\0ua\4`\0\377Hp!NONu\32\0\33[16;35HHuman.sys \202\252 \214\251\202\302\202\251\202\350\202\334\202\271\202\361\0\33[16;38H\203f\203B\203X\203N\202\252\201@\223\307\202\337\202\334\202\271\202\361\0\33[16;36HHuman.sys \202\252 \211\363\202\352\202\304\202\242\202\334\202\267\0\33[16;33HHuman.sys \202\314 \203A\203h\203\214\203X\202\252\210\331\217\355\202\305\202\267\0human sys\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0".getBytes (XEiJ.ISO_8859_1);
1210:
1211:
1212:
1213:
1214:
1215:
1216: public static class HDUnit extends AbstractUnit {
1217:
1218: public HDMedia hduMedia;
1219: public byte[] hduImage;
1220: public boolean hduWritten;
1221:
1222:
1223:
1224: public HDUnit (int number) {
1225: super (number);
1226: hduImage = null;
1227: hduWritten = false;
1228: }
1229:
1230:
1231:
1232:
1233: public void hduTini () {
1234: if (abuInserted) {
1235: hduFlush ();
1236: }
1237: }
1238:
1239:
1240:
1241: public boolean hduFlush () {
1242: if (!hduWritten) {
1243: return true;
1244: }
1245: if (abuWriteProtected) {
1246: return false;
1247: }
1248: if (!XEiJ.rscPutFile (abuPath, hduImage, 0, (int) hduMedia.humDiskEndByte)) {
1249: return false;
1250: }
1251: hduWritten = false;
1252: return true;
1253: }
1254:
1255:
1256:
1257: @Override protected void connect (boolean disconnectable) {
1258: super.connect (disconnectable);
1259: hduImage = new byte[HDMedia.HDM_MAX_BYTES_PER_DISK];
1260: hduWritten = false;
1261: }
1262:
1263:
1264:
1265: @Override protected void disconnect () {
1266: super.disconnect ();
1267: hduImage = null;
1268: }
1269:
1270:
1271:
1272: @Override protected boolean eject () {
1273: if (!hduFlush ()) {
1274: return false;
1275: }
1276: String path = abuPath;
1277: if (!super.eject ()) {
1278: return false;
1279: }
1280: if (hduMedia != null) {
1281: hdcAddHistory (new File (path).getAbsoluteFile ());
1282: System.out.println (Multilingual.mlnJapanese ?
1283: path + " を sa" + abuNumber + " から切り離しました" :
1284: path + " was removed from sa" + abuNumber);
1285: }
1286: hduMedia = null;
1287:
1288: if (hdcHDMax == abuNumber - 1) {
1289: int u = abuNumber - 1;
1290: while (u >= 0 && !hdcUnitArray[u].abuInserted) {
1291: u--;
1292: }
1293: hdcHDMax = u + 1;
1294: }
1295: return true;
1296: }
1297:
1298:
1299:
1300: @Override protected boolean open () {
1301: if (!super.open ()) {
1302: return false;
1303: }
1304: hdcOpenUnit = abuNumber;
1305: if (hdcOpenDialog == null) {
1306: hdcOpenDialog = new OpenDialog ();
1307: hdcOpenDialog.setReadOnly (Settings.sgsGetOnOff ("sareadonly"));
1308: hdcOpenDialog.setReboot (Settings.sgsGetOnOff ("saappreboot"));
1309: for (File[] files : hdcOpenHistory) {
1310: hdcOpenDialog.addHistory (files);
1311: }
1312: hdcOpenHistory.clear ();
1313: }
1314: hdcOpenDialog.rescanCurrentDirectory ();
1315: XEiJ.pnlExitFullScreen (true);
1316: hdcOpenDialog.setVisible (true);
1317: return true;
1318: }
1319:
1320:
1321:
1322: @Override protected boolean insert (String path, boolean writeProtected) {
1323: if (hdcIsInserted (path)) {
1324: return false;
1325: }
1326: if (!super.insert (path, writeProtected)) {
1327: return false;
1328: }
1329:
1330: if (hdcHDMax <= abuNumber) {
1331: hdcHDMax = abuNumber + 1;
1332: }
1333: return true;
1334: }
1335:
1336:
1337:
1338: @Override protected boolean load (String path) {
1339: hduMedia = HDMedia.hdmPathToMedia (path, hduImage);
1340: if (hduMedia == null) {
1341: return false;
1342: }
1343: hduWritten = false;
1344: hdcAddHistory (new File (path).getAbsoluteFile ());
1345: System.out.println (Multilingual.mlnJapanese ?
1346: path + " を sa" + abuNumber + " に接続しました" :
1347: path + " was connected to sa" + abuNumber);
1348: return true;
1349: }
1350:
1351: }
1352:
1353:
1354:
1355: }
1356:
1357:
1358: