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 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; }
private void startIOReqTimer() { this.tStatesTillIOReq = Math.min(this.tStatesPerMilli / 100, 1); }