public bool Step(double us)
        {
            _us += us;

            /*if (_delay)
             * {
             *  if (_us >= DELAY_MILLISECS)
             *  {
             *      _us -= DELAY_MILLISECS;
             *      _delay = false;
             *  }
             *  else
             *  {
             *      return false;
             *  }
             * }*/

            var numSectors = _w.Disk.GetNumSectors(_updateSSO ? 1 : 0, _w.Track);

            if (_w.Sector > numSectors)
            {
                _w.RecordNotFound = true;
                _w.Interrupt();
                return(true);
            }
            var cylinder = _w.Track;
            var head     = _updateSSO ? 1 : 0;
            var sector   = _w.Sector;

            if (!_w.StatusPort.Ready)
            {
                _w.Data             = _w.Disk.Get(cylinder, head, sector, _sectorIdx);
                _w.StatusPort.Ready = true;
                _sectorIdx++;
            }

            if (_sectorIdx == _w.Disk.GetSectorSize(head, cylinder).Size)
            {
                if (_multipleRecords && _w.Sector <= numSectors)
                {
                    _w.Sector++;
                    _sectorIdx = 0;
                }
                else
                {
                    if (_w.Disk.GetDeleted(cylinder, head, _w.Sector))
                    {
                        _w.RecordType = true;
                    }

                    _w.Interrupt();
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
        public bool Step(double us)
        {
            _us += us;

            if (!_w.StatusPort.Ready)
            {
                if (_step == 0)
                {
                    _w.Sector = _steps[0];
                }

                _w.Data             = _steps[_step];
                _w.StatusPort.Ready = true;

                _step++;
            }

            if (_step == 6)
            {
                _w.Interrupt();
                return(true);
            }

            return(false);
        }
Beispiel #3
0
        public bool Step(double us)
        {
            _us += us;

            if (_us >= SEEK_TIME)
            {
                Console.WriteLine($"Seek from {_pos} to {_dest}, real track:{_w.Track}");
                if (_dest > _pos)
                {
                    _pos++;
                    _w.Track++;
                }
                else if (_dest < _pos)
                {
                    _pos--;
                    _w.Track--;
                }
                //_w.Track = _pos;
                _w.TrackRegister = _pos;
                _us -= SEEK_TIME;
            }

            if (_w.TrackRegister == _w.Data)
            {
                Console.WriteLine($"Seek done from {_start} to {_dest}, real track:{_w.Track}");
                _w.Interrupt();
                return(true);
            }

            return(false);
        }
Beispiel #4
0
        public bool Step(double us)
        {
            _us += us;

            if (_w.Track != 0)
            {
                if (_us >= _rate.Rate)
                {
                    _us -= _rate.Rate;
                    _w.Track--;
                }
            }

            if (_w.Track == 0)
            {
                _w.TrackRegister = 0;
                _w.Interrupt();
                return(true);
            }
            return(false);
        }