



















           Ŀ
                                                        
                      BENEATH DISK OPERATIONS           
                                                        
                    FOR IBM  PCs AND COMPATIBLES        
                                                        
           





                           Jean J. DRABBE
                       University of Brussels
                     Department of Mathematics
                      Campus Plaine - CP 211
                      1050 Brussels - BELGIUM







TRADEMARK INFORMATION




Disk Explorer is a registered trademark of Quaid Software Limited

Flu_shot+ is a registered trademark of Software Concepts Design

IBM is a registered trademark of Internation Business Machines Corporation

Intel is a registered trademark of Intel Corporation

Microsoft is a registered trademark of Microsoft Corporation

Turbo Pascal is a registered trademark of of Borland International Inc.








                        Ŀ
                                         
                             PREFACE     
                                         
                        





This text is intended to conver technicalities about diskettes;
a diskette contains much more information than just data!
Understanding the extra information is required e.g.

        . to examine non standard diskettes
        . to format (and write to) non standard diskettes
        . to repair damaged diskettes

The disk controller being ultimately in charge of all read/write
operations, its capabilities will be discussed in-depth. It can
perform much more operations than generally thought.

Most of the diskette operations make use of the Direct Memory
Access (DMA) capability of the system. The processor only has to
initialize the operation; the DMA controller handles the rest.
Details about the DMA set-up will be described in due course.

I assume that readers have some familiarity with the MS-DOS
operating system, with 8086/8088 assembly language programming
and with Turbo Pascal (preferably version 4.0 or later).

I shall often refer the reader to Thom Hogan's book :

              The Programmer's PC Sourcebook
        (Reference Tables for IBM PCs and Compatibles,
                  PS/2 Machines and DOS)
                  Microsoft Press - 1988

Hogan's book is, in my opinion, the best primary source of basic
hardware and software information that is currently available.

And last, but not least :



             Warning  Ŀ
                                                        
             ONLY write-protected or scratch diskettes  
             should be used when testing programs that  
             involve disk operations                    
                                                        
           



                        Ŀ
                                          
                             CONTENTS     
                                          
                        





  I. STANDARD DISKETTES PHYSICAL STRUCTURE

     1. Generalities
     2. Logical sector numbers
     3. Sectors reserved for the operating system
     4. The boot sector
     5. The root directory
     6. The file allocation tables
     7. The fine structure of tracks
     8. Angular positions
     9. Clock bits


 II. THE STANDARD INTERRUPT INT 13h

     1. Generalities
     2. INT 13h functions
     3. Calling INT 13h functions from Turbo Pascal
     4. Functions 0 and 1
     5. Functions 2..4
     6. Function 5
     7. The disk base table
     8. Changing entries in the disk base table
     9. Playing tricks with INT 13h


III. INSTALLING NEW INT 13h FUNCTIONS, A FIRST STEP

     1. Generalities
     2. Planning our work
     3. Turning the disk drive motor on
     4. Recalibrating the read/write head
     5. Moving the read/write head
     6. Reading CHRN fields


 IV. THE LDC READ TRACK OPERATION

     1. Generalities
     2. Direct access memory (DMA)
     3. The read track phases
     4. Experimenting with the read track operation
     5. Positioning the read/write head on the beginning of a track


  V. THE LDC FORMAT OPERATION AND OTHER LDC OPERATIONS

     1. The complete LDC format operation
     2. Aborted format operations
     3. Other LDC operations
     4. Hidden sectors


APPENDIX A   CYCLIC REDUNDANCY CODES

APPENDIX B   DISK SPACE USED BY SECTORS

APPENDIX C   THE STRANGE CASE OF N = 0

