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-06-25 09:15
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Original: DOS Booting Tutorial Preliminary (IV): COMMADN.COM Module View 1,711 Replies 2
Original Poster Posted 2002-11-20 00:00 ·  中国 湖北 随州 电信
元老会员
★★★
Credits 1,987
Posts 632
Joined 2002-10-27 00:00
23-year member
UID 73
Gender Male
Status Offline
COMMAND.COM is a command processor module and serves as the shell of DOS. It forms the interface between the MS-DOS operating system and the user. It accepts the DOS commands entered by the user, interprets them, and executes them. This module is composed of 3 parts:
1. Shell initialization program CMDINIT;
2. Temporarily resident memory module CCPT of COMMAND.COM;
3. Resident memory module CCPR of COMMAND.COM.
After SYSINIT reads COMMAND.COM into the main memory, it hands over the control of the system to CMDINIT and disappears by being overwritten. After taking over the control, CMDINIT has to do the following 3 aspects of work:
1. Set the relevant interrupt vectors of DOS;
2. Check if there is AUTOEXEC.BAT. If there is, load and execute it;
3. Make the temporarily resident module of COMMAND.COM start running to wait for the commands typed by the user.
The temporarily resident module CCPT of COMMAND.COM is loaded by the SYSINIT initialization program and located at the high end of the main memory. This module is mainly composed of 4 parts of programs: A. Command receiving and interpreting program; B. Internal command program; C. Batch command processing program; D. External command loading program.
This module is responsible for receiving and interpreting the commands and their parameters typed by the user. If it is an internal command, it calls the corresponding subroutine in this module to execute; if it is an external command (user applications, etc. are also equivalent to external commands), it uses the 4BH function of INT 21H (that is, the EXEC function) to read in and execute the external command.
CCPT is actually placed at the top of the temporarily resident program area for user programs to use. Therefore, there may be a situation where CCPT is overwritten by the loaded user program. This is the reason why it is named the temporarily resident module. The main reason for such an arrangement is mainly "to leave a larger memory space for user programs as much as possible". But if CCPT is overwritten by the user program, once the user program finishes running, the DOS system will no longer be able to receive keyboard commands. So in order to provide a large memory space for users and ensure the normal operation of the system, it is necessary to rely on the support of the resident memory module of COMMAND.COM.
The resident memory module CCPR of COMMAND.COM is mainly composed of a program that checks and reinstalls the temporarily resident module. When CCPT loads the user program, it points the return point after the user program finishes running to CCPR. Therefore, after the user program finishes running, the resident module CCPR immediately gains the control. If it is found that the temporarily resident module CCPT is overwritten, it starts the reinstallation program and loads it from the disk to the top of the temporarily resident program area again. It should be noted that the current disk drive must be the DOS system disk at this time, so that the installation program can find the temporarily resident module of COMMAND.COM and successfully complete the loading task.
In conclusion, the COMMAND.COM module is divided into two parts, each occupying one main memory area, one temporarily resident and one resident. But they are an inseparable whole for completing the DOS command processing: the temporarily resident module completes the main work of command processing, and the resident module ensures the normal operation of the system. The result of such an arrangement provides the user with as large a main memory space as possible.
http://dos.e-stone.cn/dosbbs
uploadImages/200311161145850422.swf
Floor 2 Posted 2004-06-23 00:00 ·  中国 天津 电信
中级用户
Credits 297
Posts 44
Joined 2004-06-15 00:00
22-year member
UID 26749
Gender Male
Status Offline
Floor 3 Posted 2004-07-13 00:00 ·  中国 山东 烟台 联通
中级用户
Credits 293
Posts 42
Joined 2003-10-17 00:00
22-year member
UID 11396
Gender Male
Status Offline
Study hard and make progress every day
Forum Jump: