Exemple #1
0
 private void execIOReadSectorForWrite() {
   SectorData sector = null;
   FloppyDiskDrive drive = this.executingDrive;
   if (drive != null) {
     AbstractFloppyDisk disk = drive.getDisk();
     if (disk != null) {
       sector =
           drive.readSectorByID(
               getArgHead(),
               0,
               this.sectorIdCyl,
               this.sectorIdHead,
               this.sectorIdRec,
               this.sectorIdSizeCode);
     }
   }
   drive = getExecutingDrive();
   if (drive != null) {
     if (sector != null) {
       this.curSector = sector;
       this.dataPos = 0;
       setByteWritable(true);
     } else {
       this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
       this.statusReg1 |= ST1_NO_DATA;
       this.statusReg1 |= ST1_MISSING_ADDRESS_MARK;
       stopExecution();
     }
   }
 }
Exemple #2
0
 private int getSectorIndexByCurHeadPos(FloppyDiskDrive drive) {
   int idx = -1;
   if (drive != null) {
     AbstractFloppyDisk disk = drive.getDisk();
     if (disk != null) {
       int head = getArgHead();
       int cyl = drive.getCylinder();
       int spc = disk.getSectorsOfCylinder(cyl, head);
       int tpr = this.tStatesPerRotation;
       if ((spc > 0) && (tpr > 0) && (head < disk.getSides()) && (cyl < disk.getCylinders())) {
         idx = Math.round((float) this.tStateRotationCounter / (float) tpr * (float) spc);
         if (idx >= spc) {
           idx = spc - 1;
         }
       }
       if (idx < 0) {
         idx = 0;
       }
     }
   }
   return idx;
 }
Exemple #3
0
 private void execIOReadSectorByID() {
   boolean cmAbort = false;
   SectorData sector = null;
   FloppyDiskDrive drive = this.getExecutingDrive();
   if (drive != null) {
     AbstractFloppyDisk disk = drive.getDisk();
     if (disk != null) {
       int head = getArgHead();
       if (disk.supportsDeletedSectors()) {
         int startIdx = getSectorIndexByCurHeadPos(drive);
         if (startIdx >= 0) {
           boolean loop = true;
           int endIdx = -1;
           int curIdx = startIdx;
           while (loop && ((curIdx < endIdx) || (endIdx < 0))) {
             sector = drive.readSectorByIndex(head, curIdx);
             if ((sector == null) && (startIdx > 0)) {
               // zum Spuranfang springen
               endIdx = startIdx;
               startIdx = 0;
               curIdx = 0;
             } else {
               loop = false;
               if (sector != null) {
                 if (this.curCmd == Command.READ_DELETED_DATA) {
                   if (!sector.isDeleted()) {
                     this.statusReg2 |= ST2_CONTROL_MARK;
                     if ((this.args[0] & ARG0_SK_MASK) != 0) {
                       curIdx++;
                       loop = true;
                     } else {
                       cmAbort = true;
                     }
                   }
                 } else {
                   if (sector.isDeleted()) {
                     this.statusReg2 |= ST2_CONTROL_MARK;
                     if ((this.args[0] & ARG0_SK_MASK) != 0) {
                       curIdx++;
                       loop = true;
                     } else {
                       cmAbort = true;
                     }
                   }
                 }
                 if (!loop
                     && ((sector.getCylinder() != this.sectorIdCyl)
                         || (sector.getHead() != this.sectorIdHead)
                         || (sector.getSectorNum() != this.sectorIdRec)
                         || (sector.getSizeCode() != this.sectorIdSizeCode))) {
                   curIdx++;
                   loop = true;
                 }
               }
             }
           }
         }
       } else {
         sector =
             drive.readSectorByID(
                 head,
                 0,
                 this.sectorIdCyl,
                 this.sectorIdHead,
                 this.sectorIdRec,
                 this.sectorIdSizeCode);
       }
     }
   }
   drive = getExecutingDrive();
   if (drive != null) {
     if (sector != null) {
       if (sector.checkError()) {
         this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
         this.statusReg1 |= ST1_DATA_ERROR;
         this.statusReg2 |= ST2_DATA_ERROR_IN_DATA_FIELD;
       }
       this.curSector = sector;
       this.curSectorReader = sector.reader();
       this.remainBytes = this.dataLen;
       startIOReqTimer();
     } else {
       this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
       if (!cmAbort) {
         if ((this.sectorIdCyl == this.args[2])
             && (this.sectorIdHead == this.args[3])
             && (this.sectorIdRec == this.args[4])) {
           this.statusReg1 |= ST1_NO_DATA;
           this.statusReg1 |= ST1_MISSING_ADDRESS_MARK;
         } else {
           this.statusReg1 |= ST1_END_OF_CYLINDER;
         }
       }
       stopExecution();
     }
   }
 }