China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-02 04:05
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Long time no come to donate a book View 21,842 Replies 144
Floor 76 Posted 2008-11-03 14:30 ·  中国 河北 保定 联通
新手上路
Credits 5
Posts 3
Joined 2008-11-03 09:37
17-year member
UID 129844
Gender Male
Status Offline
After seeing such a great thing, it should definitely be supported!
Floor 77 Posted 2008-11-05 20:42 ·  中国 江苏 苏州 电信
新手上路
Credits 13
Posts 10
Joined 2008-11-05 19:34
17-year member
UID 130102
Gender Male
Status Offline
Floor 78 Posted 2008-11-05 23:14 ·  中国 香港 电讯盈科有限公司
新手上路
Credits 4
Posts 2
Joined 2008-11-04 21:16
17-year member
UID 130000
Gender Male
Status Offline
Thanks for the LZ's sharing.
Floor 79 Posted 2008-11-06 08:06 ·  中国 广东 深圳 福田区 电信
新手上路
Credits 6
Posts 4
Joined 2008-11-04 19:20
17-year member
UID 129990
Gender Male
Status Offline
It would be much more convenient if there was a brief introduction.
Floor 80 Posted 2008-11-06 21:15 ·  中国 山西 临汾 电信
新手上路
Credits 6
Posts 4
Joined 2008-11-06 20:29
17-year member
UID 130208
Gender Male
Status Offline
Floor 81 Posted 2008-11-07 00:55 ·  中国 贵州 黔西南布依族苗族自治州 兴义市 电信
新手上路
Credits 11
Posts 7
Joined 2008-11-06 20:59
17-year member
UID 130212
Gender Male
Status Offline
It feels that there is not much use in bat programming
Floor 82 Posted 2008-11-07 09:38 ·  中国 云南 保山 中移铁通
新手上路
Credits 8
Posts 4
Joined 2008-11-05 22:47
17-year member
UID 130122
Gender Male
Status Offline
Download and see what it is
Floor 83 Posted 2008-11-07 13:25 ·  中国 江苏 南通 电信
初级用户
Credits 23
Posts 17
Joined 2008-09-04 01:56
17-year member
UID 124735
Gender Male
Status Offline
Floor 84 Posted 2008-11-08 02:12 ·  中国 香港 电讯盈科有限公司
新手上路
Credits 9
Posts 5
Joined 2008-07-22 16:36
17-year member
UID 121897
Gender Male
Status Offline
Floor 85 Posted 2008-11-10 15:31 ·  中国 四川 达州 联通
新手上路
Credits 10
Posts 5
Joined 2008-11-10 14:57
17-year member
UID 130556
Gender Male
Status Offline
Thank you, the owner of the post~! Collect
Floor 86 Posted 2008-11-23 13:32 ·  中国 江苏 苏州 电信
新手上路
Credits 14
Posts 8
Joined 2008-11-14 15:44
17-year member
UID 130965
Gender Male
Status Offline
Attached is the table of contents:

Table of Contents
Translator's Preface……………………………………………………………………………………………………… 1
Introduction………………………………………………………………………………………………… 2
Part One: Overview of DOS
Chapter 1: Introduction to DOS………………………………………………………………………………………3
1.1 What is DOS………………………………………………………………………………………3
1.2 History of DOS………………………………………………………………………………………4
1.2.1 Version 1.0…………………………………………………………………·………………………………6
1.2.2 Version 1.1……………………………………………………………………………………6
1.2.3 Version 1.25…………………………………………………………………………………6
1.2.4 Version 2.0……………………………………………………………………………………6
1.2.5 Version 2.1…………………………………………………………………………………7
1.2.6 Version 3.0……………………………………………………………………………………7
1.2.7 Version 3.1……………………………………………………………………………………7
1.2.8 Version 3.2……………………………………………………………………………………7
1.2.9 Version 3.3……………………………………………………………………………………8
1.2.10 Version 4.0…………………………………………………………………………………8
1.2.11 Version 5.0…………………………………………………………………………………8
1.2.12 Version 6.0…………………………………………………………………………………8
1.2.13 Future Outlook……………………………………………………………………………9
1.3 Structure of DOS……………………………………………………………………………………9
1.4 Programmer's Interface of DOS……………………………………………………………………………10
1.5 Summary………………………………………………………………………………………………11
Chapter 2: DOS System Structure………………………………………………………………………………12
2.1 Concept of "Virtual Machine"………………………………………………………………………………………12
2.2 Physical Machine…………………………………………………………………………………………13
2.3 Processor……………………………………………………………………………………………13
2.3.1 Memory Addressing of 8086…………………………………………………………………………14
2.3.2 Register Set of 8086…………………………………………………………………………16
2.3.3 80286 and Higher-End Processors…………………………………………………………19

