DOS programmer Reference Manual [1]

Source: Internet
Author: User
Tags microsoft c

3 pages
Part 1 dos Overview
Chapter 2 dos Overview
Before reading this book, you must first understand what DOS is. This chapter first briefly introduces the DOS Operation System
And briefly introduces the operating system history to explain the historical origins of DOS. This chapter also covers
DOS structure and interface. Because this is a very rough introduction, do not pay attention to some terms that are unclear, because
For other chapters after this chapter, we will give a more detailed explanation.
1.1 What is DoS
DOS consists of four basic modules:
· Boot Record: The Boot Record starts from 0 sectors, 0 sectors, and 1st faces on each disk,
The disk is formatted by the DOS format command. For hard disks, The Boot Record is at DoS
In the first sector of the partition. This record requires a sector space, identifies the disk, and contains
Import the initialization program of the disk.
· The BIOS Basic Input/Output System (BiOS) is stored in the Rom. This physical device-oriented
Low-layer interfaces allow various software to transparently use various unpredictable hardware devices. For DoS
You can also extend the function by calling I/O from the disk.
· DOS is implemented through two programs. One is the O/I system, which is called from the disk
The interface module is used to extend the rom bios function and contains a standard device driver assembly.
Another file is the disk operating system (DOS), which is the high-level of all programs running on the computer.
Interface, regardless of whether the program uses a disk.
· The command processor is considered to be DoS by most people. Command
A processing program is a standard interface for people to run dos services in the system. It generates a command prompt
(C>), receive commands, and execute various tasks that the user requests to the system.
The modules will be detailed in chapter 2nd "DOS system structure" and Chapter 3rd "dynamic dos. However, we
Here are some basic introductions.
BiOS provides a series of functions that programmers can use to perform various operations without having to worry about the underlying
Hardware details. In this book, we will use BIOS to perform the required operations in various instance programs. In this book
The five-part reference manual describes the functions of each function in the BIOS in sequence.
Although the BIOS is very powerful, it is far from the integrity. DOS flat based on BIOS
Provides many necessary services for programmers. Early days before general operating systems (such as DoS) became reality

4 pages
On personal computers, programs written by programmers often contain content equivalent to DoS functions. Therefore, the tracking should
The process of using a program is also very complicated and terrible.
Since the programming of DOS functions has been completed by Microsoft (and other vendors), DOS has become a tool for readers
Partners in the release. Although it cannot be assumed that everything in DOS works very correctly without errors, it can be assumed that
DOS is solid (unless otherwise confirmed ). The fifth part includes one of various dos functions.
.
1.2 dos history
For many years, DOS has been regarded as the most primitive operating system of a microcomputer. Today's dos, owned
The number of users is much larger than any other operating system. It has become very complex and is a tool with various tools and applications.
Program to meet a variety of needs of the operating environment.
A far-sighted view of DOS is that it can handle complex features of a variety of complex microprocessor, such as 80386
And 80486. In the future, DOS versions can even handle multiple tasks and support multiple users, even though Microsoft
This information is not explicitly provided. Some may have doubts about this, especially the emergence of a new generation of operating systems.
System-after windows and Windows NT.
DOS was first registered for its computer by Seattle computer products for the first time by 86-dos.
The original dos program was written by Tim Paterson. It started in August 1980, and the first product was born in
January 1, August Of The Year. At that time, digited Research's CP/M operating system was widely used in the computer operating system field.
Application. A special design of 86-DOS is that the CP/M application is easy to convert, and it retains the same text
Component control block structure and functions. Therefore, the CP/M program can be automatically converted to 86-dos.
Because 86-dos can only work on the 1980 CPU chip that was just launched in 8086/8088, few people know
Its existence. But those who have upgraded from 8-bit 8088/Z80 standard and CP/M systems to S-100 Systems
Yes, the use of 86-DOS has emerged. At the same time, the company of Seattle computer products has also established several
The market base of multiple customers, including at least one or two hardware manufacturers, Microsoft also
In contact with SCP, ask them to develop a new version for an unknown company. At that time, no one
IBM is also looking for an operating system. In January 1981, Paterson knew that
Customer names, and Microsoft has registered versions separated from 86-dos in their own names
Next, in April that year, Paterson left Seattle computer products and joined Microsoft.
In a few months, he further tailored the system according to IBM's needs.
Microsoft spent a very low price from the Seattle computer products company in July 1981
(Less than $0.1 million) All rights reserved for 86-dos purchases. In the future, SCP filed a lawsuit against the transaction.
The Court ruled that Microsoft paid millions of dollars in compensation. The result is that Microsoft always has no objection
Copyright of the most popular operating system.
When IBM released its PC in August 10, 1981, Microsoft also prepared MS-DOS 1.0 (for IBM
The machine is personal computer dos, not PC dos. IBM never accepts PC dos.
And later IBM versions are also referred to as dos .)
Paterson ended his direct career in DOS in 1982, but he is still active on the PC stage, the most

