PC DOS 7 Technical Update
Total Page:16
File Type:pdf, Size:1020Kb
PC DOS 7 Technical Update Document Number GG24-4459-00 February 1995 International Technical Support Organization Boca Raton Center Take Note! Before using this information and the product it supports, be sure to read the general information under “Special Notices” on page xiii. First Edition (February 1995) This edition applies to PC DOS Version 7. Order publications through your IBM representative or the IBM branch office serving your locality. Publications are not stocked at the address given below. An ITSO Technical Bulletin Evaluation Form for reader′s feedback appears facing Chapter 1. If the form has been removed, comments may be addressed to: IBM Corporation, International Technical Support Organization Dept. 91J Building 235-2 Internal Zip 4423 901 NW 51st Street Boca Raton, Florida 33431-1328 When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. Copyright International Business Machines Corporation 1995. All rights reserved. Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. Abstract IBM PC DOS 7 has been designed for all types of users who need an efficient single tasking personal computer operating system. It incorporates many new utilities such as anti-virus software, comprehensive backup programs, PCMCIA support and DOS Pen extensions. Also incorporated are new features to enhance the available memory and disk space. This book is a technical reference, upgraded from IBM DOS 5.02 and written for DOS programmers, who develop applications for IBM Personal Computers or compatible systems. The program developer should be competent on the IBM Personal Computer and/or the Personal System/2 and should be familiar with DOS and at least one personal computer programming language. (381 pages) Copyright IBM Corp. 1995 iii iv PC DOS 7 Contents Abstract . iii Special Notices . xiii Preface . xv How This Document is Organized ....................... xv Related Publications . xvi International Technical Support Organization Publications ......... xvi Chapter 1. Introduction . 1 What′s New for PC DOS 7 ............................. 1 New, Changed or Removed PC DOS Commands and Device Drivers .. 2 New, Changed or Removed Optional Tools ................. 4 New, Changed or Removed .INI Files ..................... 5 New, Changed or Removed Keyboard Layouts and Code Pages .... 5 Minimum Hardware Configuration ........................ 5 Chapter 2. Accessing Disks . 7 The Disk Format ................................... 7 The Boot Record ................................. 7 The File Allocation Table (FAT) ....................... 10 The Disk Directory ............................... 11 The Data Area .................................. 12 Accessing the Disk ................................ 12 Requesting Drive and Disk Information .................... 12 Reading and Writing Data Directly to the Disk ................ 13 Chapter 3. Accessing Files with File Handles ................ 15 Filenames . 15 File Handles . 16 Special File Handles .............................. 16 Reading and Writing Data to a File ....................... 17 Requesting and Specifying File Attributes ................... 17 Accessing Subdirectories . 17 Accessing Directories . 20 Finding Files in Directories ............................ 21 Requesting and Specifying National Language Support (NLS) ....... 21 Controlling Network Operations ......................... 21 Chapter 4. Accessing Files Using File Control Blocks ........... 23 The File Control Block (FCB) ........................... 23 Copyright IBM Corp. 1995 v The Extended FCB ............................... 26 The Disk Transfer Area (DTA) ........................ 26 Accessing Files . 27 Accessing Sequential Records ......................... 28 Accessing Random Records ........................... 28 Finding Files in Directories ............................ 28 Chapter 5. Managing Device I/O ........................ 29 Managing Display I/O ............................... 29 Managing Keyboard I/O ............................. 29 Managing Miscellaneous I/O .......................... 30 Managing File System Activities ........................ 30 Accessing the System Device Drivers′ Control Channel .......... 31 Reading and Writing Data in Binary and ASCII Modes .......... 32 Chapter 6. Controlling Processes . 33 Allocating Memory . 33 PC DOS 7 Memory Management ...................... 33 The PC DOS 7 Memory Map ......................... 34 Identifying a Program at Load Time ...................... 36 The Program Segment ............................. 36 Loading and Executing Overlays ........................ 39 The Parameter Block ............................. 39 Terminating a Program/Subprogram ...................... 40 Loading an Overlay without Executing It .................... 41 Calling a Command Processor ......................... 41 Responding to Errors ............................... 42 Responding to a Control-Break Action ..................... 42 Requesting and Specifying the System Date and Time ........... 44 Requesting and Specifying the Interrupt Vectors ............... 44 Chapter 7. Debugging a Program ....................... 45 The DEBUG Utility ................................. 45 Starting the DEBUG.COM Program ....................... 45 Entering Commands at the DEBUG Prompt .................. 46 DEBUG Command Summary ......................... 47 The DEBUG Work Space ............................. 48 A (Assemble) Command ............................. 49 C (Compare) Command ............................. 51 D (Dump) Command ................................ 52 E (Enter) Command ................................ 55 F (Fill) Command .................................. 57 G (Go) Command ................................. 58 H (Hexarithmetic) Command ........................... 60 vi PC DOS 7 I (Input) Command ................................. 61 L (Load) Command ................................ 61 M (Move) Command ................................ 64 N (Name) Command ................................ 65 O (Output) Command ............................... 66 P (Proceed) Command .............................. 67 Q (Quit) Command ................................. 68 R (Register) Command .............................. 68 S (Search) Command ............................... 71 T (Trace) Command ................................ 72 U (Unassemble) Command ............................ 74 W (Write) Command ................................ 76 XA (EMS Allocate) Command .......................... 79 XD (EMS Deallocate) Command ......................... 80 XM (EMS Map) Command ............................ 80 XS (EMS Status) Command ........................... 81 DEBUG Error Messages ............................. 82 Chapter 8. Writing an Installable Device Driver ............... 85 Types of Device Drivers ............................. 85 Character Device Drivers ........................... 85 Block Device Drivers .............................. 85 How PC DOS 7 Installs Device Drivers ..................... 85 The Basic Parts of a Device Driver ....................... 87 The Device Driver Header .......................... 87 The Strategy Routine ............................. 90 The Interrupt Routine ............................. 90 How PC DOS 7 Passes a Request ....................... 90 Responding to Requests ............................. 92 Initialization Request . 93 Media Check Request ............................. 94 Build BPB Request ............................... 97 Input and Output Requests .......................... 100 Nondestructive Input No Wait Request ................... 101 Character Input and Output Status Requests ............... 101 Character Input and Output Flush Requests ................ 102 Open and Close Requests .......................... 102 Removable Media Request .......................... 103 Output Until Busy ................................ 104 Generic IOCTL Request ............................ 104 Get Logical Device Request ......................... 104 Set Logical Device Request .......................... 105 IOCtl Query . 105 Contents vii Appendix A. PC DOS 7 Interrupts ....................... 107 Interrupt 20H Program Terminate ........................ 107 Interrupt 21H Function Request ......................... 107 Interrupt 22H Terminate Address ........................ 107 Interrupt 23H Ctrl-Break Exit Address ..................... 108 Interrupt 24H Critical Error Handler Vector .................. 108 Interrupt 25H/26H Absolute Disk Read/Write ................. 112 Interrupt 27H Terminate but Stay Resident .................. 114 Interrupt 28H−2EH Reserved for PC DOS 7 ................. 115 Interrupt 2FH Multiplex Interrupt ........................ 115 DOSDOCK API . 118 APM Error Return Codes and Descriptions ................ 129 Interrupt 30H-3FH Reserved for PC DOS 7 .................. 132 Appendix B. PC DOS 7 Function Calls .................... 133 Using PC DOS 7 Function Calls ......................... 135 Program Code Fragments ........................... 136 .COM Programs . 136 PC DOS 7 Registers ................................ 136 Responding to Errors ............................... 138 Extended Error Codes ............................. 138 00H — Program Terminate . 142 01H — Console Input with Echo . 143 02H — Display Output