Example #1
0
 private void startFormatTrack() {
   setExecutionMode();
   clearRegs012();
   clearSectorID();
   boolean done = false;
   FloppyDiskDrive drive = getArgDrive();
   if (drive != null) {
     if (drive.isReady()) {
       if (drive.isReadOnly()) {
         this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
         this.statusReg1 |= ST1_NOT_WRITABLE;
       } else {
         setDataBuf(this.args[3] * 4);
         this.dataPos = -1;
         this.formatStatus = FormatStatus.WAIT_FOR_HOLE;
         this.executingDrive = drive;
         done = true;
       }
     }
   }
   if (!done) {
     if ((this.statusReg0 & ST0_ERROR_MASK) == 0) {
       this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
       this.statusReg0 |= ST0_EQUIPMENT_CHECK;
       this.statusReg0 |= ST0_NOT_READY;
     }
     this.statusReg0 |= (this.args[1] & HEAD_DRIVE_MASK);
     stopExecution();
   }
 }
Example #2
0
 private void execIOWriteSector() {
   FloppyDiskDrive drive = this.executingDrive;
   boolean done = false;
   SectorData sector = this.curSector;
   if (drive != null) {
     if ((sector != null) && (this.dataBuf != null) && (this.dataPos >= 0)) {
       this.curSector = null;
       while ((this.dataPos < this.dataLen) && (this.dataPos < this.dataBuf.length)) {
         this.dataBuf[this.dataPos++] = (byte) 0;
       }
       done =
           drive.writeSector(
               getArgHead(),
               sector,
               this.dataBuf,
               this.dataLen,
               this.curCmd == Command.WRITE_DELETED_DATA);
       this.dataPos = -1;
       drive = this.executingDrive;
       if (drive != null) {
         if (done) {
           incSectorNum();
           synchronized (this.ioTaskThread) {
             if (this.tcFired) {
               stopExecution();
             } else {
               startIOTask(IOTaskCmd.READ_SECTOR_FOR_WRITE, this.tStatesPerRotation);
             }
           }
         } else {
           this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
           if (drive.isReadOnly()) {
             this.statusReg1 |= ST1_NOT_WRITABLE;
           } else {
             this.statusReg1 |= ST1_DATA_ERROR;
             this.statusReg2 |= ST2_DATA_ERROR_IN_DATA_FIELD;
           }
           stopExecution();
         }
       }
     } else {
       if (this.tcFired) {
         stopExecution();
       }
     }
   }
 }
Example #3
0
 private void execSenseDriveStatus() {
   this.statusReg3 = (this.args[1] & HEAD_DRIVE_MASK);
   FloppyDiskDrive drive = getArgDrive();
   if (drive != null) {
     this.statusReg3 |= ST3_TWO_SIDE;
     if (drive.getCylinder() == 0) {
       this.statusReg3 |= ST3_TRACK_0;
     }
     if (drive.isReady()) {
       this.statusReg3 |= ST3_READY;
     }
     if (drive.isReadOnly()) {
       this.statusReg3 |= ST3_WRITE_PROTECTED;
     }
   }
   this.results[0] = this.statusReg3;
   this.resultIdx = 0;
   setResultMode();
 }
Example #4
0
 private void startWriteData() {
   setExecutionMode();
   clearRegs012();
   this.sectorIdCyl = this.args[2];
   this.sectorIdHead = this.args[3];
   this.sectorIdRec = this.args[4];
   this.sectorIdSizeCode = this.args[5];
   this.curSector = null;
   this.tcEnabled = true;
   boolean done = false;
   FloppyDiskDrive drive = getArgDrive();
   if (drive != null) {
     if (drive.isReady()) {
       if (drive.isReadOnly()) {
         this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
         this.statusReg1 |= ST1_NOT_WRITABLE;
       } else {
         if (!this.dmaMode) {
           this.statusRegMain |= STM_NON_DMA_MODE;
         }
         setDataBuf(getArgDataLen());
         this.dataPos = -1;
         this.executingDrive = drive;
         startIOTask(IOTaskCmd.READ_SECTOR_FOR_WRITE, 0);
         done = true;
       }
     }
   }
   if (!done) {
     if ((this.statusReg0 & ST0_ERROR_MASK) == 0) {
       this.statusReg0 |= ST0_ABNORMAL_TERMINATION;
       this.statusReg0 |= ST0_EQUIPMENT_CHECK;
       this.statusReg0 |= ST0_NOT_READY;
     }
     this.statusReg0 |= (this.args[1] & HEAD_DRIVE_MASK);
     stopExecution();
   }
 }