Page 5
He serves as an expert on various derived bios and serves as a consultant at Phoenix technologies.
After the original PC version was released, DOS has not become the mainstream in some markets. IBM has also selected CP/M-
86 and softech's p-system are optional PC systems. However, vendors seldom act as agents for these products, and few
Development languages available on these operating systems. At this time, Microsoft has also obtained
Good reputation. When IBM uses DOS to release its own software, developers can quickly pick up the ball that never stops turning.
New features are released. CP/M-86 and p-system have never been out of the PC market and it has been involved in the city
Competition.
DOS has been officially modified many times (and many other versions are not designed for general-purpose systems ),
Although each development includes some improvements and error correction, each version corresponds to some hardware changes.
-One of them is the change in disk format and capacity.
Table 1.1 lists the officially announced major dos versions (by date) and major improvements. This table does not contain
Some non-mainstream versions.
Table 1.1 dos versions
Version date update on hardware or operating system
86-dos 1980.8 Seattle computer products (designed in April 1980,
By Tim Paterson ).
1.0 1981.8 original PC, single-sided Disk
1.1 1982.3 dual-sided disk, date and time stamp
In 1.25 1982.3, the first OEM version (zdos) added verify.
2.0 1983.3 pcxt, including hard disk.
2.1 1983.10 IBM pcjr and portable PC.
3.0 1984.8 PC at, including high-density disks.
3.1 1985.3 network.
3.2 1985.12 expansion supports new media.
3.3 1987.4 supports PS/2.
4.0 1988.6 supports hard drive larger than 32 MB. Integration of EMS memory performance.
5.0 1991.6 supports XMS, umb, and HMA.
6.0 1993.3 supports disk compression, fragment removal, and improved config. sys structure,
Anti-virus product.
According to table 1.1, the performance improvement of each new DOS version always corresponds to the amount of memory required.
. Dosv1.0 can be stored under 16 KB of memory, and the original ibpc can only use 64 KB of memory. Versions 2
24 KB of memory is required (more memory is required if the driver is installed ). Any available programs
The minimum memory size is kb. As version 3, DOS requires KB of memory (if the device driver and file
Case), the machine can hardly use less than KB of memory. For version 4 and K
And more than 2nd KB of memory (for more information, see Chapter 1 ).
. Due to memory shortage, dos5.0 provides the method of transferring DOS to high memory, so that it looks better
DOS 4 uses less conventional memory, but it uses more high memory areas. Finally, dos6 is the most powerful
But it provides an improved memory management method, enabling the installed memory to maximize