a5 page
2.3.4 Identification of CPU Chips…………………………………………………………………… 20
2.3.5 Mathematical Coprocessor…………………………………………………………………………22
2.3.6 Identification of Mathematical Coprocessor…………………………………………………………………22
2.4 Memory………………………………………………………………………………………………24
2.5 I/O Channels……………………………………………………………………………………… 25
2.5.1 Keyboard……………………………………………………………………………………25
2.5.2 Display Screen……………………………………………………………………………26
2.5.3 Printer…………………………………………………………………………………28
2.5.4 Serial Port…………………………………………………………………………………28
2.5.5 Mouse………………………………-……………………………………………… 29
2.6 Storage Devices…………………………………………………………………………………………29
2.6.1 Physical Disk Structure…………………………………………………………………………29
2.6.2 Logical Disk Structure…………………………………………………………………………30
2.7 Software………………………………………………………………………………………………31
2.7.1 BIOS……………………………………………………………………………………31
2.7.2 DOS Kernel………………………………………………………………………………32
2.7.3 Command Processor………………………………………………………………………… 32
2.7.4 Device Drivers…………………………………………………………………………33
2.8 Summary………………………………………………………………………………………………34
Chapter 3: Dynamic DOS…………………………………………………………………………………35
3.1 Boot Sequence of DOS…………………………………………………………………………………35
3.2 Command Processing…………………………………………………………………………………………38
3.3 Programs under DOS…………………………………………………………………………………39
3.3.1 COM Program………………………………………………………………………………39
3.3.2 EXE Program………………………………………………………………………………41
3.4 Examples of Some High-Level Languages……………………………………………………………………………45
3.4.1 A Turbo Pascal Program………………………………………………………………45
3.4.2 A Compiled C Program…………………………………………………………………46
3.4.3 Comparing Programs of Different Versions…………………………………………………………………46
3.5 Interrupts………………………………………………………………………………………………48
3.5.1 Internal Interrupts………………………………………………………………………………49
3.5.2 4 Non-Maskable Interrupts……………………………………………………………………………49
3.5.3 Hardware (Maskable) Interrupts……………………………………………………………………50
3.5.4 Software Interrupts………………………………………………………………………………50
3.6 Memory Allocation and Management…………………………………………………………………………………52
3.7 Summary………………………………………………………………………………………………55
Chapter 4: DOS and BIOS Interfaces ………………………………………………………………………56
4.1 Accessing DOS and BIOS from Programs…………………………………………………………………56
4.1.1 A Simple Call to Dos…………………………………………………………………………57
a6 page
4.1.2 Passing String Addresses to DOS………………………………………………………………58
4.2 High-Level Language Resources……………………………………………………………………………………59
4.2.1 C Language………………………………………………………………………………60
4.2.2 Turbo Pascal…………………………………………………………………………68
4.2.3 Quick BASIC…………………………………………………………………………72
4.3 Summary………………………………………………………………………………………………76
Part Two: Input/Output Devices
Chapter 5: Output Devices………………………………………………………………………………………79
5.1 Basic Character Devices…………………………………………………………………………………79
5.2 Looking at the Working Mode of the Display System…………………………………………………………………… 80
5.2.1 Storing and Displaying Video Data…………………………………………………………………81
5.2.2 Video Display Formats…………………………………………………………………………83
5.2.3 Identifying Video Display Adapters…………………………………………………………………87
5.3 Video Functions…………………………………………………………………………………………99
5.3.1 Programming Using DOS and BIOS Video Functions……………………………………………………99
5.3.2 Using Multiple Display Pages………………………………………………………………………104
5.4 Printer Functions……………………………………………………………………………………106
5.5 Summary……………………………………………………………………………………………108
Chapter 6: Input Devices……………………………………………………………………………………109
6.1 Keyboard……………………………………………………………………………………………109
6.1.1 Understanding the Working Mode of the Keyboard…………………………………………………………………109
6.1.2 Reading the Keyboard with BASIC……………………………………………………………………113
6.1.3 Accessing the Keyboard Using Int 16h……………………………………………………………114
6.1.4 Accessing the Keyboard Using Int 21h……………………………………………………………118
6.1.5 Identifying the Level of Keyboard Support…………………………………………………………………124
6.2 Mouse……………………………………………………………………………………………125
6.2.1 Understanding the Working Mode of the Mouse…………………………………………………………………125
6.2.2 Initializing the Mouse Driver…………………………………………………………………125
6.2.3 Where is the Mouse Located…………………………………………………………………………126
6.3 Summary……………………………………………………………………………………………130
Chapter 7: Serial Devices……………………………………………………………………………………131
7.1 Serial Interface………………………………………………………………………………………132
7.2 Serial Conversion: UART……………………-…………………………………………………… 134
7.2.1 Transmit Holding Register (THR)………………………………………………………………135
7.2.2 Receive Data Register (RDR)………………………………………………………………135
7.2.3 Baud Rate Divisor (BRD)……………………………………………………………………135
7.2.4 Interrupt Enable Register (IER)………………………………………………………………136
a7 page
7.2.5 Interrupt Identification Register (IIR)………………………………………………………………136
7.2.6 FIFO Control Register (FCR)……………………………………………………………137
7.2.7 Line Control Register (LCR)…………………………………………………………………137
7.2.8 Modem Control Register (MCR)……………………………………………………138
7.2.9 Line Status Register (LSR)…………………………………………………………………138
7.2.10 Modem Status Register (MSR)…………………………………………………139
7.3 Initializing the Communication Port……………………………………………………………………………140
7.4 Modem……………………………………………………………………………………142
7.5 Writing a Terminal Program……………………………………………………………………………143
7.5.1 Duplex Considerations………………………………………………………………………………143
7.5.2 Control Program Term.c……………………………………………………………………144
7.5.3 Support Functions………………………………………………………………………………144
7.6 Using term.c……………………………………………………………………………………151
7.7 Direct Access to UART………………………………………………………………………………151
7.7.1 Assembly Language………………………………………………………………………………152
7.7.2 C Language…………………………………………………………………………………152
7.7.3 BASIC Language……………………………………………………………………………152
7.7.4 Pascal Language……………………………………………………………………………152
7.8 Modifying Term.c…………………………………………………………………………………152
7.9 Echo Detection…………………………………………………………………………………… 154
7.10 Evaluating Serial I/O Devices……………………………………………………………………………155
7.11 Summary……………………………………………………………………………………………155
Part Three: Disks, Directories, and Files
Chapter 8: Disks…………………………………………………………………………………………159
8.1 Internal Structure of Disks…………………………………………………………………………… 159
8.1.1 Partition Table………………………………………………………………………………160
8.1.2 Boot Record………………………………………………………………………………163
8.1.3 File Allocation Table (FAT)……………………………………………………………………166
8.2 Using Disk Functions…………………………………………………………………………………172
8.2.1 Drive Information……………………………………………………………………………172
8.2.2 Formatting Disks……………………………………………………………………………177
8.3 Summary……………………………………………………………………………………………183
Chapter 9: Directories and Files…………………………………………………………………………………184
9.1 Disk Directories……………………………………………………………………………………184
9.1.1 Root Directory……………………………………………………………………………… 185
9.1.2 Directory Entries…………………………………………………………………………………186
9.1.3 Subdirectories…………………………………………………………………………………190
9.1.4 Volume Label………………………………………………………………………………… 190
a8 page
9.2 What is a File……………………………………………………………………………………191
9.3 DOS's Way of Handling Files…………………………………………………………………………191
9.3.1 Standard File Control Block………………………………………………………………………192
9.3.2 Extended File Control………………………………………………………………………192
9.3.3 Basic FCB File Handling……………………………………………………………193
9.3.4 When to Use FCB Functions…………………………-………………………………193
9.3.5 Handle Functions………………………………………………………………………………194
9.3.6 Basic Handle File Handling Techniques……………………………………………………………194
9.3.7 When to Use Handle Functions……………………………………………………………………195
9.3.8 Exercise: Directory Search………………………………………………………………………195
9.4 Summary……………………………………………………………………………………………199
Part Four: Memory Management and Other
Chapter 10: Program and Memory Management…………………………………………………………………………203
10.1 How Memory Works………………………………………………………………………………204
10.2 Memory Management………………………………………………………………………………………207
10.2.1 Compressing Program Memory………………………………………………………………………209
10.2.2 Obtaining More Memory……………………………………………………………………210
10.3 Expanded Memory………………………………………………………………………………………211
10.3.1 Determining the Validity of Expanded Memory…………………………………………………… 211
10.3.2 Using Expanded Memory………………………………………………………………………213
10.4 Extended Memory…………………………………………………………………………………… 217
10.4.1 Determining the Validity of Extended Memory……………………………………………………………217
10.4.2 Using Extended Memory………………………………………………………………………218
10.5 Program Execution………………………………………………………………………………………245
10.5.1 EXEC Function…………………………………………………………………………245
10.5.2 Program Exit…………………………………………………………………………··-249
10.5.3 Potential EXEC Problems…………………………………………………………………249
10.5.4 Entering Commands into DOS………………………………………………………………250
10.5.5 Replacing DOS Internal Commands……………………………………………………………251
10.5.6 Why Some EXE Files Cannot Be Converted to COM Files………………………………252
10.5.7 Program Segment Prefix (PSP)…………………………………………………………………252
10.6 Programming of Memory Resident Software…………………………………………………………………………254
10.7 Summary……………………………………………………………………………………………256
Chapter 11: Interrupt Handling Programs……………………………………………………………………………257
11.1 What is an Interrupt……………………………………………………………………………………257
11.2 How Interrupts Work………………………………………………………………………………259
11.3 Interrupt Types of Intel 8086 Series…………………………………………………………………259
11.3.1 Internal Hardware Interrupts…………………………………………………………………… 260
a9 page
11.3.2 External Hardware Interrupts……………………………………………………………………260
11.3.3 Software Interrupts……………………………………………………………………………261
11.4 Interrupt Vectors……………………………………………………………………………………262
11.5 Obtaining and Setting Interrupt Vectors…………………………………………………………………………262
11.6 When Must an Interrupt Handling Program Be Written?………………………………………………………263
11.7 Writing a Ctrl-C Handling Program………………………………………………………………………264
11.8 Writing a Critical Error Handling Program…………………………………………………………………270
11.9 Overview of TSR……………………………………………………………………………………294
11.10Interrupt Basis of TSR……………………………………………………………………………296
11.10.1 Keyboard Interrupt…………………………………………………………………………296
11.10.2 InDOS Flag, DOSOK Interrupt, and Timer Interrupt………………………………………296
11.11 Summary…………………………………………………………………………………………302
Chapter 12: Device Drivers………………………………………………………………………… 304
12.1 Types of Drivers…………………………………………………………………………………305
12.1.1 Character Device Drivers…………………………………………………………………305
12.1.2 Block Device Drivers……………………………………………………………………305
12.2 How Device Drivers Work………………………………………………………………………………306
12.3 Structure of Device Drivers…………………………………………………………………………308
12.3.1 Device Header………………………………………………………………………………309
12.3.2 Strategy Routine………………………………………………………………………… 312
12.3.3 Interrupt Routine……………………………………………………………………………314
12.4 Complete Drivers…………………………………………………………………………………328
12.4.1 Assembly Language Drivers………………………………………………………………………331
12.4.2 Installing Drivers………………………………………………………………………332
12.4.3 Debugging Drivers………………………………………………………………………332
12.5 Writing a Practical Driver………………………………………………………………………333
12.6 Using Device Drivers……………………………………………………………………………334
12.7 Summary……………………………………………………………………………………………334
Chapter 13: Other Miscellaneous Functions……………………………………………………………………………336
13.1 DOS Version Information………………………………………………………………………………336
13.2 Device Information………………………………………………………………………………………339
13.3 Date and Time Functions………………………………………………………………………………341
13.4 Extended Error Handling………………………………………………………………………………345
13.5 Unpublished Functions…………………………………………………………………………………349
13.6 Summary…………………………………………………………………………………………350
Part Five: Reference Manual
Chapter 14: Overview of Reference Manual……………………………………………………………………………353
a10 page
14.1 How to Introduce Various Services……………………………………………………………………………353
14.1.1 Interrupt Number…………………………………………………………………………… 353
14.1.2 Function Number………………………………………………………………………………354
14.1.3 Subfunction Number……………………………………………………………………………354
14.1.4 Validity of Version………………………………………………………………………355
14.1.5 Purpose……………………………………………………………………………… 355
14.1.6 Description…………………………………………………………………………………355
14.1.7 Registers for Call…………………………………………………………………………355
14.1.8 Registers for Return…………………………………………………………………………355
14.1.9 Notes……………………………………………………………………………………………355
14.2 Detailed Summary of Functions………………………………………………………………………………355
Chapter 15: BIOS Reference Manual……………………………………………………………………………371
Chapter 16: DOS Reference Manual……………………………………………………………………………470
16.1 How to Call DOS Services…………………………………………………………………………470
16.2 Reentrancy………………………………………………………………………………………470
16.3 Reserved Functions……………………………………………………………………………………471
16.4 Unpublished Functions…………………………………………………………………………………472
16.5 DOS Services……………………………………………………………………………………472
Chapter 17: Mouse Reference Manual……………………………………………………………………………649
17.1 Mouse Functions…………………………………………………………………………………649
17.2 EGA Register Interface of Mouse Drivers…………………………………………………………677
Chapter 18: EMS Reference Manual……………………………………………………………………………682
Chapter 19: XMS Reference Manual……………………………………………………………………………721
Chapter 20: DPMI Reference Manual…………………………………………………………………………731
Chapter 21: Task Switching Reference Manual………………………………………………………………………780
21.1 Data Structures………………………………………………………………………………………780
21.2 Notification Functions………………………………………………………………………………………784
21.3 Service Functions………………………………………………………………………………………789
Chapter 22: DoubleSpace Reference Manual…………………………………………………………………794
22.1 CVF Structure……………………………………………………………………………………794
22.2 API Functions………………………………………………………………………………………795
Appendix A: ASCII Character Set………………………………………………………………………………799
a11 page
Appendix B: Selected Memory Locations……………………………………………………………………………806
B.1 Interrupt Table…………………………………………………………………………………………806
B.2 BIOS Data Area……………………………………………………………………………………808
Appendix C: A Standard TSR Identification Technique………………………………………………………………811
C.1 User Parameter Block………………………………………………………………………………… 812
C.2 Function 00h (Check Installation)…………………………………………………………………………813
C.3 Function 01h (Return User Parameter Pointer)………………………………………………………………814
C.4 Other TesseRact Functions…………………………………………………………………………815
Appendix D: Reserved DOS Functions…………………………………………………………………………816
D.1 Types of Unpublished DOS Functions……………………………………………………………………816
D.2 Coverage……………………………………………………………………………………817
D.3 Using Function 52h—Table within Table……………………………………………………………………818
D.4 Summary……………………………………………………………………………………………855
Appendix E: List of Supporting Resources………………………………………………………………………………856
E.1 Hardware……………………………………………………………………………………………856
E.2 MS-DOS and BIOS Programming………………………………………………………………………856
E.3 Programming Languages…………………………………………………………………………………… 857
E.4 General Programming Techniques……………………………………………………………………………… 858
Floor 87 Posted 2008-11-24 12:39 ·  中国 山东 青岛 联通
初级用户
DOS-CN
Credits 52
Posts 33
Joined 2008-11-17 14:18
17-year member
UID 131241
Gender Male
Status Offline
The building owner takes the first floor seat. It was posted by others before. Also, please state the book titles.
一万年太久,只争朝夕!
Floor 88 Posted 2008-11-24 14:23 ·  中国 陕西 西安 电信
新手上路
Credits 8
Posts 4
Joined 2008-11-17 14:09
17-year member
UID 131239
Gender Male
Status Offline
Post first, it looks good to top!
Floor 89 Posted 2008-12-18 11:50 ·  中国 湖北 鄂州 电信
新手上路
Credits 13
Posts 12
Joined 2008-12-13 13:45
17-year member
UID 133738
Gender Female
Status Offline
No translation needed as the text is in Chinese but the user might expect translation, so translating it: No matter what book it is, read it before speaking!
Floor 90 Posted 2008-12-18 14:04 ·  中国 江西 南昌 电信
初级用户
Credits 34
Posts 23
Joined 2008-10-26 18:15
17-year member
UID 129174
Gender Male
From 江西吉安
Status Offline
Thanks for sharing
‹ Prev 1 4 5 6 7 8 10 Next ›
Forum Jump: