Esempio n. 1
0
 private void execIOReadSectorByIndex() {
   SectorData sector = null;
   FloppyDiskDrive drive = this.executingDrive;
   if (drive != null) {
     sector = drive.readSectorByIndex(getArgHead(), this.sectorIdRec - 1);
   }
   drive = getExecutingDrive();
   if (drive != null) {
     if (sector != null) {
       this.curSector = sector;
       this.curSectorReader = sector.reader();
       this.remainBytes = this.dataLen;
       if (this.curCmd == Command.READ_TRACK) {
         setByteReadable();
       } else {
         this.sectorIdCyl = sector.getCylinder();
         this.sectorIdHead = sector.getHead();
         this.sectorIdRec = sector.getSectorNum();
         this.sectorIdSizeCode = sector.getSizeCode();
         if (sector.isEmpty()) {
           this.statusReg1 |= ST1_MISSING_ADDRESS_MARK;
           this.statusReg2 |= ST2_MISSING_DATA_ADDRESS_MARK;
         }
         stopExecution();
       }
     } else {
       this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
       if (this.sectorIdRec == 1) {
         this.statusReg1 |= ST1_NO_DATA;
         this.statusReg1 |= ST1_MISSING_ADDRESS_MARK;
       } else {
         this.statusReg1 |= ST1_END_OF_CYLINDER;
       }
       stopExecution();
     }
   }
 }
Esempio n. 2
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();
     }
   }
 }