6 pages
Benefits.
Let's take a look at the changes in each DOS version. In this book, we have some conventions, such
V1 indicates version 1, but also the child version of V1. v1.n indicates the child version of V1.
1.2.1 Version 1.0 ·
DOS V1.0 is the most primitive system that supports PCs. It supports basic Single-sided, eight-sector (eight-sector Disk
And provides all basic disk services. The major change (relative to CP/M) is that it includes support for magnetic
Disk directory structure, File Attribute management, and file size. Version 1.0 has also been improved against the original 86-DoS
Disk allocation and management functions, better operating system service programs and autoexec execution at startup Initialization
. Bat. IBM only releases this version to the manufacturer. Interestingly, this DOS version does not
There is a date and time stamp of the file, which is also a major difference between it and the DOS version later.
1.2.2 version 1.1
In version V1.1 (the last version only belongs to IBM), date and time stamps are added and
Drivers with dual-sided disks and some error fixes. It was released in March 1982.
1.2.3 version 1.25
· V1.25 is the first version released by the original equipment manufacturer (OEM) rather than IBM. (The version number is from
1.1 to 1.25 corresponds to the IBM version and Tim Paterson's personal Revision Control System Version, IBM
V1.1 is a well-known version v1.24 ). In this version, the Verify function is added, that is, 00h is added
Directory end mark byte (this feature is available only when IBM version is 2.0 ).
V1 is far from the unified standard. Microsoft does not directly sell the product to end users, but authorizes
OEMs can modify or even rename them at will (for example, Heath-zenith
Change to zdos to be the first non-IBM DoS ).
1.2.4 version 2.0
Added support for dual-sided and single-sided 9-sector floppy disks and hard disks in DOS v2.0 and used in pcjr.
Tape function. The dos service program has also been greatly improved. This version also includes UNIX-like Hierarchical knots.
File System. Some major improvements in DOS V2.0 are listed below:
· File handle
· I/O redirection
· Pipelines
· Filter program (or filter program)
· Fake offline Printing
· Disk volume label
· Extended file attributes
· System configuration file
· Program environment block maintenance

Page 7
· ANSI display driver
· Dynamic control of program memory
· Support user-defined command processing programs
· International support
Like V1, V2 is also authorized to OEMs who have made changes. At this time, most OEM vendors know
For the sake of market factors, the change is very small because it must be close to or fully compatible with IBM's machines. Some companies
Tandy's 2000 model (which is the first machine using MS-DOS V2.0) is modified so far
DOS manufacturers provide dual vectors in their bios to maintain compatibility with ibm bios.
In version 2, the version is the same, but different versions from different OEMs can also find some differences
. This situation exists in almost all V2 versions.
1.2.5 version 2.1
In version 2.1, only clock changes were added to make it more suitable for ibm pc bars and portable PCs.
. This version of the MS-DOS, such as the known version 2.11, now appears only on a small number of machines, such as Toshiba's
The portable combination device has fixed v2.11 in Rom.
Version 1.2.6 3.0
DOS V3.0 is an earlier version provided for IBM personal computer at (PC/.
This version adds support for high-density (1.2 m) floppy disks and additional hard disk formats, and supports the Network Disk function.
The main new features are listed below:
. Fake offline printing controlled by the application
. Extended Error Report
. Recommended error recovery code
. File record lock support
Although the IBM and Microsoft versions are still somewhat different today, the publication of V3 marks the freedom of OEMs
End of the DOS structure change. For example, for IBM, the supported utilities are all used as COM files, while mi-
Crosoft is supported in the EXE format, but there are few obvious differences among many encodings.
However, to support network operations, it is very necessary to execute in the DOS structure, especially in the internal data format.
Strict unified standards, OEM contracts have also been modified in accordance with this requirement. From this point on, the key to DoS
Some of them are basically stable, which makes developers who have not yet supported them. Now with technical support, developers can
It becomes easy.
Version 1.2.7 3.1
DOS 3.1 adds a network disk, including support for file sharing and fixes some errors. This version is available in
Time has become the seller's standard.
1.2.8 version 3.2
Version 3.2 supports the 3.5 inch floppy disk feature. It also integrates the formatting control into the peripheral device driver

8 pages
. Version 3.2 is the first version that Microsoft sells to end users under its own name.
1.2.9 version 3.3
In dos3.3, two new user commands (ulsfunc and fastopen) and two new
Feature, upgraded many other service programs, and the device support also covers the ibm ps/2 series. This version has an impact on
Here, DOS management and development work has been transferred from Microsoft to IBM to free Microsoft and focus on it.
To develop the ibm OS/2 source program (as part of the transaction, IBM has transferred its OS/2 Development Right
Microsoft ). Both companies continue to announce and support their unique product versions.
1.2.10 version 4.0
In dos 4.0, many user commands are added and many functions are added.
Shell program. However, the major change is to increase the support for 32 MB capacity of hard drive, and will expand the memory
The (Expanded Memory) driver is a standard part of DOS. (These features were appended at that time.
.)
Two months later, IBM released version 4.0, marked as v4.01 on the disk volume.
This article corrected some errors, and the ver command still identified this version as 4.0. Only by viewing two hidden files and
The date and time of the share. EXE file are divided into two versions. The date indicated by version 4.01 is 08/03/88 or
Later, the date of Version 4.0 is 06/17/88. Microsoft also released its 4.0 version after a delay of some time,
Its version 4.0 is equivalent to IBM's version 4.01. Soon after, Microsoft released the 4.01 version that further corrected its error.
Version.
1.2.11 version 5.0
In dos5.0, extended memory (extended memory) is supported and many users are improved.
Commands, including undelete, unformat, mirror, and mouse
Standard Response, full-screen text editor, and so on, added the Task Switch API supported in the shell
Port ). The dos core has been re-constructed to reduce the space for the first time. In addition, DOS can now run in
Rom. Only the share command can securely support the 32 m DOS partition requirements.
Necessary.
Since DOS 3.3, DOS V5.0 is the first DOS version that is actually changed by Microsoft. Microsoft
The supported v4.0 version is the result of reverse engineering of IBM dosv4.0.
Version 1.2.12 6.0
DOS 6.0 was released in March 1993. The main change is to add a lot of utilities to the operating system. Example
For example, the following useful utilities are added:
· Anti-virus protection (anti-virus protection) utility can run in DOS and Windows
To protect the system from known viruses. Anti-virus can also add information about new viruses.
· Deleted file recovery (delete file recovery) This utility can restore accidentally deleted files
. Unlike third-party products, undelete provides users with three levels of security services.

Page 9
· The disk doubling utility calls dblspace to compress disk files,
Decompress the compressed file.
· File backup the utility is an improved backup, which is driven by the menu.
The program can copy the hard disk data to a floppy disk for backup. It can be run in both DOS and Windows.
· Improved memory management: memmaker modifies config. sys and Autoexec
. BAT file to optimize the memory usage utility.
In addition, some other dos utilities have also been improved. The config. SYS file structure can also be changed
Multiple startup sequences. For example, you can have a special configuration to support the use of CD-ROM, and another configuration to support
Tape drivers. At each startup, DOS will ask which startup sequence the user chooses.
1.2.13 future prospects
For programmers, the continued development of DOS will make new services and options possible. Like Microsoft Windows
The appearance of window environments such as desqview has provided a new
Complex service functions. Each time a new service is added, more machine hardware code may be hidden from the program.
And create new functions for users. This new feature will sacrifice the program's running speed and response.
Speed, causing too high a cost. However, as the processing speed increases, low-level programming is not required.
Cut off the ground. Applications will primarily use dos services and their counterparts. Only system-level programmers need
Working in DOS, windows or desqview does not have to worry about directly accessing the machine and its services. This is
Is the trend of future technological development.
1.3 DOS structure
Because this book aims to explore dos and PC systems in depth, we should note the hierarchical functions of the system. Figure
1.1 will help you understand the structure of this level.
Figure 1.1 System Hierarchy
The basic idea of designing the entire DOS/PC system is a way to design a "system suite system. At the bottom of the system
The layer starts with an electronic circuit. For example, it is a circuit (called a computer) with certain functions and characteristics to achieve

Page 10
Device.
The BIOS combines these features with the circuit layer to form a new "Computer
System ". The BIOS layer describes its features through devices with standard properties. No matter what type of display is used
No matter which keyboard you have purchased, the BIOS considers their responses to be the same. In short, all BIOS
Feature to support a programming environment. In this environment, DOS is developed. To enable DOS and
Interfaces between bios of various manufacturers are standardized. The dos designer introduces a buffer layer through which the user
To call the I/O system. It is often considered a part of BIOS. However, since the I/O system layer is mounted from a disk
It is a part of the DOS system (and will be modified as needed to meet dos requirements). Technically,
It should be considered as an integral part of DOS because the relationship between them is more confidential than the relationship between it and bios.
Switch.
The DOS environment still defines a computer system, but it is at a higher level. You can manage files and
The language of the file system is introduced at this level, just like the language based on this device. At this level, DoS
The standardized environment integrates the features required by users. For example
The system treats the disks of maxtor the same way. For the program running on DOS, the detailed low-level situation is
No.
The next layer (command processor) is another computing that is independent of the device but can interact with the device.
At this level, devices and files can be processed in the same way, although DOS is executed in order.
But in the command processor layer, the results can be directly output to the file (normally, it is output to the screen ). Here
There is no need to consider the differences between the speed of each device and between each device.
The last layer is a computer system defined by an application. Because this system is intended for users rather than for processes
This interface is simpler. The current "computer language" consists of menu selection and window. This
Layer, like other layers, is also built on the next layer.
When reading this book or skipping these levels of work based on your personal interests, pay attention to skipping part of the system level and
Loss. Because DOS is built on the BIOS program, the program goes beyond the DOS environment and directly to the BIOS.
How dos works. For example, you can use the disk read and write functions on the BIOS layer to write your own files.
Processing Program. However, it may take a whole year to do the same work as DOS. You can also
You can only stay at the top level, but a lower level can increase the running speed of your program. This is a matter of complexity and speed.
The alternative process lies in the programmer's own choice.
1.4 dos programmer interface
Programmers who work in advanced languages are used to work on predefined functions. In basic, all functions
Both print and input are defined in languages. Pascal also defines various standard functions that can be used.
Function. The C and C ++ compilers provide a set of standard library functions. For most people, these functions
Represents the features of this language. In fact, the functions provided in basic, C/C ++, and Pascal are based on the lower layer.
Times of DOS and bios functions. The language functions are written as the processing process required by the Service in a standard manner.
In some cases, language functions are defined to be compatible with national or international standards. However, to complete this function,
It must be directly mapped to DOS, bios, or hardware devices.

Page 11
Generally, functional areas under the functional layer of the advanced language are protected. Because advanced language functions are not
People who can "program their way out of paper bags" are generally designed to use it. These features must provide error detection and Synthesis
Condition control. Integration is a slow process, so we have to sacrifice the speed. If you spend time learning, DoS
And BIOS service programs can be called directly in any language.
Software interruption is a means of using DOS and bios service programs. (Chapter 2 "interrupt handling" will be discussed
Disconnected .) Previously, software interruptions were called as subprograms of advanced languages. You need to set all parameters and get the result
Result. However, if you are not familiar with advanced language functions, you may be in trouble.
If you enter the above advanced language functions, it will not only get its error detection, control capability and standard library's
Another advantage of reliability is its portability. Use standard Microsoft C or turbo
C programs written in C can be directly used in UNIX systems only after some minor changes. DOS and
The BIOS function does not work, but you can establish the error detection and control required by yourself, without the need
Borland programmers should consider that they should be appropriate to the requirements of the entire market.
Entering the dos and bios layers will get a controlled depth and program speed, at a cost (some very small additional Encoding
Is small. To achieve the highest possible speed, you need to directly access the hardware device. Such operations are commonly used.
On a device such as a screen display or serial port, there is little or no need to be on a device such as a disk.
Generally, for a program that runs reliably but is slow, you can re-compile the key module at a low level.
Blocks or program algorithms are modified to speed up program running. In this book, we will provide
Both positive and negative content. The user determines which application is more suitable for the user. However, according to general rules
Is to first work at the highest possible level. When running a program, it is easy to find errors. If you enter the lower layer, many
Minor errors are hard to be found.
1.5 knots
The IBM compatible series of computers have constructed powerful bios and DOS functions. BIOS updates to the outside world
It provides low-level interfaces; DOS provides high-level service functions to enhance the capabilities of computer programs. And most of the world
Like the operating system, each successful DOS version builds a solid foundation for computer applications.
How to develop programs, what language to use, BIOS or DoS service programs, etc.
Depends on the programming needs. You must comprehensively weigh the differences between different programming methods.
Loss. Based on the selected methods and various strategies, you can find the most suitable Computer System
(Rather than making it out of your way ). This book is based on the idea of accumulating user data.
Program experience, so that it can give full play to the power of the computer.
In Chapter 2nd, we will discuss the structure of DOS, and more closely explore the software on which DOS is built.
And look at the relationship between it and the developed program. We will also discuss how, as a programmer
In the DOS environment, various tools, resources and components are used to construct a flexible and comfortable software building.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.