private void startReadTrack() { setExecutionMode(); clearRegs012(); this.sectorIdCyl = this.args[2]; this.sectorIdHead = this.args[3]; this.sectorIdRec = 1; this.sectorIdSizeCode = this.args[5]; this.curSectorReader = null; this.curSectorIdx = 0; this.tcEnabled = true; boolean done = false; FloppyDiskDrive drive = getArgDrive(); if (drive != null) { if (drive.isReady()) { this.dataLen = getArgDataLen(); this.executingDrive = drive; startIOTask( IOTaskCmd.READ_SECTOR_BY_INDEX, Math.max(this.tStatesPerRotation - this.tStateRotationCounter, 0)); done = true; } } if (!done) { this.statusReg0 |= ST0_ABNORMAL_TERMINATION; this.statusReg0 |= ST0_EQUIPMENT_CHECK; this.statusReg0 |= ST0_NOT_READY; this.statusReg0 |= (this.args[1] & HEAD_DRIVE_MASK); stopExecution(); } }
private void startReadID() { setExecutionMode(); clearRegs012(); clearSectorID(); boolean done = false; FloppyDiskDrive drive = getArgDrive(); if (drive != null) { if (drive.isReady()) { int idx = getSectorIndexByCurHeadPos(drive); if (idx >= 0) { this.executingDrive = drive; this.sectorIdRec = idx + 1; startIOTask(IOTaskCmd.READ_SECTOR_BY_INDEX, 0); done = true; } } } if (!done) { this.statusReg0 |= ST0_ABNORMAL_TERMINATION; this.statusReg0 |= ST0_EQUIPMENT_CHECK; this.statusReg0 |= ST0_NOT_READY; this.statusReg0 |= (this.args[1] & HEAD_DRIVE_MASK); stopExecution(); } }
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(); } }
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(); }
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(); } }
private void startReadDataOrScan() { setExecutionMode(); clearRegs012(); this.sectorIdCyl = this.args[2]; this.sectorIdHead = this.args[3]; this.sectorIdRec = this.args[4]; this.sectorIdSizeCode = this.args[5]; this.curSectorReader = null; this.tcEnabled = true; boolean done = false; FloppyDiskDrive drive = getArgDrive(); if (drive != null) { if (drive.isReady()) { if ((this.curCmd == Command.SCAN_EQUAL) || (this.curCmd == Command.SCAN_LOW_OR_EQUAL) || (this.curCmd == Command.SCAN_HIGH_OR_EQUAL)) { this.dataLen = 128; this.args[5] &= 0x0F; if (this.args[5] > 0) { this.dataLen = (128 << this.args[5]); } this.statusReg2 |= ST2_SCAN_EQUAL_HIT; } else { this.dataLen = getArgDataLen(); } this.executingDrive = drive; startIOTask(IOTaskCmd.READ_SECTOR_BY_ID, 0); done = true; } } if (!done) { this.statusReg0 |= ST0_ABNORMAL_TERMINATION; this.statusReg0 |= ST0_EQUIPMENT_CHECK; this.statusReg0 |= ST0_NOT_READY; this.statusReg0 |= (this.args[1] & HEAD_DRIVE_MASK); stopExecution(); } }