Beispiel #1
0
 private void execFormatTrackTask() {
   File file = this.ioFile;
   long pos = this.ioFilePos;
   int cnt = this.ioByteCnt;
   if ((file != null) && (pos >= 0) && (cnt > 0)) {
     boolean err = false;
     RandomAccessFile raf = null;
     try {
       raf = new RandomAccessFile(file, "rw");
       raf.seek(pos);
       while (cnt > 0) {
         raf.write(0);
         --cnt;
       }
       raf.close();
       raf = null;
     } catch (IOException ex) {
       err = true;
       if (!this.writeErrShown) {
         this.writeErrShown = true;
         EmuUtil.fireShowError(this.owner, null, ex);
       }
     } finally {
       EmuUtil.doClose(raf);
     }
     if (err) {
       this.errorReg = ERROR_UNCORRECTABLE_DATA;
       this.statusReg |= STATUS_ERROR;
     }
     fireInterrupt();
   }
 }
Beispiel #2
0
 private void execWriteSectorsTask() {
   File file = this.ioFile;
   long pos = this.ioFilePos;
   if (this.debugLevel > 3) {
     System.out.printf("GIDE io task: write sector, pos=%d", pos);
   }
   if ((file != null) && (pos >= 0)) {
     boolean err = false;
     RandomAccessFile raf = null;
     try {
       raf = new RandomAccessFile(file, "rw");
       raf.seek(pos);
       raf.write(this.ioBuf, 0, SECTOR_SIZE);
       raf.close();
       raf = null;
     } catch (IOException ex) {
       err = true;
       if (!this.writeErrShown) {
         this.writeErrShown = true;
         EmuUtil.fireShowError(this.owner, null, ex);
       }
     } finally {
       EmuUtil.doClose(raf);
     }
     if (err) {
       this.errorReg = ERROR_UNCORRECTABLE_DATA;
       this.statusReg |= STATUS_ERROR;
       if (this.debugLevel > 3) {
         System.out.println("GIDE io task: write sector: error");
       }
     } else {
       this.ioBufPos = 0;
       countSector();
       if (this.sectorCnt > 0) {
         fireInterrupt();
       } else {
         this.statusReg = STATUS_SEEK_COMPLETE | STATUS_DRIVE_READY;
       }
       if (this.debugLevel > 3) {
         System.out.println("GIDE io task: write sector: ok");
       }
     }
   }
 }