# More Apple Secrets — source transcripts, page 2

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-more-apple-secrets-1986-7340d6/2)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### PDF page 12

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-more-apple-secrets-1986-7340d6/2#scan-498e2c82192e617ed9290c518037ab931a864af3f6ec8f3ad398d373ed57aaf7)

Transcribed text:

numbering is important, because that is precisely the order in which DOS reserves the sectors
of a track when creating a file.
How Disk Reading Works
The key routine is the   DOS   Read/Write TracldSector (RWTS) routine. For any program to
read a sector of data, the program makes a machine language subroutine call (JSR) to   RWTS,
supplying a parameter list containing the desired slot, drive, track, (logical) sector, volume
number, and the data's memory address. The   DOS   3.3 File Manager is the most common caller
ofRWTS.
When called, the   RWTS   first turns the disk drive on, if necessary. Once on, the disk drive
keeps turning. Next, the   RWTS   positions the read/write head to the correct track and then waits
for the desired logical sector to rotate under the head. (It looks at the address headers for a
match on the corresponding physical sector.)
Then the RWTS transfers 342 bytes of encoded raw data from the disk into a special area of
memory. The raw data is decoded into a normal 256-byte sector format and moved to the
memory location specified by the caller. The same general sequence occurs on a write, except
that the data is moved from the caller's memory location, encoded into raw data, and then
transferred to the disk.
As you can imagine, this process takes time -   much more time than the brief interval
between the end of one physical sector and the beginning of the next. The alternating spacing
of logical data sectors on a track allows time for RWTS to decode and move, and for the caller
ofRWTS   to process one sector, and then to resume reading the disk before the start of the next
logical sector has rotated past the disk's read/write head. This works great as long as the caller
ofRWTS   doesn't allow too much time to elapse before calling   RWTS   again.
Disk   1/0   Timing
A Disk II drive turns at   300   rotations per minute (5 rotations per second). With 16 sectors
per track, this rate is equivalent to   80   sectors per second.   In   reading every other physical
sector, the intersector time available for processing is therefore   l/80th   of a second, or 12.5
milliseconds.   RWTS   uses about seven milliseconds of this time itself for raw data decoding
and moving. This leaves only about five milliseconds of processing time for the caller of
RWTS   before the next logical sector of the current rack rotates into position under the
read/write head of the disk.
File Space
Files are created one sector at a time. As successive sectors are written, unused disk sectors
must be located and reserved before the data is actually transferred. This is necessary to ensure
that sectors of other files on the disk are not overwritten by the new file.
As the file is written, the   DOS   File Manager must remember which sectors were used, and
in   what order. For each file, the File Manager creates a track/sector list that records the track
and logical sector number of each successive sector of the file.
To choose which sector to allocate to a file, the File Manager first finds a track with some
unused sectors. Within that track, the File Manager starts looking for free sectors from sector
15 to sector   0.   Once a file is started on a given track, all free sectors on that track are allocated
to the file until there are none left Then a new track is selected. Thus, the   DOS   File Manager is
recording successive sectors of a file in exactly the order   (15-0)   for maximizing the speed of
file I/O.
Load   Performance
Now let's see how all the above information pertains to the performance of LOADs. The
standard   DOS   3.3   LOAD   function uses the File Manager, in conjunction with   RWTS,   to copy
data between the disk and the Apple's memory.   LOAD   reads the program file into memory in
exactly the same way as a user's program would read a text file. This process involves
6

Reading notes: Page ends mid-sentence at the LOAD performance section, so the reading order is incomplete.

Printed product names: DOS · DOS 3.3 · Disk II · Apple

Languages: English

[Original PDF page 12](https://www.vintageapple.net/files/388bedabfc5dfb0683b4007e3fd02f5ab604dc7ee806083e69c10ac655e14977/More_Apple_Secrets_1986.pdf#page=12)

[Previous transcribed scans](https://www.vintageapple.net/transcripts/media/va-more-apple-secrets-1986-7340d6/1.md)
