DOS 4.00 Technical Reference and Application Programming

From OS2World.Com Wiki
Revision as of 00:26, 15 July 2018 by Martini (talk | contribs) (Created page with "<PRE> DOS 4.00: TECHNICAL REFERENCE AND APPLICATION PROGRAMMING...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
DOS 4.00: TECHNICAL REFERENCE AND APPLICATION PROGRAMMING                                                         
                                                                                
August 6th, 1988                                                                
                                                                                
FIRST EDITION (JULY 1988)                                                       
                                                                                
(c) Copyright International Business Machines Corporation 1981, 1988            
All rights reserved.                                                            
                                                                                
PREFACE                                                                         
                                                                                
AUDIENCE                                                                        
                                                                                
This book is written for programmers who develop applications for IBM           
Personal Computers and Personal System/2(R) computers.(1)                       
                                                                                
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.                                         
                                                                                
CONTENT                                                                         
                                                                                
Some parts of the book have been rewritten and reorganized to make reference    
and system architecture information more concise and to present programming     
information in a task-oriented manner.  Information about new and enhanced      
functions has been added, providing some guide material.                        
                                                                                
RELATED PUBLICATIONS                                                            
                                                                                
Other manuals that provide detailed information about DOS 4.00 are:             
                                                                                
    Getting Started with DOS 4.00                                               
    Using DOS 4.00                                                              
    DOS 4.00 Command Reference                                                  
    IBM Keyboard Layouts for Your PC and PS/2 systems.                          
                                                                                
                                                                                
(1) Personal System/2 is a registered trademark of the International Business   
Machines Corporation.                                                           
                                                                                
CONTENTS                                                                        
                                                                                
CHAPTER 1.  INTRODUCTION  TRD41  7
Organization of this Book  TRD41  16
New DOS 4.00 Services  TRD41  43
The Utilities Diskette  TRD41  57
Minimum Hardware Configuration  TRD41  79
CHAPTER 2.  ACCESSING DISKS  TRD42  11
The Disk Format  TRD42  20
The Boot Record  TRD42  41
The File Allocation Table (FAT)  TRD42  49
The Disk Directory  TRD42  114
The Data Area  TRD42  143
Accessing the Disk  TRD42  150
Reading and Writing Data Directly to the Disk  TRD42  168
Requesting Drive and Disk Information  TRD42  180
CHAPTER 3.  ACCESSING FILES WITH FILE HANDLES  TRD43  13
Filenames  TRD43  48
File Handles  TRD43  62
Special File Handles  TRD43  88
Reading and Writing Data to a File  TRD43  119
Requesting and Specifying File Attributes  TRD43  140
Accessing Subdirectories  TRD43  152
Accessing Directories  TRD43  266
Finding Files in Directories  TRD43  282
Requesting and Specifying National Language Support (NLS)  TRD43  294
Controlling Network Operations  TRD43  307
CHAPTER 4.  ACCESSING FILES USING FILE CONTROL BLOCKS  TRD44  10
The File Control Block (FCB)  TRD44  21
The Extended FCB  TRD44  128
The Disk Transfer Area (DTA)  TRD44  149
Accessing Files  TRD44  172
Accessing Sequential Records  TRD44  218
Accessing Random Records  TRD44  231
Finding Files in Directories  TRD44  250
CHAPTER 5.  MANAGING DEVICE I/O  TRD45  9
Managing Display I/O  TRD45  20
Managing Keyboard I/O  TRD45  43
Managing Miscellaneous I/O  TRD45  71
Managing File System Activities  TRD45  84
Accessing the System Device Drivers' Control Channel  TRD45  105
Reading and Writing Data in Binary and ASCII Modes  TRD45  155
CHAPTER 6.  CONTROLLING PROCESSES  TRD46  17
Allocating Memory  TRD46  32
DOS 4.00 Memory Management  TRD46  47
The DOS 4.00 Memory Map  TRD46  71
Identifying a Program at Load Time  TRD46  134
The Program Segment  TRD46  147
Loading and Executing Overlays  TRD46  198
The Parameter Block  TRD46  216
Terminating a Program/Subprogram  TRD46  260
Loading an Overlay without Executing It  TRD46  307
Calling a Command Processor  TRD46  328
Responding to Errors  TRD46  352
Responding to a Control-Break Action  TRD46  379
Requesting and Specifying the System Date and Time  TRD46  411
Requesting and Specifying the Interrupt Vectors  TRD46  426
CHAPTER 7.  CREATING OBJECT CODE LIBRARIES  TRD47  15
The IBM Library Manager/2  TRD47  20
Starting the LIB.EXE Utility  TRD47  52
Entering Input at the Command Line  TRD47  216
Using a Response File  TRD47  308
Creating and Maintaining Libraries  TRD47  359
Creating a Library File  TRD47  364
Modifying a Library File  TRD47  395
Combining Libraries  TRD47  457
Creating a Cross-Reference Listing  TRD47  475
Performing Consistency Checks  TRD47  500
Setting the Library Page Size  TRD47  513
Library Manager Error Messages  TRD47  540
CHAPTER 8.  CREATING AN EXECUTABLE FILE  TRD48  35
The IBM Linker/2  TRD48  40
Starting the LINK.EXE Program  TRD48  56
Entering LINK Input at the Command Line  TRD48  246
Using a Response File to Supply LINK Input  TRD48  340
Using Linker Options  TRD48  436
Preparing Files for CodeView /CODEVIEW  TRD48  512
Reserving Paragraph Space /CPARMAXALLOC  TRD48  530
Ordering Segments /DOSSEG  TRD48  560
Controlling Data Loading /DSALLOCATE  TRD48  583
Packing Executable Files /EXEPACK  TRD48  607
Viewing the Options List /HELP  TRD48  640
Controlling Run File Loading /HIGH  TRD48  661
Displaying LINK-Time Information /INFORMATION  TRD48  679
Copying Line Numbers to the Map File /LINENUMBERS  TRD48  692
Producing a Public Symbol Map /MAP  TRD48  731
Ignoring Default Libraries /NODEFAULTLIBRARYSEARCH  TRD48  770
Preserving Compatibility /NOGROUPASSOCIATION  TRD48  793
Preserving Lowercase /NOIGNORECASE  TRD48  807
Setting the Overlay Interrupt /OVERLAYINTERRUPT  TRD48  836
Pausing to Change Disks /PAUSE  TRD48  856
Setting the Maximum Number of Segments /SEGMENTS  TRD48  900
Setting the Stack Size /STACK  TRD48  939
Reading the Map File  TRD48  976
Creating an Overlaid Version of Your Program  TRD48  1032
Specifying an Overlay Structure to LINK  TRD48  1050
How LINK Formats the .EXE File  TRD48  1075
Ordering Segments  TRD48  1083
Segment Combine-Types  TRD48  1106
Groups  TRD48  1143
Instruction and Data Reference Errors  TRD48  1159
Linker Error Messages  TRD48  1215
Linker Limits  TRD48  1681
CHAPTER 9.  CONVERTING FILE FORMATS  TRD49  8
The EXE2BIN.EXE Utility  TRD49  13
Entering Input to EXE2BIN  TRD49  34
Two Types of Conversion  TRD49  61
Device Drivers  TRD49  66
Standard .COM File  TRD49  100
CHAPTER 10.  DEBUGGING A PROGRAM  TRD410  32
The DEBUG Utility  TRD410  37
Starting the DEBUG.COM Program  TRD410  46
Entering Commands at the DEBUG Prompt  TRD410  67
DEBUG Command Summary  TRD410  103
The DEBUG Work Space  TRD410  181
A (Assemble) Command  TRD410  225
C (Compare) Command  TRD410  348
D (Dump) Command  TRD410  400
E (Enter) Command  TRD410  504
F (Fill) Command  TRD410  620
G (Go) Command  TRD410  669
H (Hexarithmetic) Command  TRD410  771
I (Input) Command  TRD410  789
L (Load) Command  TRD410  811
M (Move) Command  TRD410  919
N (Name) Command  TRD410  973
O (Output) Command  TRD410  1019
P (Proceed) Command  TRD410  1040
Q (Quit) Command  TRD410  1090
R (Register) Command  TRD410  1113
S (Search) Command  TRD410  1263
T (Trace) Command  TRD410  1321
U (Unassemble) Command  TRD410  1390
W (Write) Command  TRD410  1513
XA (EMS Allocate) Command  TRD410  1645
XD (EMS Deallocate) Command  TRD410  1672
XM (EMS Map) Command  TRD410  1699
XS (EMS Status) Command  TRD410  1727
DEBUG Error Messages  TRD410  1759
CHAPTER 11.  WRITING AN INSTALLABLE DEVICE DRIVER  TRD411  26
Types of Device Drivers  TRD411  39
Character Device Drivers  TRD411  48
Block Device Drivers  TRD411  55
How DOS 4.00 Installs Device Drivers  TRD411  84
The Basic Parts of a Device Driver  TRD411  134
The Device Driver Header  TRD411  148
The Strategy Routine  TRD411  274
The Interrupt Routines  TRD411  283
How DOS 4.00 Passes a Request  TRD411  300
Responding to Requests  TRD411  392
Initialization Request  TRD411  456
Media Check Request  TRD411  511
Build BPB Request  TRD411  630
Input and Output Requests  TRD411  815
Nondestructive Input No Wait Request  TRD411  879
Character Input and Output Status Requests  TRD411  901
Character Input and Output Flush Requests  TRD411  935
Open and Close Requests  TRD411  951
Removable Media Request  TRD411  983
Generic IOCTL Request  TRD411  1008
Get Logical Device Request  TRD411  1037
Set Logical Device Request  TRD411  1055
CLOCK$ Device Driver Example  TRD411  1073
APPENDIX A.  DOS 4.00 INTERRUPTS  TRD412  13
20H Program Terminate  TRD412  21
21H Function Request  TRD412  41
22H Terminate Address  TRD412  46
23H Ctrl-Break Exit Address  TRD412  53
24H Critical Error Handler Vector  TRD412  83
25H/26H Absolute Disk Read/Write  TRD412  287
27H Terminate but Stay Resident  TRD412  353
28H-2EH Reserved for DOS 4.00  TRD412  392
2FH Multiplex Interrupt  TRD412  396
30H-3FH Reserved for DOS 4.00  TRD412  695
APPENDIX B.  DOS 4.00 FUNCTION CALLS  TRD413  100
Using DOS 4.00 Function Calls  TRD413  219
Program Code Fragments  TRD413  230
.COM Programs  TRD413  236
DOS 4.00 Registers  TRD413  256
Responding to Errors  TRD413  340
Extended Error Codes  TRD413  355
00H --  Program Terminate  TRD413  518
01H --  Console Input with Echo  TRD413  546
02H --  Display Output  TRD413  581
03H --  Auxiliary Input  TRD413  603
04H --  Auxiliary Output  TRD413  631
05H --  Printer Output  TRD413  655
06H --  Direct Console I/O  TRD413  672
07H --  Direct Console Input Without Echo  TRD413  720
08H --  Console Input Without Echo  TRD413  753
09H --  Display String  TRD413  786
0AH --  Buffered Keyboard Input  TRD413  815
0BH --  Check Standard Input Status  TRD413  848
0CH --  Clear Keyboard Buffer and Invoke a Keyboard Function  TRD413  868
0DH --  Disk Reset  TRD413  885
0EH --  Select Disk  TRD413  904
0FH --  Open File  TRD413  937
10H --  Close File  TRD413  985
11H --  Search for First Entry  TRD413  1022
12H --  Search for Next Entry  TRD413  1099
13H --  Delete File  TRD413  1149
14H --  Sequential Read  TRD413  1193
15H --  Sequential Write  TRD413  1240
16H --  Create File  TRD413  1286
17H --  Rename File  TRD413  1330
19H --  Current Disk  TRD413  1380
1AH --  Set Disk Transfer Address  TRD413  1400
1BH --  Allocation Table Information  TRD413  1425
1CH --  Allocation Table Information for Specific Device  TRD413  1453
21H --  Random Read  TRD413  1489
22H --  Random Write  TRD413  1541
23H --  File Size  TRD413  1599
24H --  Set Relative Record Field  TRD413  1642
25H --  Set Interrupt Vector  TRD413  1668
26H --  Create New Program Segment  TRD413  1695
27H --  Random Block Read  TRD413  1725
28H --  Random Block Write  TRD413  1787
29H --  Parse Filename  TRD413  1847
2AH --  Get Date  TRD413  1918
2BH --  Set Date  TRD413  1946
2CH --  Get Time  TRD413  1979
2DH --  Set Time  TRD413  2015
2EH --  Set/Reset Verify Switch  TRD413  2051
2FH --  Get Disk Transfer Address (DTA)  TRD413  2085
30H --  Get DOS Version Number  TRD413  2108
31H --  Terminate Process and Remain Resident  TRD413  2138
33H --  Get/Set System Value  TRD413  2175
35H --  Get Interrupt Vector  TRD413  2235
36H --  Get Disk Free Space  TRD413  2262
38H --  Get or Set Country Dependent Information  TRD413  2318
39H --  Create Subdirectory (MKDIR)  TRD413  2431
3AH --  Remove Subdirectory (RMDIR)  TRD413  2466
3BH --  Change the Current Directory (CHDIR)  TRD413  2498
3CH --  Create a File (CREAT)  TRD413  2530
3DH --  Open a File  TRD413  2577
3EH --  Close a File Handle  TRD413  2812
3FH --  Read from a File or Device  TRD413  2840
40H --  Write to a File or Device  TRD413  2886
41H --  Delete a File from a Specified Directory (UNLINK)  TRD413  2938
42H --  Move File Read Write Pointer (LSEEK)  TRD413  2971
43H --  Change File Mode (CHMOD)  TRD413  3035
44H --  I/O Control for Devices  TRD413  3092
45H --  Duplicate a File Handle (DUP)  TRD413  3103
46H --  Force a Duplicate of a Handle (FORCDUP)  TRD413  3137
47H --  Get Current Directory  TRD413  3170
48H --  Allocate Memory  TRD413  3202
49H --  Free Allocated Memory  TRD413  3237
4AH --  Modify Allocated Memory Blocks (SETBLOCK)  TRD413  3263
4BH --  Load or Execute a Program (EXEC)  TRD413  3303
4CH --  Terminate a Process (EXIT)  TRD413  3442
4DH --  Get Return Code of a Subprocess (WAIT)  TRD413  3466
4EH --  Find First Matching File (FIND FIRST)  TRD413  3494
4FH --  Find Next Matching File (FIND NEXT)  TRD413  3567
54H --  Get Verify Setting  TRD413  3606
56H --  Rename a File  TRD413  3628
57H --  Get/Set File's Date and Time  TRD413  3669
59H --  Get Extended Error  TRD413  3714
5AH --  Create Unique File  TRD413  3785
5BH --  Create New File  TRD413  3839
5CH --  Lock/Unlock File Access  TRD413  3878
5E00H --  Get Machine Name  TRD413  3972
5E02H --  Set Printer Setup  TRD413  4006
5E03H --  Get Printer Setup  TRD413  4051
5F02H --  Get Redirection List Entry  TRD413  4096
5F03H --  Redirect Device  TRD413  4169
5F04H --  Cancel Redirection  TRD413  4259
62H --  Get Program Segment Prefix Address  TRD413  4305
65H --  Get Extended Country Information  TRD413  4328
66H --  Get/Set Global Code Page  TRD413  4451
67H --  Set Handle Count  TRD413  4494
68H --  Commit File  TRD413  4539
6CH --  Extended Open/Create  TRD413  4562
APPENDIX C.  I/O CONTROL FOR DEVICES (IOCTL)  TRD414  4
44H --  I/O Control for Devices (IOCtl)  TRD414  50
APPENDIX D.  EXPANDED MEMORY SUPPORT  TRD415  3