MSDOS Programming Info
MSDOS Programming Info
Hitrovo
2009
UDC 004.451.9dos N.G. Hitrovo First steps towards system programming under MS-DOS7.
This book is for those who intend to seize the most intimate secrets of modern computer technology. In order to be understood easily, narration starts with some elementary explanations and examples, but its main part presents professional level data with all relevant latest updates. These data will be beneficial for both students and teachers on computer technology as well as for computer maintenance staff, system programmers and developers of x86-platform microprocessor equipment.
This book is distributed according to Attribution-NonCommercial Public License of Creative Commons organization ( http://creativecommons.org/ ).
Table of contents
Introduction...... Chapter 1. Let's get acquainted with keyboard......... Chapter 2. Command line. 2.01 Named objects and their names............ 2.02 Paths........ 2.03 Tips on command line parsing syntax.. 2.04 Syntactic marks with command mission... Chapter 3. Internal commands.. Chapter 4. Configuration commands Chapter 5. Selected drivers for MS-DOS7.. 5.01 DOS's system services.. 5.02 National adaptation drivers...... 5.03 Drivers for "mouse" pointing devices........... 5.04 Memory managers........ 5.05 RAM-disk drivers..... 5.06 HDD services... 5.07 Interface controllers' drivers. 5.08 Services for installable file systems.......... 5.09 Drivers for optical disc drives...... Chapter 6. Selected utilities for MS-DOS7.. Chapter 7. Debugger's assembler commands....... 7.01 Control instructions.. 7.02 Prefixes 7.03 Commands for CPU. 7.04 Commands for arithmetic coprocessor. Chapter 8. Selected interrupt handlers.. 8.01 Interrupt handlers, loaded by PC's BIOS (INT 00 INT 1C).. 8.02 Interrupt handlers, loaded by MS-DOS7 (INT 20 INT 2E).. 8.03 Interrupt handlers, loaded by drivers and TSR programs. Chapter 9. Examples of executable files' composition.. 9.01 Simple configuration files. 9.02 Command files, interpreted by debugger DEBUG.EXE... 9.03 Examples of batch files. 5 10 20 21 25 28 31 36 67 84 85 89 96 100 109 113 117 128 132 137 206 208 211 218 266 291 292 339 387 421 422 428 434
Configuration with relocation to RAM-disk.. Examples of simple utilities.. Value assignment to an environmental variable........ Some advices on checking and testing... Let's try to assemble a driver. Exploratory configuration files.. Experiments with linear addressing... MS-DOS7 loading alternatives.....
446 451 455 467 473 480 491 515 528 528 533 544 551 554 561 568 575 578 583 590 596 604 613 619 625
Appendixes....... A.01 Main system data structures. A.02 Keyboard codes and national adaptation.. A.03 Disk access databases.. A.04 I/O control data tables.. A.05 Driver's data structures A.06 Error codes....... A.07 Execution service structures. A.08 Floppy drives data structures.. A.09 Directories and files' data tables....... A.10 Video data tables.. A.11 PC's hardware specifications A.12 Memory allocation and management.... A.13 Formats of hard disk data. A.14 Ports. A.15 CD/DVD service tables........ A.16 Some relevant abbreviations.
Introduction
Nowadays the windows of Windows-2000/XP operating system have become familiar in home interior. You look there for work and for fun. One easily gets an impression of ability to access just everything. But it's a deceptive impression: the actual origin of all computer's wonders can't be seen via these windows. Each advanced user once comes to a sense of a virtual boundary, arranged by the Windows operating system to prevent intrusions into its internal affairs. If you want to understand computer more thoroughly, you have to choose a way leading beyond the familiar windows. But outside the windows there is darkness with no visible fulcrum for support. If you are still eager to go further, then this book is just for you.
0.01
All computer's wonders are performed by programs. More accurately, there is a complex interaction of applied and system software, each playing its own role. For example, the well-known WORD editor program is a typical application, because it needs run-time environment, provided by the Windows operating system. On the other hand, system software is the one that creates, configures and maintains the operating environment. Much attention is now given to application programming. Microsoft corporation, the owner of Windows operating system, actively promulgates its VISUAL STUDIO packet, comprising several high-level languages for writing applications. Microsoft's interest is obvious: the more applications will require Windows operating system, the more Windows usage licenses will be sold. Attitude to system programming is quite opposite: leading software vendors are determined to prevent any appearance of rival system products. The right to buy some system data is given to reliable business partners only, and not every company can afford such expense. Accepted information policy doesn't foster attention to system programming, but the latter doesn't become less significant because of that. One can't be a true professional in computer technology without some knowledge and experience in system programming. System software is not limited to operating systems only. It also includes hardware drivers, fixed BIOS programs, various diagnostic and recovery services. Study of these software functions has always been an important element of computer technology education. Traditionally system programming is taught on the basis of low-level assembler language (MASM or TASM) under documented versions of Microsoft's DOS (MS-DOS). Now all the documented versions of MS-DOS have become so obsolete, that can't even give access to large storage media used in modern computers. More recent operating sys-
Introduction
tems protect themselves against any attempt of intrusion into their affairs and respond with a known error message "Your program has performed an illegal operation and has to be shut down". Nevertheless an acceptable solution exists. It is an undocumented operating system, which can be installed on modern computers and allows to do just everything. Main purpose of this book is to make you acquainted with that operating system and with it's usage for solving simple system tasks.
0.02
Protection against execution of inadmissible functions is hardware implemented inside processors (CPU), and it is active while the CPU operates in protected mode. Besides the protection itself, protected mode gives several important advantages, and this is why it has become the main operating mode for modern CPUs. For application programs and for the user the protected mode resembles a virtual shell, disabling all actions, which may inflict any harm to vital functions of operating system. This is the main factor of high reliability, inherent to modern operating systems. Contrary to the protected mode, real mode is a "defenseless" mode, making CPU to emulate archaic processor i8086. One may wonder why this obsolete feature is kept supported in each next CPU generation and is not abandoned yet? There is the only reason: real mode is necessary for modern computer systems. First, real mode is required by BIOS: it must have free access to computer hardware for performing the POST tests. Just because of this mission all processors are automatically set into real mode each time the power supply is switched on. Operating systems too can't obtain control over computer's hardware unless protection is disabled, and therefore must start while CPU runs in a "defenseless" real mode. Having got total control over computer, operating systems of the Windows clone prepare protection data structure so that after switching to protected mode the highest privilege level is granted to Windows OS itself, whereas both the user and applications are given the third (the lowest) privilege level. Since then and for ever the user wouldn't be allowed to change this allocation of rights. Because of the same reason all opportunities beyond the limits of Windows' API become inaccessible for the user and for his application programs in protected mode. Nowadays ordinary user's practice doesn't imply experience to act beyond the restrictions, inherent to protected mode. Fundamental concept of modern operating systems is distinction between the user's and system's spheres of responsibility. Excessive user's curiosity is considered destructive and should be suppressed. Protected mode hasn't proved its efficiency against malignant viruses; it provides an effective protection ... against you.
If an operating system permits to run applications in real mode, it can't be as stable as those using protected mode. This is the main reason why old-fashioned DOS-like operating systems have been ousted by more modern ones. But ordinary ratings are not valid for emergency services, which often require unlimited access rights. Then the main drawback of DOS-like operating systems turns into their unique advantage. Therefore computer professionals haven't forgotten DOS. All bootable diskettes (reparatory, diagnostic, disk service, etc.) need an operating system and load just DOS. Most part of bootable compact disks is DOS-based as well. Besides all, DOS is the simplest operating system, and just for that it is the most suitable for primary study of system functions. Though DOS is often considered as a real-mode operating system, this opinion is not completely true. Initially DOS works in real mode, but it shouldn't object against mode change and against user's assignment of privilege levels. Only DOS can give you full freedom of action in both real and protected modes. Practical need of real-mode access forces software vendors to continue development of DOS-like operating systems. Independent FreeDOS project slowly advances towards completion ( http://www.freedos.org/ ). One more commercial version of ROM-DOS recently has emerged ( http://www.datalight.com/ ). Some less fresh shareware versions also have found their interested consumers. A lot of drivers are written in order to supply obsolete DOS versions (MS-DOS 6.22, IBM PC DOS 2000, etc.) with new properties, including access to disks with widespread file systems FAT-32 and NTFS. But drivers, not integrated into the DOS's core, give no opportunity to install DOS onto such disks. If you have ever dared to buy a computer without preinstalled commercial operating system, you almost certainly found there a typical DOS prompt and a HDD (hard disk drive) formatted with FAT-32. Most probably neither of the mentioned DOS versions has any relation to that. Computer initialization is usually done with tools, supplied by Microsoft on emergency diskettes for Windows-95/98 operating systems. Formally it is known as "command line only" loading mode. Simple examination reveals, however, that "command line only" mode doesn't resemble the Windows operating system, but rather is a typical version of DOS. Inside almost every file's code on emergency diskette you can find the proof - a string "MS-DOS Version 7...". The 7-th version of MS-DOS is just that Microsoft's undocumented operating system, which is the main subject of this book. For MS-DOS taken from Windows-95 OSR2 release, function INT 21\AH=30h (8.02-22) reports exact version number 07.0Ah, or decimal 7.10. It is just this version which here and forth is referred to as MS-DOS7. MS-DOS7 is not the latest version of MS-DOS. Windows-ME release is based on MS-DOS8. Having been recompiled for modern CPUs, MS-DOS8 became more compact, but has lost compatibility with some 486 CPU clones. Besides this, it doesn't play an active role during loading of Windows-ME and thus is unable to implement different loading
Introduction
schemes. But other features of MS-DOS8 are similar to those of MS-DOS7, so most data in this book are equally true for both. Each exception is explicitly noted.
0.04
System programming is a vast theme; its narration tends to grow beyond all affordable limits. Therefore this book doesn't pretend to completeness: several large topics (in particular, networks) have been deliberately left aside. Some other items are touched in short, as far as it is enough for comprehension. Chapters 1 - 4 of this book make the reader acquainted with keyboard, with command line composition and with internal commands. These short chapters are addressed to those who had no deal with MS-DOS7 ever before. Chapter 5 describes important drivers for computer's hardware, including the most recent ones, developed by various software vendors during 2004 2008. Chapter 6 presents a survey of selected utilities for MS-DOS7. Special attention is paid to programming instrument DEBUG.EXE the worst documented utility inside the undocumented DOS. Chapter 7 is devoted exclusively to DEBUG's assembler commands. The 8-th chapter describes various services, which can be called for in MS-DOS7 via interrupts. The 9-th chapter presents examples of programming with the tools from Windows95/98 standard release. Examples will help you to write your own interpretable and executable files according to your needs. Presented selection of examples illustrates the scope of opportunities, which can become available in MS-DOS7, if it is properly asked for. The last "A"-th chapter consists of 16 thematic appendixes with a lot of data tables, concerning both MS-DOS7 and AT-compatible PC's. The last 16-th appendix is a vocabulary, explaining the abbreviations used in this book.
0.05
For a long time leading software vendors inculcate hard selling of operating systems, which inhibit user's access to real mode. But sales of both OS/2 (IBM, 1989) and Windows-NT (Microsoft, 1994) went bad. The next attempt Windows-2000 opened an opportunity to employ DOS's services on disks formatted with FAT-32. As soon as success of Windows-2000 became obvious, Microsoft decided to kill the whole rival Windows-95/98/ME brood. However, this decision doesn't eliminate necessity of real mode and provides no alternative real-mode tools. I suggest to regard this Microsoft's decision as a guarantee that your study of MS-DOS7 today will not go in vain tomorrow due to advent of any better version of MS-DOS. One more challenge to renewal arose in 2002, when Intel has developed and began to produce the Itanium CPU, providing no support for old-fashioned 16-bit machine code. All
Introduction
former real-mode tools, including MS-DOS7, could be turned into trash by forthcoming emergence of new PCs with 32-bit BIOS code, and then this book were not worth writing. Seven years have elapsed since, but the expected marvel hasn't happened. Public PCs with Itanium CPU have not emerged. One has to admit, that preservation of support for 16-bit code in all newer CPUs must be caused by firm reasons. Until these reasons persist, experience in DOS will still be beneficial for you. How to get MS-DOS7 launched? If Windows-95/98 is installed already, just keep the F8 key pressed while PC starts to boot operating system, and you'll get into boot menu; then choose "command line only" option, and you're there. Otherwise you'll have to get a Windows-95/98 emergency diskette, and boot your PC with this diskette. Suitable images of bootable diskettes can be found in many internet sites, for example, in http://www.bootdisk.com/ . Standard loading procedure leaves you with a "raw" DOS's command line. MS-DOS7 may appear much more convenient and friendly, if you'll follow the advices given in parts 6.25 and 9.01 of this book. Part 9.11 suggests some other ways of launching MS-DOS7, including those sharing common disk with Windows OS. This book is not based on legal OEM description of MS-DOS7, since it hasn't been published yet. Author of this book is the only one responsible for all its contents. Despite genuine desire to check every data item, the 100% veracity of data can't be guaranteed: author's resources are not infinite. Besides that, evolution wouldn't stop, it permanently engenders something new. Therefore the author can't admit responsibility for consequences of your actions, even those inspired by this book. Any risk-bearing affair requires some caution and competence. However there is a hope that owing to this book your actions will become competent, effective and safe. Your remarks and corrections concerning this book should be sent by e-mail to [email protected]. Each relevant message will be accepted with gratitude.
Chapter 1
For all DOS-like operating systems the main input means is keyboard. Each keystroke invokes execution of at least one preloaded (resident) software module. Sometimes this execution doesn't reveal itself at all, but more frequently it brings about an appearance of the corresponding character on the screen. Several keys (the "hot" keys) may be charged with more complex missions. Resident software modules, which define key's missions, are loaded in memory by either BIOS (Basic Input-Output system); DOS loader from IO.SYS file (active during loading only); the CON device (console) driver from DOS's core; command interpreter (usually COMMAND.COM). This chapter doesn't describe other "hot" key functions, which may be assigned by other TSR (TSR = terminate and stay resident) utilities or file managers: Norton Commander, Volcov Commander, etc. Being loaded later, TSRs intercept some original keyboard functions as most file managers do or substitute with partial (not exact) emulation. Command line presented by file managers is NOT the same as original DOS's command line: a large part of original keyboard functions is intercepted and made inactive. The following text describes functions of the most common "enhanced" keyboard, which usually has from 101 to 108 keys. Evolution of key's functions is shown just as they are activated while loading MS-DOS7. The assumed final stage of this evolution is that implemented by command interpreter COMMAND.COM.
1.01
When switched on, computer starts under control of its BIOS system. BIOS loads the INT 09 handler (8.01-09) and thus becomes able to sense keyboard controller calls sent via the IRQ 1 line. Every keystroke is sensed, but only a few keys and key combinations invoke a certain response. Common BIOS versions assign special mission to the following keys and key combinations: Ctrl-Alt-Delete initiates a "warm" reboot. Delete launches BIOS Setup procedure, which enables to set BIOS' parameters (see notes 1 and 2). This function is deactivated after about 2 seconds, so you have to keep the "Delete" key pressed just when computer starts. Pause/Break (or Ctrl-Break) causes temporary stop until any other key is pressed, thus giving an opportunity to read screen messages.
10
1.02
At some moment during PC's loading the BIOS' logo is replaced by the logo of the operating system. This logo change signifies termination of BIOS's loading mission. Since that moment control is transferred to operating system's loader. Both Windows-95/98 and MS-DOS7 operating systems have the same primary loader, contained as a part inside the IO.SYS file. The loader begins its mission with reading parameters stored in MSDOS.SYS file (5.01-01). Then according to these parameters the DOS loader activates for a time some more "hot" keys and key combinations:
11
12
Chapter 1: Lets get acquainted with keyboard 1.03 Keyboard functions during batch file execution.
Control over the PC is given to the main command interpreter when DOS configuration procedure is not finished yet. The first mission of COMMAND.COM is interpretation of commands in lines of the last configuration file AUTOEXEC.BAT (example in 9.01-02). During interpretation COMMAND.COM is quite self-sufficient, but at the same time the user's role is not diminished to zero. If Window's logo display is turned off, then user can monitor current messages. Besides that, command interpreter keeps active some "hot" keys, which enable user to suspend or to stop interpretation of batch command file. Both suspension and stoppage of execution initiate a complex succession of calls (see 8.01-95 for details), involving resident modules of DOS's core as well as those installed by PC's BIOS. Therefore exact action of some "hot" keys may depend on BIOS version. Nevertheless the activated "hot" keys are the same in all AT-compatible computers. The Break/Pause key provides a temporary stop, enables to read messages, but gives no opportunity to terminate execution of batch file: any following keystroke resumes execution. The user can terminate batch file execution with "hot" keystroke combinations CTRL-C, CTRL-BREAK and ALT-03 (the latter digits "03" must be typed via the rightmost numerical keypad). Action of these keystroke combinations depends on the way the command interpreter has been launched. When COMMAND.COM starts permanently with /K or /P parameter (6.04), the mentioned keystroke combinations stop execution and display an offer "Terminate batch job? Y/N" thus providing an explicit choice. But if COMMAND.COM starts with /C parameter (6.04) for execution of a single job (as inside TSR shells), then CTRL-C, CTRL-BREAK and ALT-03 keystroke combinations terminate batch file interpretation at once, giving no chance to resume. The CTRL-S keystroke combination provides a temporary stop, but (unlike the BREAK key) always enables to have a choice. You may resume execution by pressing any other key, except CTRL-C, CTRL-BREAK, ALT-03 and CTRL-2. Action of CTRL-C, CTRL-BREAK and ALT-03 depends on the way COMMAND.COM has been launched just as it was described above. CTRL-2 acts similarly, but only when execution has been suspended already by CTRL-S. Normal batch interpretation will not be affected by CTRL-2 keystroke combination. Keyboard functions, breaking interpretation of a batch file, can be disabled by CTTY NUL command (see 3.07) in a line of the same batch file. But this trick may be justified in special circumstances only (example in 9.03-02).
13
1.04
When COMMAND.COM presents its command line, it accepts input via the CON device driver. The latter enables to type characters, digits and special symbols according to keyboard layout table resident in memory. Symbols may be entered either by corresponding keys or by ASCII decimal symbol's numbers. The latter should be typed via numerical keypad while the ALT key is kept pressed. Each next character appends the current command line and increments by 1 current position pointers for the current line and for the internal memory buffer, where the previous line is automatically stored. Selection of symbols, typed with literal keys, depends on the state of SHIFT and CAPSLOCK keys. Pressing CAPSLOCK toggles keyboard into upper case letters selection and back. Pressing SHIFT turns keyboard into upper case selection for a while until SHIFT key isn't released. Besides that, DOS presents some limited opportunities of editing current command line (1.05). All mentioned features are equally true for typing textual lines. Transition from command line input to textual line input is initiated by an explicit request to the CON device driver, for example, with command COPY CON Filename.txt where FILENAME.TXT is an arbitrary name of a file to store the text. The COPY command is not a separate utility; it is an internal command of the interpreter COMMAND.COM (3.06). Textual line input also can be implemented by other utilities, which are able to address the CON device driver in the same way. Differences between textual input and command line input evince in what happens with the typed line when user confirms that typing the line is finished with the ENTER key-
14
1.05
The most "hot" input key, no doubt, is the ENTER key. But besides it there are several other "hot" keys, charged with editing and control functions, which have a long history in former computer generations. Both interactive command interpreters in DOS COMMAND.COM and DEBUG.EXE inherit these functions. Some of them seem rudimentary, but some are still widely used. BACKSPACE key (left arrow) decrements by 1 current position pointer for the current line and in internal memory buffer as well. Contents of internal memory buffer remain intact, but the last character in the current line looks lost; in fact this character is prepared to be overwritten with the following keystroke. Left arrow among cursor keys, left arrow in the numerical keypad, CTRL-H and ALT-08 keystroke combinations do just the same.
15
16
17
Chapter 1: Lets get acquainted with keyboard 1.06 Keyboard layouts and character sets.
By default MS-DOS7 employs American English (US') set of characters, represented by codepage 437, but gives an opportunity to replace it according to national demands. Implementation of this opportunity involves several operations for changing both keyboard and display settings. Microsoft proposes the following sequence of operations: change limitations for names and some other setting by loading data from COUNTRY.SYS file (5.02-01, an example in 9.01-01); prepare a memory place for additional codepage(s) by loading DISPLAY.SYS driver (5.02-02, an example in 9.01-01); launch MODE.COM utility in order to load codepages and to make one of them active (6.18, an example in 9.01-02); launch KEYB.COM driver in order to load alternative keyboard layouts (see 5.02-04, an example in 9.01-02); load NLSFUNC.EXE driver (5.02-03) in order to enable switching between prepared codepages and national data sets. National codepages inside WINDOWS-95 OS release are packed into four data files: EGA.CPI, EGA2.CPI, EGA3.CPI, ISO.CPI. Each national codepage contains 256 characters in two character sets: american english set (characters 32 127) and a national one (characters beyond the 128-th). Therefore switching between any national language and english language doesn't require swapping of codepages, it can be performed within any single national codepage. This is quite enough for all that limited variety of tasks, which are solved nowadays with MS-DOS7. Because of this reason swapping of codepages has come out of use. Switching between different character sets (inside one codepage) is done with "hot" keys, arranged by KEYB.COM (5.02-04) or by any other keyboard driver (for example, KEYRUS.COM, see 5.02-05). In particular, KEYB.COM activates CTRL-rightSHIFT key combination for switching to a national character set and CTRL-leftSHIFT key combination to switch back to common english character set. KEYRUS.COM enables to activate various key combinations, including the mentioned ones. Microsoft supplies keyboard layout tables packed in special keyboard data files KEYBOARD.SYS, KEYBRD2.SYS, KEYBRD3.SYS. Among these the KEYBOARD.SYS is the only keyboard data file supporting typewriter form of keyboard layout. Details concerning the choice of a proper keyboard layout for a particular country (and of a proper code page too) are shown in appendix A.02-2. An implementation example of Microsoft's proprietary national adaptation is shown in articles 9.01-01 and 9.01-02. Though Microsoft's keyboard files and codepages include national data for the most part of the globe, they are no more supported by Microsoft and are not opened for updating. Because of this at least 5 other keyboard drivers have been developed for DOS up to now. Only one of those alternatives is described in this book the KEYRUS.COM driver
18
19
Chapter 2
Command line
Command line in MS-DOS begins with a machine-generated prompt and then is implied to be filled with symbols and words, which altogether must be suitable for machine interpretation according to certain syntax conventions. The final ENTER keystroke initializes interpretation of command line by a resident program the command interpreter. Implementation of syntax conventions by different interpreters is not just the same. MS-DOS7 provides 3 interpreters: IO.SYS, COMMAND.COM, and DEBUG.EXE. Each interpreter accepts its own set of commands, described in chapter 4 for IO.SYS, in chapter 3 for COMMAND.COM and in part 6.05 for DEBUG.EXE. Since the loader IO.SYS deals with command lines in configuration files only, the user first encounters command line, presented by COMMAND.COM. The latter is often called resident interpreter, because it is permanently loaded into computer's memory and therefore is always ready to perform commands entered from keyboard. By means of input redirection (see 2.04-02 for details) one can force the interpreter to accept commands not from keyboard, but from command files. Each line in command files is in fact a separate command line. Sending command files via input redirection is the only way to automate execution of command sequences by the DEBUG.EXE interpreter (examples in 9.02). The COMMAND.COM interpreter too can accept commands via input redirection, but it is not the best way to execute command sequences for COMMAND.COM, because it is able to handle a special sort of command files batch files without redirection. From batch files the COMMAND.COM interpreter accepts a number of supplementary commands, which can't be executed from command line or from ordinary command files. These supplementary commands include substitution of dummy parameters and names of variables with their values (2.03-03), search for labels and some other commands (3.02, 3.14, 3.21, 3.27). Here and forth in this book the term "batch files" is applied only to this special sort of command files. Examples of batch files are shown in part 9.03. Configuration file AUTOEXEC.BAT (9.01-02, 9.04-02, 9.09-02) also represents an example of a typical batch file. This chapter describes the most essential conventions, which define command line composition both in separate command lines and in command files. These conventions are common to some extent for all the three interpreters in MS-DOS7. Endemic features of interpreters are presented too. If not specified otherwise, interpretation of commands by the main interpreter COMMAND.COM is implied.
20
Each command line addresses one or more objects. An object may be, for example, a separate utility, which is to perform the desired action, or an internal command of command interpreter. The data in command line must be ample enough to identify exactly the addressed object(s). For this purpose inside any common folder identical names of objects are not allowed: all files and subdirectories must be given different names. In order to identify any object outside any particular folder the path to this object is taken into account. The path may be specified explicitly or set by default. The main objects name together with its optional path should be specified the first in command line and may be followed by other items, including name(s) of other object(s), parameter(s), reference(s), syntax mark(s), etc. Each line of command files, presented in part 9.03, can be taken as example of command line. There are objects, however, internal commands, ports and some others which can't be defined by path specification. The names of such objects must be unique, reserved words, which shouldn't be assigned to any other object. Therefore the first theme to consider is which names may be assigned to objects by the user, and which can't. 2.01-01 Reserved words
Reserved words represent names of internal commands, specific for each interpreter, and names of devices, claimed as existing in a particular computer. Names of these objects can't be altered or assigned to other objects. Nevertheless the reserved words should be known in order to prevent attempts to assign such names to other objects, which can be named by the user. Internal commands are those performed by a particular interpreter itself. All those names of internal commands, described in chapter 3, are regarded as reserved words as long as command line is interpreted by COMMAND.COM. For example, you can't assign the name PROMPT to a file, since COMMAND.COM, having encountered this name in command line, "understands" it as its own internal command and has to do nothing but perform this command. Other command interpreters similarly don't allow to assign names of their internal commands to other objects. Reserved names of devices in a PC define sources for obtaining data or targets for sending data. Most known device names are: AUX first serial port COM1 first serial port (equivalent to reserved name AUX) COM2 second serial port CON console, i.e. keyboard for input and display for output LPT1 first parallel port NUL virtual "nowhere" output port
21
Besides these some other device names are regarded as reserved: CLOCK$, COM3, COM4, CONFIG$, LPT2, LPT3. These words are reserved by device drivers, integrated into DOS's core, which are loaded always, even if corresponding device is not physically present. The entire list of devices, which are claimed present in your PC, can be displayed by the MEM.EXE utility (6.17), if it is launched with /D parameter. This utility displays a table, and all registered names are shown in its 4-th column. Reserved words are shown shifted by 3 spaces to the right against other names. Several installable software drivers also can be identified by name and reserve words for this purpose. For example, SETVER.EXE driver (5.01-02) reserves word SETVERXX, HIMEM.SYS driver (5.04-01) reserves word XMSXXXX0, EMM386.EXE driver (5.04-02) reserves word EMMXXXX0. Moreover, when you specify an arbitrary identifier for a CD-ROM drive, for example, MSCD001 (see 5.09-01, 5.09-02, 5.09-03), this name becomes registered by DOS as a reserved word. If later you'll try to assign this name to a file, DOS will reject your attempt. 2.01-02 Names and suffixes
Naming and renaming operations most often are applied to directories (3.19, 6.20) and to files (3.24, 3.25), both ordinary and executable ones. Names in DOS consist of no more than 8 characters and may be appended with an extension (suffix) of no more than 3 characters long. Suffix is separated from the name with a dot. When suffix is assigned, but is not required for a particular operation and is omitted, then the dot separator must be omitted too. Both names and suffixes may be composed of letters, digits and several signs, which have no dedicated functional mission in parsing of command lines: number sign ( # ), dollar sign ( $ ), ampersand ( & ), minus ( ), exclamation mark ( ! ), underscore ( _ ) and a few others (2.04-06). Upper case and lower case letters are regarded equivalent in almost all operations, except letters in strings to be compared with commands IF (3.15-02), SEARCH (6.05-16) and FIND (6.14). Since dot ( . ) is used to separate a name from suffix, it is not allowed to be employed as an ordinary character. Other prohibited signs are comma ( , ), colon ( : ), semicolon ( ; ), equality sign ( = ), question mark ( ? ), plus ( + ), left arrow ( < ), right arrow ( > ), asterisk ( * ), pipe ( | ), slash ( / ), backslash ( \ ), and double quotes ( " ). National language symbols also can't be employed, unless restrictions on their usage are taken off by the COUNTRY command (4.05, 5.02-01, A.02-5). Directory names usually have no suffix. Suffixes in names of files are used to indicate file's type or origin. Three suffixes BAT, COM and EXE have special status, since are recognized by the COMMAND.COM interpreter as belonging to executable files. When a
22
Associations for a lot of other suffixes can be found in internet site http://www.openwith.org/ .
23
Question mark ( ? ) and asterisk ( * ) are known as substitution symbols (or wildcards), which can't be employed in names and extensions, but can be used to replace characters in specifications of names and suffixes in command line(s). Name specification with wildcard(s) is a filemask a means to address several files at once. While parsing a command line with a filemask, COMMAND.COM may invoke wildcard expanding function, which searches for filenames, satisfying to the encountered filemask. If such file is found, its name is substituted for the filemask, and then command line with this name is executed. If more than one such file is found, similar procedures are performed sequentially with each of the found filenames. Whether words with wildcards will be interpreted it depends on the command to be executed: some commands invoke a call for the mentioned wildcard expanding function, some commands don't. Generally wildcards are not ignored, but there are some exceptions: wildcards are not expanded by internal commands ECHO, SET, TYPE and IF with equality comparison function (see chapter 3). wildcards in parameters of a batch file are not expanded (it doesn't matter whether the CALL command is used or not); input redirection notation (2.04-02) doesn't expand wildcards; the FOR command (3.13) expands wildcards inside brackets only, but outside brackets wildcards are transferred "as they are" to the command to be executed inside the FOR cycle, and further fate of wildcards depends on that command. Wildcard ( ? ) means a symbol, which induces comparison procedure(s) to give positive response for any single letter or digit. When the ( ? ) wildcard in a filename or in a suffix is not followed by any explicitly specified letter or digit, comparison procedures also give positive response to absence of any symbol in that place. For example, in a command DEL readme.?? the object will match all files in the current directory having name "readme" and not more than two-character suffix: readme.ru, readme.en, readme.f, and so on. Hence the DEL command (3.09) will delete all such files from the current directory. Asterisk ( * ) means a symbol, which induces comparison procedure(s) to give positive response for any number of any following letters or digits up to the end of the word, which may be marked with either a dot or a space. For example, asterisks in command DEL C:\TEMP\*.* match any filename with any suffix, so this DEL command will be applied to all the files inside the specified directory.
24
2.02
Paths
Exact placement of each file on a disk is specified in a certain directory. Numerous directories are usually arranged in a hierarchical structure: each directory of higher rank may contain data not only about files, but also about placement of several lower rank directories (subdirectories). In order to access any file you have to point out the disk and the path that is a directory and the whole chain of subdirectories, leading to the one, which contains exact placement data for this particular file. DOS gives you an opportunity (2.04-01, 3.03) to specify any one particular path as the default path. This path will be stored in internal DOS's data table (A.03-3). Each time you enter a command line without path specification, DOS takes into account the stored default path. The disk and the final directory (subdirectory), specified in the default path, are known as the current disk and the current directory. DOS's prompt (3.22) is usually adjusted to show the current path. 2.02-01 Typical path structure
By default the command interpreter searches for the addressed object in the current directory. If the object must be found in any other directory, object's name should be preceded by a path, for example C:\DOS\MS7\Edit.com where: Edit.com C:\DOS\MS7\ is the addressed executable file; is an example of a path to this file.
The shown path specification directs the search process: first it should be switched to the root of disk C:, there the DOS directory should be entered, then its MS7 subdirectory, and at last in the latter directory the specified executable file should be searched for. If you happen to have other directory structure, you'll have to specify other names, but the principle remains the same: first the disks letter-name, followed by a colon,
25
In order to make command line usage easier DOS provides one more mechanism of path specification via the PATH environmental variable. This mechanism comes into action when 4 conditions are met: command is addressed to the COMMAND.COM interpreter; PATH variable is present yet in the environment; path is not specified in command line; the first addressed object isn't found in the current directory. If all these conditions are met, then DOS will search for the first addressed object along all the paths, which are implied to constitute the value of the PATH variable. The PATH variable should be set beforehand with internal PATH command (3.20). Examples of paths specification with PATH command are shown in 9.01-02, 9.04-02, 9.09-02. Owing to the PATH variable you can call utilities for execution as easily as though these were always present in any directory you may choose. This is convenient, but only
26
A dot ( . ) in path specifications is interpreted as an alias for the current directory. Note, for example, the trailing dot, which replaces the target path in the following copy command: Copy /B A:\MyDir\*.* . Sometimes batch files must be written so as to do their job in any current directory (which may be not known beforehand), and then the dot alias is the only allowable replacement for required specification of target path to the current directory. Addressing to the current directory with a dot is also needed when any other (not current) directory will be implied otherwise. Dot as the first symbol of a path statement means that the path should be reckoned taking the current directory as the start point: .\VC4\Vc.com Such path is equivalent to the one without preceding backslash (2.02-01), but nevertheless this form of path may be practical in batch files, because MS-DOS provides no other means to get rid of preceding backslash. One more reason to use commands with preceding dot alias and a backslash is to prevent search for synonymous utilities throughout all the paths, enlisted in the PATH environmental variable, when execution of a synonymous utility may inflict unwanted consequences. Some utilities return directory specifications with final backslash, for example: C:\DOS\MS7\ Such paths are regarded by MS-DOS as invalid, and MS-DOS doesn't provide means to get rid of the final backslash. Appending a dot to such path solves the problem: C:\DOS\MS7\. - this directory specification is regarded valid. Double dot, or dot-dot ( .. ) may be used in any place within path statements just like the single dot, but dot-dot is an alias for the parent directory. If, for example, you are given specification C:\DOS\MS7\ and want to address its parent directory, then the
27
2.03
2.03-01
Words in command line are separated with separation symbols: space ( ), comma ( , ), equality sign ( = ) and semicolon ( ; ). Though space is the one most universally used, either of these is ignored at the beginning of command line and will act as separation symbol in parsing operations, including parsing of an object list within the FOR command (3.13). Because of the same reason separation symbols can't be transferred from parameters of command line into internal dummy parameters of a batch file (2.03-03). There are some exceptions, though. Commands SET and IF use equality sign ( = ) in a special way and don't allow to use it for separation. When symbols comma, semicolon or equality sign precede to ECHO command, then displayed part the line will begin just after the separation symbol, including possible preceding spaces and the word ECHO itself. Semicolon ( ; ) is used as special separator in PATH command (see 3.20). The IO.SYS interpreter deals with semicolon otherwise. Being placed first in a line within Config.sys or Msdos.sys file (5.01-01), semicolon is interpreted as a command to jump to the next line, ignoring the rest part of current line (usually containing commentaries). The DEBUG.EXE interpreter in assembler mode deals with semicolon in a
28
A slash ( / ) in MS-DOS command line specifications is a sign to interpret the following letter (or word) as a parameter. For example, in command DEL C:\TEMP\*.* /P (see 3.07) slash ( / ) forces to interpret the letter P as parameter, inducing a prompt on whether each file in the specified directory should be deleted. Exact place and form of the parameter(s) are specific and must conform to particular command's specifications. Sometimes a slash ( / ) is used within the FOR command as a functional separator, causing conversion of letters in the following word to the upper case (see 3.13 for details). 2.03-03 Percent sign
Percent sign ( % ) in batch files means substitution of the name of a dummy parameter or of a variable with the value of the same parameter or variable. These substitutions are performed before execution of the specified command(s) and redirection(s). Dummy parameters are named with digits from 0 to 9. Value of the 0-th dummy parameter is always the name of the batch file itself; other dummy parameters take their values from the items, specified after the name of batch file in the command line, from which the batch has been started. So %3 ,for example, will be replaced with the third item, following the name of batch file in command line. If several dummy parameters are specified without a space in between, then after substitution their values will be concatenated. Examples of assigning values to dummy parameters are shown in 2.03-04 and in 9.03-01. If total number of words, following the name of a batch file in command line, is less than 3, then the designation %3 of a dummy parameter will be replaced with nothing and disappears without any error message. If total number of words, following the name of a batch file, is greater than 9, then the values of the rest can be accessed after applying a shift to dummy parameter numeration (3.27). There is one exception, though: the Autoexec.bat file (for example, 9.01-02), automatically executed during DOS loading procedure, has no dummy parameters at all, so the CALL %0 command (3.02) doesn't induce its recursive execution. Names of variables must be a single word with a letter (not a digit!) as their first character. Values of variables either are assigned by special command SET (3.23) or are inherited from parent environment, belonging to the program, which has launched execution of the current program (see 6.04). For performing substitution the name of the
29
Double quote ( " ) disables interpreter's function of parsing the command line until the next double quote is met in the same line. Thus any group of words between opening and closing double quotes (possibly including separation symbols, redirections, etc) will be interpreted as one item. Enclosing double quotes themselves are considered belonging to the enclosed item. For example, execution of a line C:\>Batch.bat 1 " 2 3 " 4 "" creates a new set of dummy parameters, in which the value of the first parameter is single digit 1, the value of the second is a string " 2 3 ", the value of the third parameter is digit 4, and the value of the last fourth parameter is an empty pair of double quotes. This set of dummy parameters will exist until execution of Batch.bat terminates. Enclosing a group of words in double quotes is a way to include this group of words as a whole (together with any symbols inside) in a value of one dummy parameter. This trick is used, in particular, to preserve integrity of long names in DOS. An empty pair of double quotes ( "" ) is regarded as a special void symbol, enabling to preserve parsing sequence unchanged. Most internal commands in MS-DOS7 (except ECHO, IF and SET) ignore empty pair of double quotes as a separate symbol, but accept the results of parsing affected by double quotes. For example, command C:\>cd "" is executed just as though there were no following symbols at all. When a parameter is enclosed in double quotes, command is executed as though there were no double quotes: C:\>cd "C:\dos"
30
2.03-05
Square brackets
Square brackets [ ] are used as a special sign in files, which are to be executed by DEBUG.EXE and by IO.SYS. Data in square brackets are interpreted by DEBUG.EXE as references to operands (see introduction article to chapter 7 for details). In configuration files MSDOS.SYS and CONFIG.SYS, which are to be executed by the IO.SYS loader, the words enclosed in square brackets are interpreted otherwise: as headers, marking beginning of a separate configuration block and at the same time as signs, enclosing name of this configuration block. There are two reserved words, which denote special configuration blocks in CONFIG.SYS file: [menu] and [common]. The [menu] block represents multiconfiguration menu; if it exists, it must be placed the first in CONFIG.SYS file. The menu block is eminent because of a special subset of allowed commands: the MENUCOLOR (4.19), MENUDEFAULT (4.20), MENUITEM (4.21) and SUBMENU (4.29) commands may be used only in blocks, announced as menu or submenu. All other configuration commands, described in chapter 4, except the NUMLOCK command (4.23), can't be used in menu and in submenu blocks. Commands to be executed in all configurations are grouped in one or more blocks with the same name [common]. Outside block headers the names of configuration blocks are referenced without square brackets (4.14). Examples of configuration file CONFIG.SYS with blocks [menu], [common] and some others are shown in 9.04-01 and in 9.09-01.
2.04
2.04-01
Interpretation of a colon ( : ) depends on its place in command line. Being used as the first character in a line (in batch files only), colon ( : ) forces to interpret the nearest following word as a label, marking a target address point for a jump. There may be more than one word in this line, but all the rest words and symbols will be ignored. Double colon
31
Left Arrow ( < ) denotes an operation of input redirection, prepared by COMMAND.COM interpreter for execution of the program, specified in command line to the left of Left Arrow sign. By default the standard input channel (STDIN) is linked with console (CON) and accepts input from keyboard. In fact Left Arrow is a command to link STDIN (handle 0000h) with the data source, specified to the right of input redirection sign. When the utility, specified to the left of input redirection sign, will ask DOS for data input via the STDIN channel, it will get data from this source. Of course, this works only if the utility asks for input via the STDIN channel. For example, command MORE < C:\DOS\Filename.txt supplies the filter utility MORE.COM (6.19) with data read from specified textual file in C:\DOS directory. If directory specification is omitted, then current directory is implied. In any case the file to be read will not be searched for along the paths, enlisted in the PATH variable. Filemasks instead of the source filename are not allowed, wildcards (2.01-03) are not expanded. Besides files, ports (LPT1, LPT2, COM1, COM2, COM3, COM4) may be used as sources of input data. If default links are disrupted by the CTTY NUL command (3.07), then for performing input from keyboard you have to use input redirection with explicit specification of the console (CON) as the data source (example in 3.07).
32
Right Arrow ( > ) denotes an operation of output redirection, prepared by COMMAND.COM interpreter for execution of the program, specified in command line to the left of the Right Arrow sign. By default the standard output channel (STDOUT, handle 0001h) is directed to the console device (CON) - that is to the display's screen. Output redirection forces to direct STDOUT to another target - the one specified to the right of Right Arrow sign. For example, the DEL /? command (3.09) normally presents on-line help to display, but when it is followed by output redirection sign DEL /? > Filename.txt its output wouldn't reach the screen, it will be written into the specified file. A new file with the specified name (Filename.txt) will be created automatically in order to write there the redirected output. If a synonymous file exists yet, it will be overwritten without prompt, and its former contents will be lost. Besides files, allowable targets for redirection may be ports (LPT1, LPT2, COM1, COM2, COM3, COM4), printer PRN (which is usually equivalent to LPT1), display ( CON ) and special quasi-device NUL, which acts just as a "black hole": any output becomes lost there for ever (example in 3.21). This is often used in order to get rid of unwanted messages. If the default link between the STDOUT channel and the display device is disrupted by the CTTY NUL command (3.07), then sending output to display is still possible, but it needs explicit output redirection to CON device (examples in 9.03-02). Output redirection can intercept only those data, which are sent via DOS's normal STDOUT channel. Data sent via BIOS' interrupts (8.01-17, 8.01-21, 8.01-33), via DOS' INT 29 (8.02-88) and via STDERR channel for error messages (handle 0002h) can't be affected by STDOUT redirection.
33
Double Right Arrow ( >> ), just as single Right Arrow (2.04-03), is also a sign of output redirection, but its action is different, when target file for redirection exists yet. Rather than overwrite the target file anew, redirection with Double Right Arrow appends new data to former contents of the existing target file. All other peculiarities of output redirection with the Right Arrow (2.04-03) are applicable to Double Right Arrow as well. 2.04-05 Vertical bar (or "pipe")
Vertical bar or "pipe" separator ( | ) is a sign of intermediate redirection, i.e. data transfer from one utility (or command) to another. Especially for this purpose COMMAND.COM interpreter creates a temporary file. Utility placed to the left of "pipe" is executed first, and its output via STDOUT channel (via handle 0001) is written into this temporary file. Then control is transferred to the utility (or command) placed to the right of
34
Being used as the first symbol in batch file's command line, the "at" sign ( @ ) is interpreted as a command to prevent display of this line on the screen. Therefore almost each batch file begins with the "at" sign, followed by the ECHO OFF command. Sometimes such action is necessary not only in the first line (see 3.13, 6.25-02, 6.25-03 for examples). Note 1: DOS doesn't restrict usage of the "at" sign in filenames, but wrong interpretation of filenames with the "at" sign in a place of the first letter may lead to harmful consequences.
35
Chapter 3
3.01 3.02 3.03 3.04 3.05 3.06 3.07 3.08 3.09 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17
Internal commands
37 37 38 39 40 40 43 44 44 45 47 48 49 51 52 55 56 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29 3.30 3.31 3.32 3.33 3.34 Lock MD Path Pause Prompt RD REM REN Set Shift Time TrueName Type Unlock VER Verify VOL 57 57 58 58 59 60 61 62 62 63 63 64 64 65 65 66 66
Break Call CD CHCP CLS Copy CTTY Date DEL DIR Echo Exit For GOTO IF LFNFOR LH
Internal commands are those executed by command interpreter itself. Contrary to other utilities, which are to be searched for and read from their media, the interpreter is permanently present in memory, and therefore internal commands are executed much faster. Since internal commands are not to be searched for, the path for internal commands shouldn't be specified. One more common property of all internal commands is that after execution they don't leave errorlevel code. This chapter presents internal commands of Microsoft's proprietary command interpreter COMMAND.COM (file size 93812 bytes, file date 12.06.1996). Localized versions of this interpreter usually are slightly larger and have somewhat later date, but nevertheless execute the same set of internal commands. Among the described internal commands are those intended for batch files only (3.02, 3.14, 3.21, 3.27). The COMMAND.COM interpreter provides a short help for its internal commands. In order to display help text you have to type the command's name, followed by a space and the /? parameter, and then press the ENTER key. But the provided short help is often found too short. This chapter presents a lot of clarifications, which will help you to avoid common mistakes and to make internal commands usage much more effective.
36
The BREAK command is similar to synonymous configuration command (see 4.02 for details). They both affect the same binary flag, which controls checks of BREAK and CTRL-C keystrokes during disk access operations. This binary flag doesn't lose its state when current resident module of command interpreter finishes its job, and local environment becomes lost. Contrary to the IO.SYS loader (4.02), the COMMAND.COM interpreter shows current state of the mentioned binary flag in response to the BREAK command entered without parameters.
3.02
CALL is a command to execute one batch file (the secondary batch) from another batch file (the primary batch). Batch files are non-formatted textual command files, from which the COMMAND.COM interpreter accepts an extended set of commands. The CALL command is just one of those intended to be entered not from keyboard, but only from lines of batch files. Each line in a batch file may include a name of an internal command, or a name of an external utility, or a name of another batch file as well. When command interpreter encounters a name of external utility, it transfers control to this utility, but takes control back after the utility finishes its job, and proceeds to the next line in the same batch file. However, batch files don't behave like ordinary utilities. Having found a name of a batch file (the secondary batch) in a line of another batch file (the primary batch), the COMMAND.COM interpreter begins execution of the secondary batch and doesn't return to the primary one. In order to enable a return to execution of the primary batch file, the secondary one should be launched with CALL command, for example: CALL C:\DOS\VC4\Help.bat J 96 where: C:\DOS\VC4\ an example of a path to HELP.BAT file. If path is omitted, the file will be searched for inside current directory and then according to all path(s), specified by PATH variable. Help.bat an example of a name for the secondary batch file. J 96 specific parameters to be transferred to HELP.BAT file (other batch files may need other parameters or may not need them at all). In fact the CALL command prevents closure of the primary batch file, keeps stored segment of the primary batch file, its dummy parameters and its file pointer position (as a target to return), lets command interpreter to execute another (secondary) batch file, specified after the CALL command in the same line, and then restores access to requisites of the primary batch file, thus enabling a return back to execution of the next operation in the primary batch file.
37
3.03
CD change directory
When disk and path are not specified in command line, then MS-DOS implies presence of the addressed object in default (current) directory of the default (current) disk. Default disk assignment has been described in article 2.04-01. Default directory assignment is performed by CD command. The CD command enables to change current directory on any disk (but not the current disk itself) according to a specified path. For example, command CD C:\DOS will set current directory \DOS, if the current (default) disk is disk C:. CD command may be addressed to a disk, which is not the current one, but then specified path is taken into account as a preset, which will become the current (default) directory later, when the disk, specified in CD command, will be given status of the current disk (2.04-01). The path in CD command may be expressed in any of its allowed forms (2.02-01). The final word in the path must be either a name of target directory or any combination of alias signs (2.02-03, 2.03-02). Such combinations enable to perform transition into the root directory ( CD \ ), into parent directory ( CD .. ), to climb two levels up along the directory structure ( CD ..\.. ) and so on. CD command without path specification, for example CD C:
38
3.04
Codepage is an array of characters and symbols used to display messages on the screen. When the CHCP command is used without following codepage number, it shows the number of the codepage, which is currently active. Codepage changing function is usually disabled, unless 2 or more memory buffers for codepages have been prepared by DISPLAY.SYS driver (5.02-02), unless these buffers are filled yet with different codepages by the MODE.COM CON CP PREP command (6.18-03), and unless NLSFUNC.EXE driver (5.02-03) is loaded beforehand. Common practice is to load only one national codepage, because each national codepage contains not only national character set, but american english character set too. Switching between these character sets doesn't imply codepage change: it is performed inside any single national codepage. Loading several national codepages becomes needed when there is no one codepage, containing character sets for the languages, which you intend to use. For example, if you prepared norwegian codepage 865 and russian codepage 866, then commands CHCP 865 and CHCP 866 will perform switching between these codepages. Note 1: codepages may be changed with MODE.COM CON CP SEL command (6.18-03), which doesn't need to have NLSFUNC.EXE driver loaded. Note 2: the CHCP command can't cope with national codepages, loaded by non-Microsoft's drivers, for example by KEYRUS.COM (5.02-05). Note 3: if you use national version of an important utility or of a TSR shell (for example, Norton Commander with russian notation), then changing of the codepage will make this national notation totally non-readable! Only american english notation (characters 32 127, common for all codepages) will not be affected by codepage change.
39
The CLS command erases all contents of the current screen page in video card memory and also sets colors to default values, thus providing for white text display on a black background.
3.06
The COPY command is used to copy one file or several files at once. It also enables to concatenate files and to combine copying with renaming. Here is an example of copying one file into another location: COPY /A C:\DOS\MS7\Trial.txt A:\DOS /V /Y where: /A parameter, indicating that the specified source file must be copied no further than the first end-of-file mark (1Ah). For copying only one file into a target file, the opposite /B parameter is taken instead by default. It forces to copy a file as a whole, ignoring end-of-file byte 1Ah, which might play quite different role(s) inside executable files and in binary data files. C:\DOS\MS7\ is an example of a path to the source file. For allowable alternative forms of path specifications see 2.02-01 - 2.02-03. If path to the source file is not specified, this source will be searched for within the current directory only (paths inside the PATH variable are ignored by COPY command). Trial.txt an example of a name for the source file to be copied. If source file name has an extension, it must be specified. Source file may have "A" (Archive) and "R" (Read-only) attributes. Source files with "H" (Hidden) and "S" (System) attributes are not copied. A:\DOS an example of a path to the existing target directory, where the copy should be placed. But if the \DOS directory doesn't exist, DOS will be interpreted as a new name for the copy, and a copy named DOS will be created in the root directory of disk A:. If you don't intend to rename the copy, target path must differ from the source path. If the source is not in the current directory, target path may be omitted, and in this case the current directory will be implied as the target. /V an optional parameter, inducing verification of the copy. It makes copying more slow and is not needed, when the target media is a hard disk. But when the target media is a floppy, the /V parameter may be worth the delay. /Y an optional parameter, giving permission to overwrite any synonymous file in the target directory without prompt. The /Y parameter may be
40
41
42
3.07
The CTTY command changes settings for all the tree standard I/O channels: STDIN, STDOUT and STDERR. Initial default I/O settings are equivalent to those set by the CTTY CON command: all channels are linked with the CON device (console), that is with the keyboard for input and with display for output. Instead of the console (CON) the CTTY command may accept one of following ports: COM1 (AUX), COM2, COM3, COM4, LPT1 (PRN), LPT2 and also virtual device NUL (for output into "nowhere"). CTTY is an archaic command. Its name (CTTY = Change TeleTYpewriter) reminds about the times when there were no displays, and the I/O consoles resembled old-fashioned teletypes. Nowadays there are 2 reasons to use CTTY in batch files. The first is to prevent accidental interruption of execution; the second is to prevent indication of undesirable error messages, sent via DOS's STDERR channel, which can't be redirected otherwise. In both cases the problem is solved by redirection into nowhere, represented by virtual NUL device: CTTY NUL precedes the group of commands to be protected, and later CTTY CON restores normal communication with keyboard and display. Inside the protected group of commands (between CTTY NUL and CTTY CON) both internal and interactive interruptions of execution are not allowed, because otherwise no message will be displayed, no input will be accepted, and PC may seem to get hanged. Reboot via CTRL-ALT-DELETE usually remains accessible, though. CTTY command affects only implicit I/O settings, but it doesn't affect redirections, which are specified in command lines explicitly (2.04-02 - 2.04-05). For example, let's consider the following piece of a batch file: @ctty nul copy /B Trial.dat Suit.dat echo Press any key to exit > con pause < con ctty con Here a message from the COPY command will not reach the screen, even if it will be an error message. But the message "Press any key to exit" will be shown, because it is directed to the CON device explicitly. The next PAUSE command will work properly too, because its input is explicitly linked with keyboard. This form of CTTY usage needs some caution, but opens attractive opportunities to affect interaction with the user. An example of a batch file with this form of CTTY usage is shown in article 9.03-02.
43
3.08
In order to set a new date one has to specify this new date after the name of the DATE command in command line, for example: DATE 11.07.2002 When date is not specified, the current date will be shown, and then you will be offered to input a new date via keyboard (pay attention to note 2 below). If you don't want to change the date, just respond to the offer by pressing the ENTER key. Letters and other textual files are often appended with a line with data signature. For this purpose the DATE command should be used, for example, in the following way: ECHO= | DATE | Find.exe "Current" >> Anyfile.txt Here the first redirection ( ECHO= | DATE ) automatically responds to the displayed offer and enables non-stop action, the second redirection ( DATE | Find.exe ) excludes undesirable output lines, and the third redirection ( >> Anyfile.txt ) appends date signature to the specified file. Of course, all conditions for performing redirections (2.04-05) and for finding files (Find.exe and the one to be appended) should be met. Note 1: date and month data order is country-specific and should be set by COUNTRY command (4.05). Note 2: the offer for date change is supplemented with a prompt for a two-digit year data, but it is a bug: MS-DOS7 demands 4-digit year data.
3.09
The DEL (DELete) command doesn't physically erase files, but rather disables their entries in directory specification. The clusters, occupied by a file with invalid entry, are considered free and may be overwritten during following operations. But until these clusters are not overwritten, the deleted file may be restored, for example, by the UNDELETE.EXE utility from Norton Utilities release. Here is an example of a command line with the DEL command: DEL D:\TEMP\Filename.ext /P where:
44
3.10
In MS-DOS the DIR ( DIRectory ) command is the main instrument of exploring the directories' contents. Here is an example of a command line with the DIR command: DIR C:\DOS /P /A:HS /O:GN /S /L /V where: C:\DOS an example of a path to the directory to explore. If not specified, current directory is implied.
45
/O:GN
/S /L /V
The DIR command can be used to show data about a particular file or about all files conforming to a given filemask: DIR *.txt /P /S /B Absence of path specification in combination with /S parameter in the latter example means that the DIR command in fact will perform a search for files with *.txt suffix in the current directory and in all its subdirectories. If current directory is the root, the search will proceed throughout the current disk. If you are interested in finding a forgotten file only, the /B parameter will make the result more concise and easy to apprehend. Parameters for the DIR command may be preset in the DIRCMD environmental variable (for example, with command SET DIRCMD= /P /S /B ), and then you will get the desirable action of DIR command by default. If needed, you may later override any preset parameter by prefixing a hyphen "" to it in command line (for example, /P ). When DIR command is executed with /A parameter, then the *.* filemask (all files) doesn't exclude directories. If you need to display files only, you ought to provide /A: D
46
3.11
The words, specified in the same command line after the name of ECHO command are sent as a message into the STDOUT channel; unless redirected, its default terminal point is the CON (console) device, displaying the message on the screen. Examples of string output with the ECHO command are shown, in particular, in previous article 3.10. The message to display may be up to 123 characters long. Actual message length is limited by the line itself or by the first encountered redirection symbol (2.04-02 2.04-05). Message string may include ASCII service marks, shown in appendix A.02-8. But message string must not be empty or begin with words ON or OFF. These and several other exceptions are used to perform special functions: ECHO ON switches ON the ECHO flag, enabling to display batch file lines as they are executed (this is the default status).
47
3.12
Command interpreter COMMAND.COM (6.04) is a resident program, which arranges environment for execution of other programs. On the other hand, command interpreter itself may be launched just as an ordinary program in order to arrange a separate (local) environment, if it is required. In such cases several resident modules of command interpreter may coexist in memory simultaneously, but only one of them may be active the one which is loaded the last. The EXIT command closes current session of the active resident module, releases the memory occupied by the module, and transfers control to the parent program (which has launched the mentioned resident module). Just as current interpreter session is closed, its local environment with all values and variables becomes lost. At the same time the former environment of the parent program becomes accessible again, and execution of this program is automatically resumed. The very first resident module of command interpreter is launched by the IO.SYS loader with the SHELL command (4.26) in CONFIG.SYS file (9.01-01). This first resident module can't transfer control to its "parent", since the IO.SYS loader is not resident and has finished its job yet. If the first resident module of command interpreter were able to execute the EXIT command, then computer were get hanged. To prevent such outcome the COMMAND.COM interpreter must be launched for the first time with the /P parameter (6.04), which disables EXIT command.
48
The FOR cycle operator arranges cyclic execution of other command(s). Assume, for example, that we need to display three short files: First.txt, Second.txt and Third.txt. Instead of sending these files to display with separate commands, the FOR operator enables to do the same in one line: FOR %Z IN (First Second Third) DO TYPE %Z.txt where: %Z an example of a name for cycle variable, which is sequentially set equal to each of the items specified in parenthesis. Cycle variable name shouldn't commence with a digit. Usually it is a one-letter name, preceded by a percent symbol ( % ), when the cycle is executed from command line, or by double percent symbol ( %% ), when the cycle is executed from a batch file. a required reserved word, introducing the following list of variable's values, specified inside parenthesis. a required reserved word, introducing the following name of the command, which is to be executed in the cycle as many times as many values are specified for the cycle variable. In each iteration a new value is substituted for the name of cycle variable.
IN DO
Item(s) in parenthesis may be any word(s), including environmental variable substitutions (such as %TEMP%) and dummy parameter substitutions (2.03-03). Items in parenthesis may be separated by spaces, or by semicolons ( ; ), or by commas ( , ). Note, that paths in PATH variable value are separated by semicolons, hence the PATH's value will be disintegrated by the FOR cycle into a group of separate paths. This operation is often used in order to determine accessibility of a given file or in order to provide explicit path specification for it. The following piece of a batch file shows a typical path determination example: @echo off set P= FOR %%Y IN (. %PATH%) DO if exist %%Y\Fc.exe set P=%%Y\Fc.exe if %P%"==" echo Requested file hasn't been found! if not %P%"==" echo Path to the requested file is %P% Here in the second line an auxiliary variable P is assigned an empty value, and in the third line - the path to the specified file, if the latter happens to be found. Note, that cycle variable name ( %%Y ) is preceded by double percent symbol, as it must be in batch files. The last two lines check presence of auxiliary variable's value and issue a corresponding message according to the result.
49
50
3.14
The GOTO command performs a jump within batch file to a label, which must be specified in any line of the same batch file. A line with label begins with a colon ( : ), and after the colon an arbitrary label's name follows. The same name must be specified after GOTO command. When label's name is long, its first 8 characters only are taken into account. Synonymous labels in one batch file are not allowed. If, for example, there is a label :L36 in some line of a batch file, then a jump to this label is performed by command GOTO L36 The GOTO command may be preceded in the same line by conditional operator IF (3.15). A lot of jump examples, both conditional and unconditional, can be found in articles 9.03-02, 9.09-02. Note 1: label name after the GOTO command can be obtained by substitution for a variable's name (%VAR%, for example). Note 2: a value of dummy parameter (%1, %2..) cannot be used after the GOTO command as name of a label, but it may constitute a part of this name after any preceding letter(s). Note 3: the GOTO command doesn't affect errorlevel, thus giving an opportunity to continue errorlevel checks after the jump.
51
Condition operator enables to perform three types of condition checks: existence check, equality check and errorlevel check. Command line with conditional execution of any operation must commence with conditional operator IF, followed by condition type definition, condition specification and full specification of the command, which should be executed if the condition is met. Several condition operators with separate condition definitions and specifications may be written sequentially in one line, and then logical operation AND is applied implicitly to results of separate condition checks. Examples of combining several condition checks in one line are shown in articles 3.15-03, 9.03-01, 9.09-02. Peculiar composition of command line for each type of condition checks is described below in detail. 3.15-01 Existence condition check
Existence condition check, performed by IF EXIST command, can be applied to files, directories and logical devices. Inversion of existence condition absence condition check is performed by IF NOT EXIST command. Here are two examples of existence check usage: IF EXIST C:\DOS\Format.com C:\DOS\Format.com A: /S IF NOT EXIST C:\DOS\Format.com ECHO Format.com isn't found! where: EXIST a reserved word, defining type of check and forcing to interpret the following element as a name or a mask (may be with path) of the object to be searched for. C:\DOS\Format.com an example of a filename to be searched for; preceded by a path. This filename will be searched for in the specified directory only. When path is omitted, then current directory is implied. C:\DOS\Format.com A: /S an example of a utility to be launched if the preceding condition is met ( if the check returns TRUE). Note, that utility name should be followed by all necessary parameters. When path is not specified, the utility will be searched for in current directory and then along all the paths, stored in PATH variables value. NOT a reserved word, meaning a logical inversion of the result (TRUE or FALSE), returned by a check of any condition type. ECHO Format.com isn't found! another example of a command to be executed depending on preceding condition (when the utility is NOT found).
52
Equality condition check is applied to two words, separated by double equality symbol ( = = ). Since there is no sense in comparing a-priori known words, equality condition implies using aliases, which may be dummy parameter(s) or variable's value(s) (2.03-03). Wildcard symbols ( ? and * ) in words to compare are allowed, but these are interpreted as ordinary symbols and are not expanded as wildcards. Contrary to ordinary DOS' practice, upper and lower case letters in words to compare are regarded as NOT equal. Here are two examples of equality check usage in batch files: IF %VAR%==%2 GOTO L23 IF NOT %VAR%==%2 GOTO HELP
53
When execution of any utility in DOS is about to terminate, it may leave errorlevel code, which is in fact a message to the following algorithms. Errorlevel informs whether the terminated execution has been successful or not, and if not, then what kind of obstacle
54
3.16
LFNFOR is an undocumented local switch, which may be set ON (LFNFOR ON) or OFF (LFNFOR OFF). Being used without parameters, LFNFOR command shows the state of this switch. It's default state is OFF. Under "bare" MS-DOS7 the state of LFNFOR is ignored, but inside DOS box under Windows OS switching LFNFOR ON enables non-truncated treatment of long file names by the FOR command (3.13), for example, by FOR %%Z in (*.*) do echo %%Z
55
3.17
The LH command (LH = Load High) loads drivers and TSR utilities beyond the 640 kb boundary of conventional memory in computers having the 80386 or higher processor. Access beyond the 640 kb boundary must be enabled in advance by command DOS=UMB (4.08) in CONFIG.SYS file and by loading memory managers: the HIMEM.SYS driver (5.04-01) and then either EMM386.EXE (5.04-02) or UMBPCI.SYS (5.04-04) driver. In both cases access to the TSR modules, loaded by the LH command, will be performed via the UMB region (640 - 1024 kb) of address space. When there is no more free space in UMB region, the LH command issues no error message and continues to load drivers and TSR utilities into conventional memory below 640 kb. LH acts similar to the INSTALLHIGH command (4.16); the main difference is that INSTALLHIGH command is performed by the IO.SYS loader and can't take part in memory optimization procedure (5.04-03). The LH command is performed by COMMAND.COM interpreter from ordinary command line or (preferably) from a line in AUTOEXEC.BAT file. Here is an example of a line from AUTOEXEC.BAT file, in which the LH command is used to load MSCDEX.EXE driver: LH /L:1,23680 \DOS\DRV\Mscdex.exe /D:CD1 /E /S /V /L:O /M:32 The name of the driver is preceded by a path ( \DOS\DRV\ ), which may take any of its allowed forms (2.02-01). If the path is omitted, the driver will be searched for in the current directory and throughout all the paths, specified in PATH variables value (2.02-02). All items following the driver's name are not identified by LH command, but rather are transferred to the driver as its specific parameters. Between the name of LH command and specification of the software to be loaded there may be an optional /L parameter, which gives an opportunity to point out a particular part of USB memory region, which should be devoted for access to each TSR module (see also 4.07). In the example above this parameter looks as /L:1,23680, where /L:1 means addressing via the first part of UMB region, and the number 23680 is the size of space (in bytes) required for TSR module of MSCDEX.EXE driver. Size specification after the /L parameter is optional, but when the size is specified, the LH command can accept one more parameter /S, for example: LH /L:1,2160 /S \DOS\COM\Escape.com The /S parameter means that allocated UMB block should be truncated to the specified size. This results in the most efficient usage of address space, but doesn't guarantee from a crash, if size specification is not quite correct. It is not recommended to
56
3.18
Requests of various programs for disk access are controlled by MS-DOS7 in order to provide proper order of access and effective buffering. Programs, which require direct access to a disk, must coordinate their operations with MS-DOS7 by means of the INT 13\AH=45h interrupt (8.01-58). But some programs don't do that, for example, the program for recovering deleted files UNDELETE.EXE from MS-DOS6.22 release. In order to permit such programs to do their job the COMMAND.COM interpreter in MS-DOS7 provides the LOCK command. It gives exclusive rights to access the requested disk for the program, which will be launched next. Arguments for the LOCK command are one or more letter-names of the disks, which should acquire exclusive treatment. During execution of LOCK command you will be asked for confirmation (Y or N) from keyboard. In order to avoid stops for confirmation in batch files you have to prepare a response in advance, for example ECHO Y | LOCK C: D: The result of the shown command line will be excusive non-interrupted access to disks C: and D: for the program which will be launched next. When this program terminates, the locked state of disk(s) should be turned off by UNLOCK command (3.31). Since direct access operations may be nested, up to 256 lock levels are allowed. Of course, each involved program must be supported by proper sequence of LOCK and UNLOCK commands.
3.19
MD make directory
The MD command enables to create a new directory or subdirectory, for example: MD C:\DOS\ARC where:
57
3.20
The PATH command defines the default paths for searching programs, which have no prescribed path and are not present in the current directory. The paths, specified by PATH command, constitute the value of synonymous environmental variable PATH. Its value may be defined by SET command (3.26) as well. But there is an important difference: unlike SET command, PATH command automatically converts all the characters in the specified path(s) into upper case (otherwise search procedure may go wrong). The PATH command must be followed by one or more existing paths, separated by semicolon(s), for example: PATH C:\DOS\VC4;C:\DOS\MS7;C:\WINDOWS\COMMAND Ability of PATH command to convert arbitrary word(s) into upper case is sometimes used in order to avoid ambiguities further in course of case-sensitive equality check. Note 1: within a string of path specifications there must be no spaces on both sides of each semicolon separator. Note 2: there must be no semicolon at the end of a string of path specifications. Note 3: the PATH command with no following arguments just displays the defined paths and leaves them unchanged. Note 4: the PATH ; command (followed by one semicolon only) deletes all previously defined paths. Note 5: the name of PATH command may be separated from the following string of path specifications by either a space or by equality sign ( = ) as well.
3.21
The PAUSE command, being encountered in a line of a batch file, stops execution of this batch file and displays message "Press any key to continue...". This message is not quite true, because CTRL-C, CTRL-BREAK and ALT-03 keystroke combinations terminate execution, enabling to bypass all the rest lines of batch file (this action doesn't depend on the BREAK status). When PAUSE's message is not desirable, it may be redirected:
58
3.22
Command PROMPT redefines the value of synonymous environmental variable PROMPT, which specifies the form of DOS's command prompt. Usually the PROMPT command is written in a line of AUTOEXEC.BAT file, but it also may be entered from an ordinary command line. The name PROMPT should be followed by the suggested prompt text. In this text pairs of characters, beginning with a dollar symbol ( $ ), are interpreted in a special way and are substituted with other data, which can't be written into prompt text directly. Here is a table of correspondence between character pairs and the substituting data: $Q equality sign ( = ) $$ single dollar symbol ( $ ) $T current time $D current date $P current disks letter-name and path to current directory $V Windows' version number $N current disks letter-name $G right arrow (or greater-than) sign ( > ) $L left arrow (or less-than) sign ( < ) $B vertical bar (or pipe) sign ( | ) $H the 08h code "Backspace" (A.02-8) $_ carriage return (0Dh) and linefeed (0Ah)
59
The PROMPT command without arguments deletes the variable PROMPT, and then DOS's prompt would present current disks letter-name appended with right arrow sign ( > ), the same prompt as after command PROMPT $N$G. By default MS-DOS7 assigns to the PROMPT variable another value ( PROMPT $P$G ), which corresponds to most common form of command prompt: full path to the current directory appended with right arrow sign. The data, displayed by prompt, can be written into a file and then assigned as a value to an environmental variable. Consider the following example of batch file lines: prompt @echo off$_Set Ret$q$p C:\Command.com /c Ret.bat > Ret.bat Call Ret.bat The first line in the example above sets a complicated form of a prompt, and the second line writes this prompt into a new batch file RET.BAT. Obtained RET.BAT file's contents may look as follows: @echo off Set Ret=D:\BACKUP Note, that prompt parameter "Set Ret$q$p" has been transformed into "Set Ret=D:\BACKUP", where "D:\BACKUP" is an example of current disks lettername followed by actual current path at the moment of batch line execution. If you execute the RET.BAT file with CALL command (3.02), then actual full path will become written into value of environmental variable RET. After that you can delete RET.BAT file and may use the RET variable whenever necessary in order to return to the former disk and directory: %Ret%\ CD %Ret% Another example of PROMPT command usage for obtaining current disks letter-name is shown in article 9.01-03. Current time, date and OS version number can be written into environmental variable(s) in a similar way.
3.23
RD remove directory
The RD command (Remove Directory) enables to delete a directory, if the following conditions are met: the directory to be deleted is empty; the directory exists on a writable disk; the directory is not the root directory of a disk;
60
3.24
The REM command (REMark) forces COMMAND.COM interpreter to ignore all the following character(s) in the same command line up to any nearest sign of redirection (2.04-02 - 2.04-05) or up to the end of the line. Main mission of the REM command is to provide an opportunity to insert lines of commentaries in batch files. Commentaries may be up to 123 characters long in one line. The REM command is used for those commentaries, which shouldnt be displayed during normal execution of a batch file, but rather are to be displayed only for tracing while the ECHO flag is kept ON (3.11). The REM command is sometimes used to disable an executable line in a batch file, but it can't disable redirection. Double colon "::" (2.04-01) is more suitable for this purpose. The other mission of REM is an "empty" command, which is accepted as valid and formally is executed, but does nothing (see VCEDIT.EXT in 6.25-03 for an example). Since the REM command sends no output into STDOUT channel, redirection REM > Anyfile.ext is used to create an empty file with specified name. If a synonymous file exists there yet, it will be overwritten and will become empty. Overwriting of a real file with a file of zero length erases address of its first cluster in directory specification. Therefore files, overwritten by a file of zero length, can't be restored by UNDELETE.EXE or by other similar utilities. Note 1: REM command shouldn't be used to disable command lines with intermediate redirection (2.04-05). The REM command disables only the first command in such line, its output is not sent, and command in the rest part of command line never gets the awaited data. Therefore computer may get hanged (example in article 3.21). Note 2: inside "DOS box" of Windows OS empty redirections are not performed, so there the REM command can't be used to create a file of zero length.
61
The REN command (REName) enables to rename one file or several files at once if their names conform to a certain mask. Here is an example of renaming one file with REM command: REN C:\DOS\Notes.txt Notes.old where: C:\DOS\ an example of a path to the file to be renamed; the path may be specified in any of its allowed forms (2.02-01, 2.02-03) or may be omitted. Notes.txt current name of the file to be renamed. Notes.old an example of new name for the same file; the new name must be specified without preceding path, even if the file to be renamed exists anywhere else beyond the current directory. Specifying wildcards within the first (old) name only is allowed, but often leads to an error: attempt to create several synonymous files in one directory. Therefore it is recommended to specify wildcards in the same positions in both old and new filenames, so as to retain unique features of each filename. Characters hidden under wildcards will not be changed. Suppose there is a group of files Part_01.txt Part_12.txt, which should be renamed into Chap_01.txt Chap_12.txt. This operation is performed with one command: REN Part_??.txt Chap_??.txt Note 1: directories and files with H (hidden) attribute can't be renamed by the REN command. Note 2: attributes of the renamed file(s) remain unchanged.
3.26
When SET command is specified without parameters, it displays all variables of the current environment together with their values. But if name of the SET command is followed by any word, this word is interpreted as a name of environmental variable, which should be assigned a new value, for example: SET TEMP=D:\Temp where: TEMP is an example of variable's name; D:\Temp is the value to be assigned to the variable TEMP. Equation sign(s) and redirection symbols (2.04-02 2.04-05) inside value specification are forbidden.
62
3.27
The SHIFT command shifts by 1 (minus one) the numerical order of dummy parameters (2.03-03) in a batch file, so that former %0 is lost, former %1 becomes %0, former %2 becomes %1, and so on. It's important to notice, that the dummy parameter, which becomes the 9-th, previously was the 10-th and couldn't be accessed. Thus the SHIFT command gives an opportunity to specify more than 9 dummy parameters for a batch file and to access them sequentially, shifting their numeration from one iteration to each next. An example of such numeration shift is presented by a subroutine in lines 29 38 of DISK.BAT file in article 9.03-02. When the shifted address order comes to the end of parameter's sequence, the last dummy parameter becomes empty, and this is a sign to terminate execution of the whole cycle containing the SHIFT command.
3.28
In order to set a new time one has to specify this new time after the name of the TIME command in command line, for example: TIME 11:39:23,24 where the successive numbers mean hours, minutes, seconds and the hundredth parts of a second. Separation symbols within the shown time specification are colons and a comma, but it depends on what national conventions are set by the COUNTRY command (4.05). When time is not specified, the current time will be shown, and then you will be offered to input a new time via keyboard. If you don't want to change time, just respond to the offer by pressing the ENTER key.
63
3.29
Any specification, following TRUENAME command in the same command line, is interpreted as name of an object (file or directory), which may be preceded by a path. The TRUENAME command doesn't check whether the given specification corresponds to a real file or to a real directory structure, but rather tries to translate it into canonical form, which must commence with disks letter-name and must include full path to the object. If the given specification isn't complete, it may be automatically supplemented with letter-name of the current disk and a path to the current directory. If the given specification contains dot aliases (2.02-03), these will be expanded to full paths which they denote. Besides this, all letters are uppercased, forward slashes are converted to backslashes, asterisks (2.01-03) are converted into appropriate number of question marks, long names are truncated to 8 characters, long suffixes to 3 characters. If the original specification points out a fake path, arranged by utilities ASSIGN.COM, JOIN.EXE or SUBST.EXE, then the TRUENAME command returns the true path. When used without following specification, the TRUENAME command returns full path to the current directory, just as CD command (3.03). Note 1: the TRUENAME command doesn't display error messages. Note 2: the TRUENAME command can't be applied to network paths, unless a LAN driver is installed. Note 3: the action of TRUENAME command is based on INT 21\AH=60h (8.02-72).
3.30
The TYPE command reads contents of a specified file and sends it line-by-line into STDOUT channel, which has the CON device (display) as its default terminal point. Sending may be terminated by CTRL-C or CTRL-BREAK keystrokes, or suspended by pressing CTRL S or BREAK keys and then resumed by any other keystroke. Usage example: TYPE C:\DOS\Notes.txt
64
3.31
After termination of each program, which has been given direct access to a disk with LOCK command (3.18), the original access state should be restored by the UNLOCK command, applied to the same disk, for example: UNLOCK C: In fact the UNLOCK command doesn't permit concurrent access, but rather decreases by 1 the count of nested ban levels, forbidding concurrent access. Thus a proper treatment of nested program calls is provided. But if the original ban level was 1, then UNLOCK command will reactivate a queue of requests for access to the disk. This is important in multitasking operating environment, for example, in "DOS box" under Windows95/98 OS. If a disk originally is not locked, no action will be taken by the UNLOCK command. In any case no message will be displayed.
3.32
In MS-DOS7 and in MS-DOS8 the VER command (VERsion) shows version number of the corresponding WINDOWS software release. Having been supplied with /R parameter VER /R the VER command appends its version message with a remark about whether the DOS's kernel is loaded into high memory area or not.
65
VERIFY command, being launched without parameters, indicates the state of verification function, which defines whether or not each written file should be re-read and compared with its origin. By default the verification function is turned OFF, and verification is not performed. You can change the state of verification function with VERIFY ON or VERIFY OFF commands (more about this in note 2 to 8.02-60). Note 1: high reliability of modern HDDs makes verification unnecessary, it leads to time loss and to excess disk wear. It is better to initialize verification by the /V parameter of COPY command (3.06) for copying file(s) only to diskette(s). Note 2: the VERIFY function acts as a global switch: it doesn't loose its state when current resident module of command interpreter finishes its job and local environment becomes lost.
3.34
Disk's label is a string of up to 11 characters long, chosen by the user. If the user wouldn't define label while formatting, disk will be given the NO NAME label. Later disk's label may be changed with the LABEL.EXE utility (6.16) or by means of some TSR shells (Norton Commander, Volcov Commander, etc.). Serial number is a 8-digit hexadecimal identifier, which is automatically assigned to a disk during formatting procedure. Diskettes may have no serial number, if their production technology employs formatting by magnetic contact copying. Contrary to this during ordinary copying procedures both label and serial number are inherited by diskette-copy from diskette-origin. In order to display label and serial number of a particular disk, you have to specify its letter-name after the name of the VOL (= VOLume) command in the same command line, for example: VOL A: If disks letter-name is omitted, then volume label and serial number of the current disk will be displayed.
66
Chapter 4
4.01 4.02 4.03 4.04 4.05 4.06 4.07 4.08 4.09 4.10 4.11 4.12 4.13 4.14 4.15
Configuration commands
68 68 69 69 69 70 71 72 73 74 74 74 75 75 76 4.16 4.17 4.18 4.19 4.20 4.21 4.22 4.23 4.24 4.25 4.26 4.27 4.28 4.29 4.30 Installhigh LastDrive Lastdrivehigh MenuColor MenuDefault MenuItem Multitrack NUMLOCK REM Set Shell Stacks Stackshigh Submenu Switches 77 77 78 78 78 78 79 80 80 80 81 82 82 83 83
ACCDATE Break Buffers Buffershigh Country Device Devicehigh DOS DRIVPARM FCBS FCBSHIGH Files Fileshigh Include Install
MS-DOS7 loading configuration is prescribed by configuration options in three non-formatted textual files, which must be present in root directory of the bootable disk: MSDOS.SYS (5.01-01), CONFIG.SYS (9.01-01) and AUTOEXEC.BAT (9.01-02). Among these the CONFIG.SYS file has the most long history in previous versions of DOS. It defines a number of very important parameters and a set of software drivers to be loaded at boot time. Each line in CONFIG.SYS is a command to the IO.SYS loader (5.01-01). Interpretation of commands by the latter differs considerably from that by the most known command interpreter, the COMMAND.COM (6.04). There must be other commands and other syntax in CONFIG.SYS file. Though several configuration commands (4.02, 4.24, 4.25) are synonymous to those executed by the COMMAND.COM interpreter, the IO.SYS loader deals with them in a different way. The loader doesn't allow to omit file's suffixes, doesn't execute redirections, doesn't substitute variable's values for their names. Command execution order in CONFIG.SYS depends not only on line's order, but also on command's priorities (see 4.15 and 4.25 for details). There is a group of commands (4.19, 4.20, 4.21, 4.29), which can be specified in menu and submenu blocks only, and other commands (except 4.23) in these blocks can't be used. Several commands (4.01, 4.04, 4.11, 4.13, 4.18, 4.28) have no equivalents in previous versions of MS-DOS; some other commands (4.08, 4.30) have been changed in MSDOS7, new parameters have been added. Inherited configuration commands, which invoke
67
4.01
The ACCDATE command (ACCess DATE) enables or disables writing the date of last access into a directory entry (A.09-1), related to the accessed file. By default the last access date is registered in hard disk drives, but is not written on floppies. In a command line after the name of ACCDATE command you may specify any number of disks letter-names with following plus sign (= permit registration) or minus sign (= prohibit registration), for example: ACCDATE C+ D- E- RWhen access date registration is disabled, disk access operations are performed faster.
4.02
The BREAK command affects the state of a binary flag, which controls disk access intercepts. By default the BREAK flag is turned off, and then the BREAK and CTRL-C keystrokes (1.03) are checked only during the CON driver addressing operations. Hence the user can suspend or terminate execution of current procedure only when the latter addresses the CON driver: sends output to screen or waits for input from keyboard. The BREAK flag can be turned on with command: BREAK ON Since that moment the BREAK and CTRL-C keystrokes will be checked during disk access operations too. This gives an opportunity to suspend or to terminate execution of current procedure at the moments it addresses disk drives. Additional check makes disk operations a little slower. To disable the check the BREAK flag should be turned off with command: BREAK OFF After successful termination of IO.SYS loader's mission the BREAK command remains supported by command interpreter COMMAND.COM (3.01).
68
Command BUFFERS reserves memory for buffers each 512 bytes long, which serve as a cash for sectors read from disks. By default MS-DOS7 arranges 30 primary buffers and 0 secondary buffers. The BUFFERS command enables to create from 1 to 99 primary buffers and from 0 to 8 secondary buffers. Secondary buffers are needed when double buffering should be arranged by the DBLBUFF.SYS driver (5.06-02). For example, command BUFFERS=12,6 reserves 9 kb of memory for 12 primary and 6 secondary buffers. Disk reading and writing operations may become slow when number of buffers is less than 30. But when the SMARTDRV.EXE driver (5.06-01) is installed, then the number of buffers can be reduced to 10. Note 1: by default the buffers are created beyond the 640 kb boundary of conventional memory, but may be arranged below 640 kb, if in DOS command (4.08) the NOAUTO parameter is specified, and also if the address space in UMB region is insufficient or unavailable (availability conditions in 4.07). In any case no error message will be displayed. Note 2: in some computers the DMA controller can't provide access to UMB region or to its part, though the whole UMB region is opened by UMBPCI.SYS driver (5.04-04). In such computers it's better to arrange buffers outside UMB region: in conventional memory or in a space beyond 1088 kb, opened by EMM386.EXE driver (5.04-02). Sometimes this problem can be solved by auxiliary LOWDMA.SYS driver, supplied together with UMBPCI.SYS.
4.04
The BUFFERSHIGH command is almost equivalent to BUFFERS command (4.03), except that BUFFERSHIGH command attempts to arrange buffers beyond conventional memory despite presence of NOAUTO parameter in DOS command (4.08). All other information in article 4.03 is equally applicable to BUFFERSHIGH command.
4.05
The COUNTRY command initializes selective copying of national adaptation data from COUNTRY.SYS data file (5.02-01) into internal DOS's data tables (A.02-4, A.02-5). Thus DOS settings become adapted to localized rules of a particular country. Besides other features, national adaptation enables access to files and directories having specific national characters inside their names. Here is an example of a line with COUNTRY command:
69
4.06
The DEVICE command is used to load those drivers, which have a header of special format (A.05-1) and should be loaded into memory when DOS's system structure arrangement is not finished yet. Most often (but not necessarily) these drivers are given the *.SYS suffix. Drivers with *.COM and *.EXE suffixes may have no special header, and then such drivers should be loaded not by DEVICE command, but by INSTALL command (4.15). Here is an example of a line with DEVICE command loading a driver with *.SYS suffix: DEVICE=C:\DOS\DRV\Himem.sys /EISA /V where: Himem.sys an example of drivers name C:\DOS\DRV\ an example of a path to the driver /EISA /V an example of a parameters group for the driver; it must conform to parameters specifications for this particular driver. Here is one more example of a DEVICE command loading another driver: DEVICE?=\DOS\DRV\Emm386.exe RAM /V Besides the driver itself, the latter string presents two differences. First, the path (\DOS\DRV\) without preceding disks letter-name is suitable for loading from any disk, even when the disks letter-name is not known beforehand. The second difference is an optional question mark "?", appended to the DEVICE command. This mark forces the IO.SYS loader to suspend further execution and to display the line, followed by a query whether to load the specified driver or not: [Enter=Y, Esc=N]? Thus the DEVICE command may be used to compose selective loading configurations. Note 1: by default the drivers are loaded beyond conventional memory (above 640 kb), but may be loaded below 640 kb, if in DOS command (4.08) the NOAUTO parameter is specified, and also if address space in UMB region is insufficient or
70
4.07
The main purpose of DEVICEHIGH command is almost the same as that of the DEVICE command (4.06), but DEVICEHIGH command attempts to load drivers beyond conventional memory despite presence of NOAUTO parameter in DOS command (4.08). Of course, the UMB region address space must be made accessible beforehand. Therefore the following conditions must be met: computer must be equipped with 80386 or newer processor; the UMB parameter must be specified in DOS command (4.08); HIMEM.SYS driver (5.04-01) must be loaded yet by DEVICE command; either EMM386.EXE (5.04-02) or UMBPCI.SYS (5.04-04) driver must be loaded yet by DEVICE command in the following line of CONFIG.SYS file. When DEVICEHIGH command is used in its simplest form, for example DEVICEHIGH=C:\DOS\DRV\Setver.exe the specified driver (Setver.exe) will be loaded so that it could be addressed via that part of UMB region, which has the largest free block of address space, provided this free block is sufficient for the specified driver. Just as DEVICE command, the DEVICEHIGH command can be appended by a question mark: DEVICEHIGH?=... . It will cause this line to be displayed, then execution will be suspended with an offer for the user to decide whether the shown driver is to be loaded or not. The DEVICEHIGH command gives an opportunity to specify a particular area of UMB address space for access to the loaded driver, for example: DEVICEHIGH /L:1,15792 =C:\DOS\DRV\Display.sys CON=(EGA,,1) where: /L:1 15792 an example of UMB address space area number: it may be found from listing, shown by the MEM.EXE utility (6.17), being executed with /F parameter. optional size of address space to be devoted to the specified driver (generally it is not equal to driver's file size).
71
4.08
By default the core of MS-DOS7 is loaded into conventional memory. If the HIMEM.SYS driver is already installed, the DOS's core may be loaded into high memory region 1024 1088 kb. For this purpose the CONFIG.SYS file must contain a line with command DOS=HIGH Furthermore, if UMB address space is opened yet by either the EMM386.EXE driver (5.04-02) or by UMBPCI.SYS driver (5.04-04), then MS-DOS7 may be allowed to use UMB space for addressing DOS's system structures and drivers. This is achieved by command: DOS=UMB In MS-DOS7 one more optional parameter NOAUTO is introduced. It means that the IO.SYS loader must disable its defaults for implicit loading of several drivers (HIMEM.SYS, DBLBUFF.SYS, IFSHLP.SYS, DBLSPACE.SYS) as well as for loading beyond 640 kb with ordinary loading commands DEVICE, INSTALL and some others
72
4.09
The DRIVPARM command (DRIVe PARaMeters) is a means to provide access to storage media in those devices, which can't be identified properly by PC's BIOS. In fact those devices are implied, which were known yet to MS-DOS7 at the moment of it's release in 1996, but were not known to BIOS of obsolete computers, produced in early 1990-ties or even earlier. Here is an example of DRIVPARM command usage for providing access to a 3,5-inch floppy drive in an old PC with BIOS support only for 5,25-inch floppy drives: DRIVPARM /D:1 /c /f:7 /h:2 /i /s:18 /t:80 where: /D:1 /c /f:7 specifies physical drive number, "1" means drive B:, "0" should be used for drive A:, "2" - for drive C:, and so on. optional parameter, enabling removable media change detection. For non-removable media the "/n" parameter should be specified instead. defines type number of the drive: 0 160/180/320/360 kb 5,25 inch drive; 1 1.2 Mb 5,25-inch drive; 2 720 kb 3.5-inch drive; 5 hard disk drive; 6 magnetic tape device (streamer); 7 1.44 Mb 3.5-inch drive; 8 optical disk drive; 9 2.88 Mb 3.5-inch drive. defines number of heads, default is 2 for double-sided diskettes. support for 3.5-inch drives if these are not supported by BIOS. specifies number of sectors per track 8 for old 320 kb 5.25-inch diskettes; 9 for 360 kb and 720 kb diskettes; 15 for 1.2 Mb 5.25-inch diskettes;
/h:2 /i /s:18
73
/t:80
Note 1: default settings for /f and /s parameters correspond to 5.25-inch diskettes with 9 sectors per track.
4.10
The FCBS command (File Control BlockS) reserves memory for a specified number of file control blocks from 1 to 255, each 80 bytes long. FCBS is an obsolete form, providing access to open files in current directory only. FCBS can't be applied to media having FAT32 file system. Modern DOS programs use "file handles" (4.12) instead of FCBS. Nevertheless MS-DOS7 supports FCBS, because they are used by some oldfashioned programs and network services (INTERLNK.EXE, SHARE.EXE, etc.). In most cases the default value FCBS=4 is quite enough. Note 1: by default a place for FCBS is reserved beyond conventional memory (above 640 kb), but may be reserved below 640 kb, if in DOS command (4.08) the NOAUTO parameter is specified, and also if the address space in UMB region is insufficient or unavailable (availability conditions - in 4.07). In any case no error message is displayed. Note 2: the FCBS specification doesn't limit available number of "unopened" file control blocks (A.09-5), which are used inside PSP (A.07-1), and also by some file search procedures.
4.11
The FCBSHIGH command is almost equivalent to FCBS command (4.10), except that FCBSHIGH command attempts to arrange file control blocks beyond conventional memory despite presence of NOAUTO parameter in DOS command (4.08). All other information in article 4.10 is equally applicable to FCBSHIGH command.
4.12
The FILES command reserves address space for a specified number of SFT table entries (A.01-4). Each entry defines state of an opened object a file or a channel, and also defines association of this object with its numerical reference, the so called "handle" used
74
4.13
The FILESHIGH command is almost equivalent to FILES command (4.12), except that FILESHIGH command attempts to arrange SFT entries beyond conventional memory despite presence of NOAUTO parameter in DOS command (4.08). All other information in article 4.12 is equally applicable to FILESHIGH command.
4.14
The INCLUDE command inserts a named block of commands into general succession of configuration commands to be executed. The inserted block of commands may be placed elsewhere inside the same CONFIG.SYS file, but it must be announced in its first line by a unique block name a word or a number, enclosed in square brackets, for example, [L055] (example is taken from 9.09-01). End of the block must be marked with similar line, containing a name of the next block. If there is no need to specify other blocks, a line with reserved name [common] should be specified afterwards. All commands following a line with this name (if there are any) will be executed in each specified configuration. In order to execute commands, in particular, of the block [L055], in the desired position in CONFIG.SYS file there must be a line INCLUDE=L055 Note that name of the block should be specified to the right of equality sign without enclosing square brackets. If the same block of commands should be executed in several loading configurations, then each configuration specification must contain identical lines with INCLUDE command. Segregation of repeated command sequences into separate blocks makes the structure of CONFIG.SYS file simpler and more clear. Examples of such CONFIG.SYS file's structures are shown in articles 9.04-01, 9.09-01 and 9.11-03.
75
The INSTALL command is used to load program's resident modules and those drivers, which have no special header (A.05-1) and therefore can't be loaded with DEVICE (4.06) or DEVICEHIGH (4.07) commands. Most often such drivers are marked with suffix *.COM or *.EXE. Drivers and utilities to be loaded with INSTALL command must meet the following conditions: they must not need environment space; they must not send calls for handling critical errors; they must not rely on services of COMMAND.COM interpreter, which is not loaded yet at that time. The mentioned conditions are satisfied, though, by a large part of those drivers and TSR utilities, which are designed to be loaded from AUTOEXEC.BAT file or from command line. Loading from CONFIG.SYS file with INSTALL command is considered more reliable and takes a little less memory space. Lines with INSTALL command are interpreted after all lines with DEVICE, DEVICEHIGH and SET commands, but before the line with SHELL command, even if succession of lines in CONFIG.SYS file is different. Contradiction between sequence of lines and sequence of execution can cause confusion and therefore should be avoided. Preferable line's order must correspond to sequence of execution. Here is an example of a line with INSTALL command: INSTALL=\DOS\DRV\Mkecdex.com /B /L:0 In the shown line to the right of equality sign there are path to the driver, driver's name and a group of its parameters. Just like the DEVICE command (4.06), the INSTALL command may be appended with question mark (INSTALL?=...), enabling the user to see this line on the screen and make a choice ([Enter=Y, Esc=N]) about whether to execute it or to skip. The INSTALL command can be used for temporary loading of those modules, which are to be uninstalled after termination of their mission. Peculiarity of such operations is that DOS automatically releases occupied memory space within conventional memory only, below 640 kb. When the NOAUTO parameter is specified in DOS command (4.08), then the INSTALL command will load modules into conventional memory, and then, therefore, you can afford temporary loading of command interpreter module in order to suspend execution for a while and give an opportunity to read displayed messages: INSTALL=C:\Command.com /low /c pause One more example of command interpreter's temporary loading with INSTALL command is shown in article 9.09-01. Note 1: unlike the DEVICEHIGH command, INSTALL command is not involved in memory allocation optimization procedure, performed by MEMMAKER.EXE
76
4.16
The INSTALLHIGH command is almost equivalent to INSTALL command (4.15), except that INSTALLHIGH command attempts to load drivers and TSR modules beyond conventional memory despite presence of NOAUTO parameter in DOS command (4.08). The INSTALLHIGH command shouldn't be used for loading those modules, which are to be uninstalled after termination of their mission. All other information in article 4.15 is equally applicable to INSTALLHIGH command.
4.17
The LASTDRIVE command defines number of entries in DOS's CDS table (A.03-03). Entries in CDS table store names of current directories for logical disks, both real and virtual. At boot time MS-DOS7 creates one valid CDS entry record per each logical disk, identified by PC's BIOS system, and then appends CDS structure with dummy entries (reservations). The last entry corresponds to the last disks letter-name, specified by LASTDRIVE command. By default MS-DOS7 assumes LASTDRIVE=Z Such CDS table with 26 entries occupies 2288 bytes. If you consider this excessive, you may specify other disks letter-name by LASTDRIVE command, but in any case there must be enough CDS entries for all logical disks, including those which will be made accessible later, after installation of CD-ROM drivers, network services, etc. Note 1: by default CDS table is arranged beyond conventional memory (above 640 kb), but may be arranged below 640 kb, if in DOS command (4.08) the NOAUTO parameter is specified, and also if address space in UMB region is insufficient or unavailable (availability conditions in 4.07). In any case no error message is displayed.
77
Chapter 4: Configuration commands 4.18 LASTDRIVEHIGH CDS entries in UMB address space
The LASTDRIVEHIGH command is almost equivalent to LASTDRIVE command (4.17), except that LASTDRIVEHIGH command attempts to arrange CDS table beyond conventional memory despite presence of NOAUTO parameter in DOS command (4.08). All other information in article 4.17 is equally applicable to LASTDRIVEHIGH command.
4.19
The MENUCOLOR command may be used optionally only in those blocks of configuration commands, which are named [menu] or are announced as submenu in their parent menu or submenu. Color palette for each menu or submenu may be set by a separate MENUCOLOR command, specified in this menu or submenu. The default color settings are equivalent to command: MENUCOLOR=7,0 In the shown example the first digit means code of text color (7 white), and the second digit (after comma) means code of background color (0 black). You are allowed to choose other colors. All permissible color codes together with their meanings are enlisted in appendix A.10-5.
4.20
The MENUDEFAULT command may be used only in those blocks of configuration commands, which are named [menu] or are announced as submenu in their parent menu or submenu. The MENUDEFAULT command is placed in the last line of menu block and defines that menu item, which should be chosen automatically if the user has not made his choice during a prescribed time, for example: MENUDEFAULT=L007,20 In the shown example the first group of characters just after equality sign means a name of configuration block [L007], which is to be chosen by default, and a number after comma means 20 seconds waiting for the user's choice before automatic default choice will be made. Delays from 0 to 99 seconds are allowed. Examples of configuration menu with MENUDEFAULT command are shown in articles 9.04-01, 9.09-01, 9.11-03.
4.21
The MENUITEM command may be used within the first menu block of commands (named [menu]) in CONFIG.SYS file and in those blocks, which are announced as
78
4.22
For access to a disk, DOS must specify starting sector and a number of sectors to be read (or written). In obsolete PCs produced in early 1980-ties disk drives and BIOS versions performed access operations within one track at a time, so that the sum of starting sector number and the number of sectors to be accessed could not exceed total number of sectors on a track (otherwise the process was "wrapped" to the beginning of the same track). Being forced to cope with obsolete hardware, MS-DOS7 also couldn't afford multitrack addressing, and then the CONFIG.SYS file must contain a line MULTITRACK OFF Since late 1980-ties all disk drives and BIOS versions are able to prevent the mentioned wrapping: access automatically is switched to the next track. This gives an opportunity to address several tracks in one operation and makes disk access much faster. MS-DOS7 performs multitrack access and in fact takes MULTITRACK ON option as default. Therefore now the MULTITRACK command is almost always omitted.
4.23
The NUMLOCK command (NUMerical keypad LOCK) defines status of numerical keypad (at the right edge of standard keyboard). Most often the NUMLOCK switch is kept
79
4.24
REM command (REMark) forces the IO.SYS loader to ignore all following words up to the end of line. Main purpose of REM command is to provide an opportunity to specify comments, which should not be displayed on the screen. Insertion of the REM command at the start of any command line enables to skip this line during interpretation of CONFIG.SYS file. Note 1: during interpretation of lines in CONFIG.SYS file the IO.SYS loader doesn't provide those extra opportunities, which are provided by the COMMAND.COM interpreter for its synonymous REM command (3.24).
4.25
The SET command in CONFIG.SYS file is used to assign or to redefine a value of an environmental variable, for example: SET Var_Name=New_Var_Value where: Var_name a name example of environmental variable; it must begin with a letter and may contain digits. New_Var_Value an example of a string value for the named environmental variable; it must not contain equation sign(s) inside. If there are spaces in the value, preceding the value or following the value (up to the end of line mark), all these spaces will be included in the assigned value.
80
4.26
The SHELL command is used to launch an executable file, which will not return control back to IO.SYS loader. This is why SHELL command is executed the last in CONFIG.SYS file, and preferably should be specified in its last line. Executables loaded with the SHELL command may be loaders of other operating systems (as LOADLIN.EXE for LINUX OS) or command interpreters, which are to take control over PC after the IO.SYS loader finishes its job. Here is an example of control transfer to command interpreter NDOS.COM: SHELL=C:\DOS\NU\Ndos.com /f @C:\DOS\NU\Ndos.ini where: C:\DOS\NU\ is an example of a path to command interpreter file; /f @C:\DOS\NU\Ndos.ini an example of parameters string for NDOS.COM command interpreter. When the SHELL command isn't present in CONFIG.SYS file, the IO.SYS loader attempts to find the MS-DOS's proprietary command interpreter COMMAND.COM in the root directory of the current disk. In this case the COMMAND.COM interpreter will be launched with default parameters. It is better, though, to specify parameters explicitly, for example: SHELL=Command.com A:\ /e:1008 /p
81
4.27
The STACKS command in CONFIG.SYS file specifies number of auxiliary DOS's stacks used for treatment of nested interrupts. Parameters of STACKS command define a number of auxiliary stacks and amount of address space devoted for each stack. The default parameters are equivalent to command STACKS=9,256 where: 9 256 number of auxiliary stacks (from 8 to 64 and 0 are allowed); size of each auxiliary stack in bytes (from 32 to 512 and 0 are allowed).
Since each stack overflow fault forces to reboot the PC and may cause data loss, the actual size of auxiliary stacks should not be less than the default value. Note 1: by default auxiliary stacks are arranged beyond the conventional memory (above 640 kb), but may be arranged below 640 kb, if in DOS command (4.08) the NOAUTO parameter is specified, and also if address space in UMB region is insufficient or unavailable (availability conditions in 4.07). In any case no error message is displayed.
4.28
The STACKSHIGH command is almost equivalent to the STACKS command (4.27), except that STACKSHIGH command attempts to arrange auxiliary stacks beyond conventional memory despite presence of NOAUTO parameter in DOS command (4.08). All other information in article 4.27 is equally applicable to STACKSHIGH command.
4.29
The SUBMENU command announces a menu entry, just as the MENUITEM command (4.21), but unlike the latter, the SUBMENU command forces to treat the corresponding block of commands as a submenu. Of course, the SUBMENU command itself may be used only in those blocks of configuration commands, which are named [menu] or are announced as submenu in their parent menu or submenu, for example:
82
4.30
The SWITCHES command enables to specify up to four optional configuration items, for example: SWITCHES= /K /N /F /E:64 where: /K /N /F /E:64 enables old programs, consigned for 86-key keyboard, to cope with newer "enhanced" 101/108-key keyboard. disables opportunity to skip execution of configuration files (CONFIG.SYS and AUTOEXEC.BAT) with F5 and F6 keys. excludes two-second delay after displaying the message "Starting WINDOWS...". allots 64 bytes of conventional memory (from 48 to 1024 bytes allowed) to a "handle" for EBIOS, which is BIOS system extension, enabling LBA access to HDDs (see note 4 to A.13-6). If the number after /E parameter is omitted, then the whole EBIOS code, if it will be found necessary, will be loaded into conventional memory. In modern PCs the /E parameter is not needed, because LBA access is supported by their main BIOS system.
83
Chapter 5
Drivers are files with executable resident code inside. Resident code is the code adapted for being written into RAM (random accessed memory) and left there, waiting for its chance of being requested on certain occasion(s). When this particular occasion happens, driver's code is executed, performs its mission and then again is left waiting for the next request. This mode of action is similar to the "life" of operating system's core. MS-DOS combines a limited number of main core's functions with various functional extensions, provided by drivers. Proper choice and renewal of drivers is an important factor for DOS's survival amongst ever changing PC's hardware. Drivers may be presented in a form of files with special header (A.05-1), most often marked with *.SYS suffix, or in a form of ordinary executable files (*.COM or *.EXE) having a TSR (Terminate and Stay Resident) part. Drivers with *.SYS suffix must be loaded by DEVICE (4.06) or DEVICEHIGH (4.07) commands from lines of configuration file CONFIG.SYS. Composition examples for CONFIG.SYS file are shown in articles 9.01-01, 9.04-01 and 9.09-01. Loading by DEVICE or DEVICEHIGH commands gives more chances to affect DOS system structures construction, because it is not finished yet at that moment. Drivers with *.COM and *.EXE suffixes usually are loaded later either from CONFIG.SYS file with INSTALL (4.15) or INSTALLHIGH (4.16) commands, or from AUTOEXEC.BAT file (9.01-02, 9.04-02, 9.09-02), or from command line - directly or with LH command (3.17). Loading from CONFIG.SYS file is less subjected to mutual software interference and therefore is considered more safe. On the other hand, INSTALL and INSTALLHIGH commands can't be involved in memory optimization procedure by MEMMAKER.EXE optimizer. If memory optimization is significant, loading with LH command from AUTOEXEC.BAT file should be preferred. The main group of drivers for MS-DOS7 constitute those supplied within WINDOWS-95/98 operating system release and on its rescue diskette. In case of standard operating system installation all drivers for MS-DOS7 are in directories \WINDOWS and \WINDOWS\COMMAND. But if MS-DOS7 is installed as an independent operating system, it's better to arrange a separate directory for drivers, for example, C:\DOS\DRV. This path is shown in the most part of presented examples. When you will intend to follow these examples in practice, it's important to remember: the path you specify must not be necessarily C:\DOS\DRV, it must be exactly the one that leads to each particular driver in your particular computer. Beside "native" Microsoft's drivers, a lot of drivers for MS-DOS7 have been developed since 1995 by other software vendors and by manufacturers of PC's hardware. Existing
84
5.01
5.01-01
In the root directory of the disk used to load WINDOWS-95/98 or MS-DOS7, there are two hidden system files: IO.SYS and MSDOS.SYS. These files are there since installation of the operating system, they implement its loading. File IO.SYS combines the core of MS-DOS7 with interpreter and with DOS loader. The MSDOS.SYS file contains a set of loading parameters. If you have no such files, you may get them from a disc with WINDOWS-95/98 release, or else you may download them, for example, packed into archive DOS7.ZIP from internet site http://www.micosyen.com/msdos.php . In order to make a disk bootable with MS-DOS7, presence of the mentioned system files is necessary, but not sufficient. Boot-sector's executable code will not "know" where control should be transferred, unless the name of loader is written into boot-sector. This is why copying of system files is combined with boot-sector updating in joint mission of SYS.COM utility (6.24). Having got control over booting process, DOS loader reads loading parameters from MSDOS.SYS file. These parameters define the alternatives, described in article 1.02, and also define which operating system should be loaded: MS-DOS7 or WINDOWS-95/98. If the HRS attributes (H = Hidden, R = Read-only, S = system) of the MSDOS.SYS file are taken off by the ATTRIB.EXE utility (6.01), then MSDOS.SYS becomes an ordinary nonformatted textual file, which can be opened, changed and rewritten with editor utility, for example, with EDIT.COM (6.09). Several or even all parameters may be not specified in MSDOS.SYS file, and then the omitted parameters will be given the default values. Contrary to other system files, MSDOS.SYS is not copied by SYS.COM utility, but rather is created empty anew, and this doesn't hamper normal loading of WINDOWS-95/98 operating system. At least some of the default parameter's values wouldn't fit, though, if you intend to load MS-DOS7 as a stand-alone operating system. Suitable values of all parameters are shown in an example of MSDOS.SYS file presented below.
85
86
87
Evolution of OS versions is complicated by a problem of application programs, which have been developed for previous versions of DOS. Compatibility of any application with future OS versions is a matter of faith rather than prediction. Microsoft suggested to solve this problem by informing definitely compatible application programs via INT 21\AH=30h (8.02-22) about not the actual, but the required DOS version number. SETVER.EXE is just that driver, which is charged with mission of deceiving application programs by substitution of DOS version number. In case of standard installation of WINDOWS-95/98 the SETVER.EXE driver is in the \WINDOWS directory. But if you want to use MS-DOS7 separately, it's better to have a copy of SETVER.EXE in common directory with other DOS drivers. It has to be loaded by DEVICE (4.06) or DEVICEHIGH (4.07) command from a line of CONFIG.SYS file: DEVICEHIGH=C:\DOS\DRV\Setver.exe where: C:\DOS\DRV\ is a path example to SETVER.EXE driver stored in separate directory for DOS drivers. Application program will receive the substituted DOS version number only if the name of this program together with the required DOS version number is in advance registered in internal versions table inside the loaded TSR module of SETVER.EXE driver. Though such substitution doesn't guarantee a proper outcome, nevertheless most old programs are able to operate properly in MSDOS7. The SETVER.EXE driver can be launched from command line just as an ordinary utility, for example, in order to display its short help text: Setver.exe /? Being run from command line without parameters, SETVER.EXE driver displays its internal table of versions. Originally table of versions is not empty: its entries reflect Microsoft's recommendations. In order to append the table of versions with one more entry you should type Setver.exe Qbasic.exe 6.22 where: Qbasic.exe name example of the utility to be "deceived". The name must have suffix *.COM or *.EXE. 6.22 an example of required DOS version number. Command to delete the same entry from internal table of versions requires the /D parameter and looks as Setver.exe Qbasic.exe /D
88
5.02
5.02-01
In case of standard installation of WINDOWS-95/98 OS the COUNTRY.SYS file can be found in \WINDOWS\COMMAND directory. COUNTRY.SYS is in fact a set of data tables, one of which is to be loaded from CONFIG.SYS file with special COUNTRY command (4.05), for example: COUNTRY=007,866,C:\DOS\DRV\Country.sys where: 007 country code (A.02-2), in particular for Russia; 866 number of codepage (A.02-2), defining character set for Russia; C:\DOS\DRV\ path example to file COUNTRY.SYS, copied into common directory for DOS drivers. Having been loaded, data from COUNTRY.SYS change several internal DOS settings, related to country-specific conventions on displaying time, dates, currency and punctuation
89
DISPLAY.SYS driver prepares memory buffers for one or more national codepage tables, specifying character set and outline (A.02-2). Normally the DISPLAY.SYS driver can be found in \WINDOWS\COMMAND directory. This driver must be loaded by a DEVICE (4.06) or DEVICEHIGH (4.07) command from a line in CONFIG.SYS file: DEVICE=C:\DOS\DRV\Display.sys CON=(EGA,866,2,1) where: C:\DOS\DRV\ example of a path to DISPLAY.SYS driver, copied into special directory for DOS drivers. CON (console) specification of display as output device (no alternative). EGA means that PC is equipped with EGA, VGA or SVGA video card; alternatives to EGA type are: LCD video module used in obsolete portable PCs (notebooks); CGA obsolete color video card without codepage switching; MONO obsolete monochrome MDA video card, also without codepage switching. When type of video card is omitted, then DISPLAY.SYS driver will try to determine it, but this leaves a chance for mistake. 866 number of primary codepage (A.02-2), this one is in particular for Russia. Several codepages are supplied in each of the files EGA.CPI, EGA2.CPI, EGA3.CPI and ISO.CPI. Later the MODE.COM utility (6.18) enables to select proper codepage and write it into memory buffer prepared by DISPLAY.SYS driver. 2 number of memory buffers to be prepared for character sets, besides the one prepared for the primary character set, specified by preceding codepage number. From 0 to 6 auxiliary buffers are allowed for EGA, VGA and SVGA video cards, no more than 1 for LCD video modules, and only 0 for CGA and MDA video cards. 1 number of hardware supported fonts for each codepage. This number may be omitted together with preceding comma. Default is 1 for LCD type and 2 for EGA, VGA and SVGA video cards. Note 1: all parameters in parenthesis may be omitted (brackets left empty), and then DISPLAY.SYS driver will appoint default settings. Note 2: TSR module of DISPLAY.SYS driver is opened for interaction with programs via INT 2F\AX=AD00-AD03h (8.03-26, 8.03-27).
90
The NLSFUNC.EXE driver activates CHCP command (3.04) for switching between different codepages, coordinated with changing of other national settings. Normally this driver can be found in \WINDOWS\COMMAND directory. The NLSFUNC.EXE driver may be loaded directly or with LH command (3.17) from command line or from AUTOEXEC.BAT file, or else from CONFIG.SYS file with INSTALL (4.15) or INSTALLHIGH (4.16) command, for example: INSTALLHIGH=C:\DOS\DRV\Nlsfunc.exe C:\DOS\DRV\Country.sys where: C:\DOS\DRV\ path example to NLSFUNC.EXE driver, copied into common directory for DOS drivers. C:\DOS\DRV\Country.sys path and name examples for a file with national specifications data (5.02-01). Note 1: switching between american english and any other national notation doesn't imply changing codepages: american english notation is accessible within any single national codepage (A.02-02). Note 2: switching between different national codepages can be performed by MODE.COM utility too (6.18-03). The latter is usually preferred, because MODE.COM is not a TSR program and releases occupied memory after termination. 5.02-04 KEYB.COM keyboard driver
Control over keyboard layouts is provided by Microsoft's keyboard driver KEYB.COM. Normally it can be found in \WINDOWS\COMMAND directory. The KEYB.COM driver can be loaded directly or with LH command (3.17) from AUTOEXEC.BAT file, or else from CONFIG.SYS file with INSTALL (4.16) or INSTALLHIGH (4.17) command, for example: INSTALL=C:\DOS\DRV\Keyb.com UK,850,C:\DOS\DRV\Keybrd3.sys /E /ID:168 where: C:\DOS\DRV\ path example to KEYB.COM driver, copied into common directory for DOS drivers. UK example of a two-letter national keyboard layout code (other layout codes - in appendix A.02-2 ). 850 example of national codepage number (A.02-2). When it is specified just here, it will not be changed automatically following display codepage change by CHCP command. If synchronous change of codepages (on both display and keyboard) is preferable, then codepage
91
KEYRUS.COM driver (written by D.Gurtjak, Donetzk) is a combined keyboard and character generator driver. It is popular among russian users, because it is originally supplied with internal 866 (russian) codepage and with russian keyboard layout. But the original release of KEYRUS.COM also contains supplementary programs, which enable the user to write, to install and to activate any codepage and any keyboard layout. The KEYRUS.COM driver can be downloaded for free from many russian internet sites. The last version 8.0b (1994), packed into keyrus8b.zip archive, is available from author's site http://www.gurtjak.skif.net/pages/programs.htm . The KEYRUS.COM driver may be loaded from CONFIG.SYS file with INSTALL (4.15) or INSTALLHIGH (4.16) command, or else from command line or from a line of AUTOEXEC.BAT file - directly or with the LH command (3.17), for example
92
93
94
95
5.03
Functions of mouse pointing device become accessible, when four conditions are met. First, you must have a mouse, which is able to perform the desired function(s) and can be connected to your computer. Second, you must load a driver, supporting execution of the desired function(s) by the mouse with appropriate type of connection. Third, the desired functions must be called by the program, which you want to employ these functions. Fourth, both the driver and the program must be able to operate under the operating system, which is installed in your computer. As to the mouse pointing devices, the MS-DOS7 operating system seems inconsistent. On one hand, the Windows-95/98 release provides no mouse driver for MS-DOS7. On the other hand, mouse's functions are needed, for example, for editor utility EDIT.COM (6.09), and mouse drivers from previous versions of DOS operate properly under MS-DOS7. All those mouse drivers for DOS interact with application programs in the same way via interrupt INT 33 (8.03-31 8.03-55). Connection of mouse pointing device to a PC is defined by port address (A.14-1) and by IRQ interrupt request line number. Mouse drivers, described below in part 5.03, are able to search for mouse pointing devices throughout all relevant ports and IRQ numbers. Though connection specification is not necessary, it nevertheless may be given in order to avoid search and make loading faster.
96
The GMOUSE.COM driver is supplied in software packets for mouse pointing devices with a well-known trade mark GENIUS, belonging to KYE Systems Corporation. This driver also can be found on compact discs, containing collections of drivers. Version 10.20 of GMOUSE.COM driver (1996) packed into GMOUSE.ZIP archive is available for free downloading from internet site http://www.dosbootsector.narod.ru/drivers.htm . The GMOUSE.COM driver can be loaded either directly or by LH command (3.17) from command line or from AUTOEXEC.BAT file, or else by INSTALL (4.15) or INSTALLHIGH (4.16) command from CONFIG.SYS file, for example: INSTALLHIGH=C:\DOS\DRV\Gmouse.com where: C:\DOS\DRV\ an example of a path to GMOUSE.COM driver. Normally the GMOUSE.COM driver doesn't needs parameter specifications, but nevertheless it can accept any one of the following mutually excludible parameters: /1 mouse connection via serial port COM1 /2 mouse connection via serial port COM2 /3 mouse connection via serial port COM3 /4 mouse connection via serial port COM4 /P mouse connection via PS2 Port. /P2 2-button mouse, connected via PS2 port. /P3 3-button mouse, connected via PS2 port. /U unload GMOUSE.COM driver from memory. /? display short help. The listed parameters are also suitable for newer versions of GMOUSE.COM driver, which have increased file size and several superfluous functions, such as automatic determination of language for messages on basis of the loaded codepage. Contrary to newer versions, version 10.20 of GMOUSE.COM driver can accept some more parameters from a special parameter file GMOUSE.INI, if it is present in the same directory with the driver. Note 1: if during loading a search for mouse pointing device is stopped by BREAK keystroke, for example, in order to read the displayed messages, then after any
97
5.03-02
The MOUSE.COM name was common for several mouse drivers, written at different times by different authors. Here the version 8.20 is described of Microsoft's MOUSE.COM driver (file size 37681 bytes, file date 29.06.93). It was supplied within MS-DOS6.22 release, but was found compatible with MS-DOS7 too. Archive MOUSE.ZIP containing MOUSE.COM driver can be downloaded from internet site http://www.computerhope.com/download/hardware.htm#05 . The MOUSE.COM driver may be installed either from CONFIG.SYS file with INSTALL (4.15) or INSTALLHIGH (4.16) command, or else directly or with LH command (3.17) from AUTOEXEC.BAT file or later from command line: C:\DOS\DRV\Mouse.com /C1 /R1 /S50 /P2 /N50 /Y where: C:\DOS\DRV\ an example of a path to MOUSE.COM driver. /C1 select COM1 port. Instead of /C1 there may be: /C2 for mouse connected to COM2 port; /Z for mouse connected to PS2 port; /I1 for mouse on LPT1 port; /I2 for mouse on LPT2 port; /B for bus mouse. /R1 specifies interrupt rate 30 Hz (the default). Alternatives are: /R2 interrupt rate 50 Hz, /R3 interrupt rate 100 Hz, /R4 interrupt rate 200 Hz. /S50 specifies sensitivity; the number after /S is allowed within range 0 - 100, 50 is the default. Instead of /S50 there may be separate /H50 horizontal and /V50 vertical sensitivity specifications. /P2 slow acceleration profile number. Alternatives are: P1 profile without acceleration P3 moderate acceleration profile; P4 fast acceleration profile. /N50 number after /N specifies cursor redraw rate (0 255 is allowed). /Y use hardware cursor feature.
98
The CTMOUSE.EXE driver is developed since 2002 as a part of FreeDOS project, but it is made compatible with MS-DOS7. Version 2.1 of CTMOUSE.EXE (dated 2007), packed in archive CTMOUS21.ZIP, may be downloaded from internet site .Another address, http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/dos/mouse/ where recent versions of this driver can be found, is http://cutemouse.sourceforge.net/ . Functionally CTMOUSE.EXE is similar to other mouse drivers for DOS, but it occupies less memory and supports pointing devices equipped with a wheel. One more important feature of this driver is its interaction with pointing device BIOS interface (INT15\AX=C2xx). Therefore it provides better chances to suffice USB mice in modern PCs. CTMOUSE.EXE driver has an elaborated set of defaults, which make command line parameters in most cases unnecessary. It may be loaded either from command line or from AUTOEXEC.BAT file directly or by LH command (3.17), or else from CONFIG.SYS file by INSTALL (4.15) or INSTALLHIGH (4.16) command, for example: INSTALL=\DOS\DRV\Ctmouse.exe /S14 /3 /R33 /N where: \DOS\DRV\ path example to Ctmouse.exe driver. /S14 search for mouse pointing device through serial ports only. The first digit denotes serial port number (=COM1), the second interrupt request line number (=IRQ 4). If the /S parameter is not specified, driver will examine PS2 port first, and then all serial ports. /3 activate mouse's third button. This function can't be applied to mice of Mouse System type and to mice with a wheel instead of middle button. /R33 sensitivity settings: first digit is a grade of horizontal sensitivity, second digit of vertical sensitivity. If only one digit is specified, it is applied to both coordinates. Default /R parameter value is /R33. /N load Ctmouse.exe driver even if some mouse driver has been loaded yet. This parameter enables to compose batch files so that after unloading of Ctmouse.exe driver the configuration returns back to its original state, whichever this state was. Besides the shown parameters, Ctmouse.exe driver can accept the following options:
99
5.04
Memory managers
In AT-compatible computers the 640 1024 kb memory region is hardware consigned for special usage as BIOS code "shadow", as a "window" into video memory, as a page frame "window", etc. (see notes 2 and 3 to A.12-1 for more details). Because of 16-bit addressing and because of special status of 640 1024 kb memory region the accessible memory space for DOS programs is considerably limited. Since early 1980-ties researchers in all leading software companies attempted to overcome memory space restrictions. Nowadays these attempts are continued by many independent software vendors. The best solutions of this problem are presented here in the following articles. 5.04-01 HIMEM.SYS extended memory driver
HIMEM.SYS is Microsoft's memory driver for PCs with CPU 80386 or higher, providing machine-dependent access to memory beyond the 1024 kb boundary according to eXtended Memory Specification (XMS). Therefore the memory, opened by HIMEM.SYS, is often called XMS memory. Since version 3.10 of HIMEM.SYS driver the upper limit of XMS memory is 65535 kb. Besides access to XMS memory, the HIMEM.SYS driver performs two important functions: control over switching of A20 line gate and allocation of memory space, requested by different programs. Both these functions are necessary in order to prevent conflicts between programs, addressing memory beyond conventional memory limit (640 kb). Due to HIMEM.SYS driver each program, requesting some space in UMB region or in XMS memory, is given exclusive access rights to the allocated part of memory space. Official explanations of HIMEM's operation principle are not known, but analysis of its code gives some grounds to suppose, that it uses 32-bit linear addressing in real mode (more about that in 9.10). In any case, HIMEM's operation principle gives no chance to execute programs in XMS memory, it gives only an opportunity to copy executable code together with data from conventional memory into XMS memory and back.
100
101
Note 1: HIMEM.SYS driver gives no access to memory beyond 16 Mb, if CMOS BIOS parameter "Memory hole 15 16 Mb" is enabled. Note 2: HIMEM.SYS driver accepts program's requests via CALL FAR commands (7.03-08). Address for CALL FAR commands can be obtained with INT 2F\AX=4310h function (8.03-23). A list of operations, which can be requested by programs, is shown in table A.12-3. Note 3: several similar XMS memory drivers have been developed by different authors. J.R.Ellis wrote QHIMEM2.SYS driver, which extends XMS memory limit to 4 Gb. Version 3.1 of this driver (dated 2005) is available inside SFX diskette image USB18.EXE from site http://johnson.tmfc.net/dos/usbdrv.html . The most recent 4 Gb XMS memory driver XMGR.SYS can be downloaded from page http://johnson.tmfc.net/dos/driver.html . One more similar driver Himem.exe is developed as a part of FreeDOS project and is supplied together with Emm386.exe (see note 4 to 5.04-02). Alternative XMS memory drivers accept different sets of options, described in attached files. Note 4: in MS-DOS8 the XMS access code is integrated into the core, hence there is no need to load Himem.sys. 5.04-02 EMM386.EXE memory mapping driver and VCPI server.
EMM drivers (EMM = Expanded Memory Manager) originally were developed in 1983 1984 in order to provide access to memory banks on expansion cards for IBM PC, so that any memory bank can be addressed through the same "window" in address space (usually in segment addresses E000 EFFFh). This method of addressing memory banks was institutionalized by LIM EMS specification. Among other details, LIM EMS specification stipulates division of the address space "window" into several pages of 16 kb each, which independently direct addressing to different memory banks. Later the main computer's memory has grown far above 1 Mb, and expansion cards with memory banks have come out of use. But some popular programs still relied on old-fashioned LIM EMS access, and compatibility with these programs had to be preserved. Therefore the fundamental principle of EMM driver's operation has been changed: control over expansion cards has been replaced by control over address translation mechanism, which is embedded in all CPU's since 80386. This is why such memory managers are named EMM386. They enable to address the main computer's memory above 1 Mb through the same LIM EMS "window" in address space. Here is just a place to remind, that main computer's memory above 1 Mb is controlled by XMS driver HIMEM.SYS (5.04-01), and memory space allocation according to program's requests is just its prerogative. Hence the EMM386 driver plays a role of an intermediary transactor: having got a program's request for LIM EMS access to a memory
102
103
104
105
106
CHKSTATE.SYS is a special service utility for memory optimization procedure, developed for MS-DOS6, but proved to be suitable in MS-DOS7. A line loading CHKSTATE.SYS is inserted into CONFIG.SYS file automatically by memory optimization manager MEMMAKER.EXE, and is deleted in the same way when memory optimization procedure terminates. Being executed, CHKSTATE.SYS utility forms a textual report file, containing exact data about memory areas, allocated for each loaded driver. Note 1: for performing memory optimization procedure the main optimization manager MEMMAKER.EXE must be in one directory with auxiliary files CHKSTATE.SYS, EMM386.EXE, HIMEM.SYS, MEMMAKER.HLP, MEMMAKER.INF and SIZER.EXE. All these files are present in MS-DOS6.22 release, and also are contained in SFX archive OLDDOS.EXE, freely available from server ftp://ftp.microsoft.com/softlib/mslfiles/ . Note 2: the MEMMAKER.EXE optimizer is unable to make proper corrections in AUTOEXEC.BAT file and in CONFIG.SYS file, if the latter contains a menu with several loading alternatives. Each alternative variant should be optimized separately. Nevertheless the data, obtained for each loading alternative separately, enable to compose optimized configuration files with several loading alternatives. 5.04-04 UMBPCI.SYS freeware UMB region driver
In order to open UMB address space (C000h EFFFh) for loading drivers, the EMM386.EXE memory manager (5.04-02) arranges address translation via CPU's TLB tables and forces to pay for that with switching CPU into V86 mode. But when it is necessary to stay in real mode, access to UMB address space may be opened by reprogramming memory controller, which is a part of chipset on PC's motherboard. This alternative way of access to UMB address space is implemented by UMBPCI.SYS driver.
107
108
5.05
RAM-disk drivers
RAM-disk drivers occupy a part of computer's random access memory (RAM) in order to simulate a virtual disk drive. This provides access to writable disk space during exploratory and reparatory works, when physical disk space may not exist or must be preserved free from traces of access. Virtual RAM-disks are much faster, than any physical disk. Since contents of RAM-disk is lost each time the PC is switched off, RAMdisks sometimes are used as a place for temporary files in order to avoid pollution of physical disk space. A common drawback of many RAM-disk drivers is that they are unable to assign a certain letter-name for the created virtual disk. DOS always assigns to virtual disk the first free letter-name, which cant be known beforehand. One solution, presented in article 9.04-02, is a search for a particular letter-name, assigned to the arranged virtual disk. Another solution is to write a special driver, which will deceive DOS with a false number of registered disks, so that the next disk could be given an arbitrary prescribed letter-name. An example of the latter solution is presented in article 9.08. 5.05-01 RAM-disk driver RAMDRIVE.SYS
RAMDRIVE.SYS is Microsoft's RAM-disk driver for DOS, supplied within WINDOWS-95/98/ME releases. Normally it can be found in \WINDOWS directory. RAMDRIVE.SYS should be loaded by a DEVICE (4.06) or DEVICEHIGH (4.07) command from a line of CONFIG.SYS file, for example: DEVICE=C:\DOS\DRV\Ramdrive.sys 16000 512 256 /E where: C:\DOS\DRV\ a path example to RAMDRIVE.SYS driver.
109
You may set up as many RAM-disks as free memory space allows: just add one such line to your CONFIG.SYS file per each extra RAM-disk. Note 1: RAM-disk driver RDISK.COM with 2 Gb size limit may be downloaded from http://johnson.tmfc.net/dos/driver.html . This driver should be used together with XMS memory managers providing 4Gb XMS memory limit (note 3 to 5.04-01). 5.05-02 Reconfigurable drivers TDSK.EXE and BITDISK.EXE
Freeware drivers TDSK.EXE and BITDISK.EXE enable to define RAM-disk size not only at the moment of loading, as RAMDRIVE.SYS driver does, but also enable to postpone RAM-disk size definition, and even enable to do it repeatedly. This feature is very important for installation of MS-DOS7 on an unknown computer, because you need to determine available amount of memory before a decision can be made about whether to arrange a RAM-disk and of what size. Both TDSK.EXE and BITDISK.EXE drivers were written by Garcia de Celis, Valladolid, Spain, in 1992 1995, and then the last was version 2.3. Later these drivers were modernized and became a part of FreeDOS project. Now both these drivers can be downloaded from http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/dos/ramdisk/ . Original drivers of Garcia de Celis are there in archive TDSK23.ZIP, and modernized version 2.42 of the TDSK.EXE driver in archive TDSK242B.ZIP. BITDISK.EXE is a simplified version of TDSK.EXE. While the latter is able to employ EMS, XMS or conventional memory, BITDISK.EXE can cope with XMS memory only. Therefore it always needs the HIMEM.SYS driver to be loaded in advance. TDSK.EXE can accept all BITDISK's options and, besides that, some options of its own. Original drivers of Garcia de Celis should be initialized by DEVICE (4.06) or DEVICEHIGH (4.07) command in a line of CONFIG.SYS file. Modernized version 2.42 of the TDSK.EXE driver must be loaded in conventional memory only by DEVICE
110
512 384 4
111
Command line, addressed to TDSK.EXE, contains some additional options, accepted by TDSK.EXE only. Allowable additional options for version 2.42 of TDSK.EXE driver are: /E arrange RAM-disk in XMS memory (the default), provided by HIMEM.SYS driver, which has to be loaded yet. /C arrange RAM-disk in conventional memory. /X (or equivalently /A) arrange RAM-disk in EMS memory, provided by EMM386.EXE driver. In this case both EMM386.EXE and HIMEM.SYS memory drivers must be loaded in advance. /B don't load TDSK.EXE driver, if at least one real disk drive is found (this option isn't accepted by original version 2.3 of TDSK.EXE driver). /M display screen messages in monochrome (default is color). /I=1 display messages in english (the default); besides this, spanish (/I=34) and german (/I=49) languages may be chosen. Auxiliary options /E, /C, /X, /A are mutually exclusive and usually are omitted, because TDSK.EXE driver itself is able to choose optimum place to arrange RAM-disk. The shown form of command can be repeatedly used to call either TDSK.EXE or BITDISK.EXE in order to change RAM-disk's size. Each time after this command RAMdisk is rearranged anew, and all its contents becomes lost. RAM-disk data are not affected by either driver in two cases: if it is called without parameters to show current status; if it is called with a single /? parameter to show help. In order to solve the problem of RAM-disk letter-name determination, version 2.42 of TDSK.EXE driver is able to assign this letter-name as a value to environmental variable named TURBODSK or RAMDRIVE. An environmental variable with any of the mentioned names should be prepared in advance with SET command (3.26), and it should be given a question mark and a colon as its preliminary value: SET RAMDRIVE=?: If a variable with the same name has another value, it will be preserved intact. But if this variable has just the shown value, and if at that moment RAM-disk is arranged already, then after execution of TDSK.EXE driver the question mark in variable's value will be replaced by letter-name of the RAM-disk. When RAM-disks letter-name is known yet, then it's easy to compose AUTOEXEC.BAT file so that this letter-name is automatically written into all relevant paths (an example in article 9.09-02).
112
5.06
5.06-01
HDD services
SMARTDRV.EXE cache buffer driver
The SMARTDRV.EXE driver arranges and maintains disk's cache buffer. Data transfer operations in this buffer are performed via DMA controller. DMA access gives some relief to CPU and makes transfer operations faster for both HDDs and CD drives. Time saving effect becomes essential in case of large data amounts transfer, for example, during installation of operating systems Windows ME/2000/XP under DOS. The SMARTDRV.EXE driver is a part of Windows-95/98 release and must be present in \WINDOWS directory. But WINDOWS OS itself performs buffering otherwise and doesn't need SMARTDRV.EXE. It is needed only in DOS, and in MS-DOS7 as well. Since the cache buffer is expedient beyond conventional memory, access above 640 kb must be opened in advance. Therefore appropriate memory manager(s) (5.04-01, 5.04-02, 5.04-04) must be loaded before SMARTDRV.EXE. If you intend to access CD-ROMs with MSCDEX.EXE (5.08-03), the latter also should be loaded in advance. Most often SMARTDRV.EXE is loaded either by INSTALL command (4.15) from CONFIG.SYS file or from a line in AUTOEXEC.BAT file, for example: C:\DOS\DRV\Smartdrv.exe /X A- B- C+ /U /N /L /V 128 /E:2048 /B:4096 where: C:\DOS\DRV\ path example to SMARTDRV.EXE driver. /X disable write-behind caching for disks, except those enlisted after the /X parameter with plus sign (as C+). On disks followed by minus sign (as A, B) read-ahead buffering is disabled too. If the /X parameter is omitted, then write-behind caching is enabled only for HDDs. /U don't load CD-ROM caching module. /N allow to accept the next command when write cache is not written yet onto disk. This parameter affects those drives only, where write-behind caching is enabled. If the /N parameter is omitted, command prompt does not appear until cache writing to disk operation terminates.
113
When SMARTDRV.EXE is running yet, it may be called from command line with other set(s) of options for execution of a command or for reconfiguration, for example: C:\DOS\DRV\Smartdrv.exe /X C D+ /R /F /Q where: /X disable write-behind caching for all disks (if not followed by particular disk's letter-names). This parameter may be applied, if write-behind caching was not disabled in current state of SMARTDRV.EXE. Here C and D+ letter-names mean disable write-behind caching for disk C: and enable it for disk D:. clear the cache and restart SMARTDRV.EXE. One more operation to be performed immediately (instead of /R) is /C write information currently present in write-behind cache to disk. discard the /N parameter, if it is active in current state, and return to default state, when command prompt doesn't appear until cache writing operation terminates. If the state should be reversed in opposite direction, then /N parameter should be specified instead of /F. cancel default status message display. Instead of /Q there may be /S display status message plus cache statistics.
/R /F
/Q
Note 1: /C operation (writing cache) ignores /V and /S parameters, nothing is displayed. Note 2: DMA data transfer, arranged by SMARTDRV.EXE driver, doesn't involve operations, performed by SHSUCDX.COM (5.08-04). Note 3: in order to cope with SATA drives and with UltraDMA data transfer the UIDE.SYS cache driver should be preferred. This driver can be downloaded from site http://johnson.tmfc.net/dos/driver.html . 5.06-02 Double buffering driver DBLBUFF.SYS
The DBLBUFF.SYS driver provides compatibility for some HDD controllers, which otherwise may be unable to work with EMS memory and with WINDOWS OS. In
114
DRVSPACE.SYS is a loader for TSR program DRVSPACE.BIN, which provides on-the-fly compression and decompression for logical disks. Data flow is processed just in the course of access operations. Compression improves disk space usage, since compressed data are written continuously, and free disk space is not lost in partially filled clusters. Files DRVSPACE.SYS and DRVSPACE.BIN are included in WINDOWS-95 release and normally must be written in the same directory outside compressed region of logical disk (most often in the root directory). When MS-DOS7 discovers presence of a compressed region on the bootable disk, both DRVSPACE.SYS and DRVSPACE.BIN are loaded by default. Default loading may be discarded either by a line with parameter "DRVSPACE=0" in MSDOS.SYS file (5.01-01) or by a "DOS=NOAUTO" command in CONFIG.SYS file (4.08, 9.01-01). When DRVSPACE.SYS is to be loaded explicitly, it should be loaded before memory managers (5.04-01, 5.04-02) just as a driver by DEVICE command (4.06) from a line of CONFIG.SYS file, for example: DEVICE=C:\Drvspace.sys /MOVE /NOHMA /LOW
115
5.07
5.07-01
Disk drives with Integrated Drive Electronics (IDE) were developed by Western Digital Corp. and were employed for the first time in IBM's PC-AT in 1984. Since then such drives became the most widely used. Protocol of IDE drive's interaction with HDD
116
117
/T:5 /LUN
If "above" MS-DOS7 with loaded ATAPIMGR.SYS the Windows-95/98 OS is launched, the latter will run in "MS-DOS compatibility mode" unless you add the following line into the \Windows\IOS.INI file: ATAPIMGR.SYS ; MKE ATAPI Manager If ATAPIMGR.SYS driver will find, that ATAPI interface functions are supported yet by PC's BIOS, it wouldn't be loaded. When ATAPIMGR.SYS is not loaded, some CD-ROM drivers (in particular, SR_ASPI.SYS) wouldn't be loaded too. Hence, in cooperation with ATAPIMGR.SYS those CD-ROM drivers should be preferred, which use ATAPI functions regardless of their origin, for example, as OAKCDROM.SYS (5.09-01) and VIDE-CDD.SYS (5.09-02). Such drivers provide access to DVD-ROM discs in any case, whether ATAPIMGR.SYS will "agree" to be loaded or not.
5.07-02
Since early 1990-ies portable PCs of "notebook" class were equipped with special 68-pin slot for external memory expansion cards. Interface for these cards was standardized in 1990 by PC Memory Card International Association (PCMCIA). In 1995 it was renamed into PC card interface, because at that time it was also used for a variety of peripheral equipment: modems, external disk drives, etc. The last 8-th version of PC card interface standard was adopted in 2001. Later PC card interface was ousted by USB 2.0 interface (5.07-05). In early 1990-ies there were several mutually exclusive types of PCMCIA controllers, and then external devices with PCMCIA interface had to be supplied with a number of PCMCIA drivers for DOS. Thus, CD-ROM drive Panasonic KXL-DN720A (1995) was supplied with 3 drivers for different PCMCIA controllers. These drivers enable to address the device with unified ASPI commands, just as devices with SCSI (5.07-03) or USB interface (5.07-05). This set of drivers, packed into SFX archive 720PCM32.EXE, can be downloaded from server ftp://ftp.panasonic.com/pub/Panasonic/Drivers/CDROM/ .
118
5.07-03
Small Computer's System Interface (SCSI) has been developed in 1982 by Shugart Co. and became widely known due to its implementation in PCs of Apple Co., which were popular then. In 1986 SCSI interface has got status of standard ANSI X3.131-1986. Since then it has been modernized several times. For AT-compatible PCs the SCSI bus is a rare requisite, it is used predominantly in servers. Because of this reason SCSI bus driver's features are not described here in detail. Nevertheless a short survey of SCSI bus access principles is given below.
119
120
The FireWire interface has been developed by Apple Company in 1987 for connecting devices having large data transfer rates, up to 393 Mb/sec. Such data transfer rates are typical for video cameras, for video storage devices, for external hard disk drives. Since 1995 the FireWire interface specification has been adopted as standard IEEE1394. For AT-compatible PCs expansion cards with IEEE1394 interface controllers are produced, but up to now the FireWire interface hasn't become widely used. Now two drivers for IEEE1394 interface controllers are known, which are claimed to be suitable under MS-DOS7. The first is ASPI1394.SYS driver, developed by Iomega Company. From site http://www.stefan2000.com/darkehorse/PC/DOS/Drivers/USB/ you can download archive iomega_usb_firewire_dos_driver_boot_disk.zip with version 1.01 of ASPI1394.SYS driver (dated 2002). Just there is an example of loading this driver, but explanation of parameters isn't given. Version 1.02 of another driver SBP2ASPI.SYS, developed by Medialogic Company, is contained in SFX archive DAT.EXE, which can be downloaded from site http://www.datoptic.com/fw25fr.html . Since both mentioned drivers implement the same unified set of ASPI commands, hence for HDDs and for CD-ROM drives, connected via IEEE1394 bus, potentially just those drivers are suitable, which are used for devices of the same class on SCSI bus (5.07-03) and on USB bus (5.07-05). But this feature hasn't been tested by the author, and is reported here for contemplation only.
5.07-05
Universal Serial Bus (USB) is a joint development of Compaq, Intel, Microsoft and NEC. In 1996 these companies have adopted version 1.0 of USB bus specification. Since then an embedded USB controller has become ordinary requisite of motherboards in almost all AT-compatible computers. Practical importance of USB bus has increased even more in 2002 with adoption of USB 2.0 specification, stipulating data transfer rates up to 480 Mb/s. Now a vast majority of external devices is designed for connection via USB bus. USB controllers implement three different types of interaction with PC's software: Open Host Controller Interface (OHCI), Universal Host Controller Interface (UHCI), Enhanced Host Controller Interface (EHCI). Each type of interaction needs a specific treatment. All modern USB controllers match USB 2.0 specification and implement EHCI type of interaction, but are able to simulate USB controllers of previous generation, implementing either OHCI or UHCI type of interaction. UHCI controllers transfer data via an allotted port, whereas OHCI controllers
121
122
123
124
125
However, letter-name appointment by the Di1000dd.sys driver goes "dirty", created dummy disks (phantoms) are not hidden. The Di1000dd.sys driver can't cope with multiple LUN numbers, can't provide access to disks with FAT-32 file system, to devices beyond the bus of first USB controller, needs a media to be present in storage device(s) at the moment of initialization. Though capabilities of both mentioned Novac's drivers seem substantially limited, they may be sufficient for performing main data transfer operations in computers with known hardware. One more way of access to USB storage devices from DOS is opened by combined driver DUSE.EXE, developed by Cypress Semiconductor. Version 4.9 of this driver (dated 2003), packed into archive Duse_4_9.zip, is available in subdirectory "downloads" of site http://www.pocketec.net/support.taf . The DUSE.EXE driver combines USB controller driver with driver for CD-ROMs and with driver for non-optical storage devices, including HDDs and solid-state storage cards. The opportunity to get all-in-one seems attractive, but is accompanied with unexpected and unpleasant surprise. Because of a strange reason DUSE.EXE requires DOS working in real mode only, that is without the EMM386.EXE driver (5.04-02), which gives access to UMB memory region. Having no access to UMBs, DOS is forced to load all drivers into conventional memory (below 640 kb), and then resident module of DUSE.EXE with default settings occupies yet more 233 kb of precious conventional memory, so that no free space is left there for normal operation of other programs. Some tolerable configuration can be obtained, if access to UMB region is provided in real mode by UMBPCI.SYS driver (5.04-04) and if you decline loading of DUSE's CD/DVD-ROM support module. Thus total size of DUSE's resident module has been reduced to 153 kb, but all attempts to load it beyond conventional memory have failed. For comparison: resident modules of USBASPI.SYS and ASPIDISK.SYS drivers provide nearly the same functions, but both occupy 45 kb only and can be loaded beyond conventional memory either in CPU's real mode or in V86 mode as well. If circumstances will force you to use the DUSE.EXE driver, then a line in CONFIG.SYS file for loading DUSE.EXE may look, for example, as DEVICE=\DOS\DRV\Duse.exe NOC EMU XFER=8 where the shown options mean:: NOC decline loading of CD/DVD-ROM support module. EMU emulate IRQ calls in order to prevent driver's mutual incompatibility. XFER=8 reduce buffer size to 8 kb (1 to 64 kb are allowed, default is 64 kb). Whole list of DUSE's options can be found in file DUSEUsersGuide.pdf inside the same archive Duse_4_9.zip. The INT option, proposed there among other options, deserves special notice. It claims to provide an opportunity to divide external HDDs into
126
5.08
5.08-01
Auxiliary driver IFSHLP.SYS provides service functions for IFS (= Installable File Systems) procedures. IFS file system is a form of hiding real data structures and real ways of access, enabling to avoid explicit technical complications and implement selective access rights. Original 16-bit access to storage devices is performed by BIOS's INT 13 handlers, which require CPU's real mode and can't do their job indirectly, for example, via a network. When CPU works in protected mode or in V86 mode, each call to INT 13 handler implies a callback with switches to real mode and back. These switches make a slow 16-bit
127
5.08-02
An opportunity of access from DOS to disks with NTFS file system is provided by driver NTFSDOS.EXE, written by Mark Russinovich and Bryce Cogswell. Full-functional versions of this driver (latest the 5-th) were not free. Here a freeware version 3.02 (dated 2001) is described, which enables only reading NTFS volumes, including reading programs into memory for execution. However, NTFSDOS driver and several other helpful items disappeared from their author's personal site since 2006, when the authors joined Microsoft's developers team. Now archive Ntfs30r.zip containing NTFSDOS.EXE driver is still available from, for example, server ftp://ftp.uni-koeln.de/pc/msdos/diskutils/ and from http://web.archive.org/web/20020123013310/www.sysinternals.com/new.shtml . It's just the moment to remind, that Windows-2000/XP installation program, being launched from a CD-ROM disc, gives an opportunity to open the so called Recovery Console. Default settings of the Recovery Console enable writing to NTFS volumes, but prohibit copying of file(s) from NTFS volumes. Consequently, version 3.02 of the NTFSDOS.EXE driver enables to do just what is not allowed by Recovery Console. The NTFSDOS.EXE driver uses XMS-memory and therefore needs the HIMEM.SYS driver (5.04-01) to be loaded beforehand. Besides that, NTFSDOS.EXE needs much space in conventional memory. In particular, for access to a 10 Gb NTFS disk the NTFSDOS.EXE driver occupies 285 kb of conventional memory. Because of such memory requirements it's not reasonable to keep the NTFSDOS.EXE driver constantly loaded. Therefore it is loaded from command line just before access to NTFS disk becomes necessary, for example: C:\DOS\DRV\Ntfsdos.exe /L:K /C:1024 /N /X /U /V where: C:\DOS\DRV\ path example to NTFSDOS.EXE driver. /L:K an option, assigning the "K" letter-name to the first found NTFS disk. The next NTFS disks, if there are any, will be given next letter-names
128
5.08-03
MSCDEX.EXE is a resident program, which cooperates with one or more CD/DVDROM drivers, enables disk's letter-names assignment and access to the associated logical disks. In fact it is a file system translator for CD-ROM's file systems "High Sierra" and ISO 9660, which differ from those "understandable" to DOS' core. The MSCDEX.EXE program is contained in Windows-95/98 releases and normally can be found in \Windows\Command directory. MSCDEX.EXE should be loaded after all necessary CD-ROM drivers, but before SMARTDRV.EXE (5.06-01) cache driver, if the latter is used. Most often the MSCDEX.EXE program is loaded from CONFIG.SYS file with INSTALL (4.15) or INSTALLHIGH (4.16) command, but may be launched from AUTOEXEC.BAT file with LH command (3.17) or just from command line, for example: C:\DOS\DRV\Mscdex.exe /D:MSCD001 /e /k /s /v /L:N /M:12 where: C:\DOS\DRV\ path example to MSCDEX.EXE file.
129
5.08-04
In recent years several amendments to CD/DVD-ROM file system specifications have been adopted, stipulating usage of long filenames. The MSCDEX.EXE program (5.08-03) can't cope with modified file systems on optical discs: it shows truncated long names, but gives no access to such files. This drawback isn't inherent to SHSUCDX.COM program; except this, SHSUCDX.COM is a close functional equivalent of MSCDEX.EXE. Development of SHSUCDX.COM program has been started by John McCoy and now is continued by Jason Hood. Archive Shcdx302.zip, containing version 3.02 (dated 2005) of SHSUCDX.COM program, can be downloaded from http://www.shsucdx.adoxa.cjb.net/ .
130
131
/C /V
/U
Note 1: data transfers, arranged by SHSUCDX.COM program, are not supported by SMARTDRV.EXE cache buffer driver (5.06-01), but are supported by UIDE.SYS cache buffer driver (note 3 to 5.06-01).
5.09
Optical disc drives with different interfaces usually need different drivers. Some drivers for optical disc drives with SCSI and USB interfaces are mentioned in articles 5.07-03 and 5.07-05. But in AT-compatible PCs a vast majority of internal disc drives has the IDE (ATA) interface, and drivers for such disc drives are presented here, in part 5.09. Popular types of motherboards are equipped with two IDE controllers. Each of them enables to connect two devices, which may be optical disc drive(s) and magnetic hard disk drive(s) as well. Connection of optical and magnetic drives to one IDE controller is allowed, but can't be recommended, since relatively slow optical disc drives cause reduction of total data transfer rate. It's better to connect optical device(s) to a separate IDE controller, which must be enabled in settings of BIOS Setup program. In modern PCs the BIOS Setup programs propose several operation modes for IDE controllers, including that with polling serial ATA buses only (S-ATA). Since most optical disc drives have parallel ATA interface, a compatible operation mode should be preferred. If BIOS Setup program enables to affect direct memory access (UltraDMA), then an ordinary mode of IDE access should be set ("Legacy IDE mode"). These settings guarantee proper operation of optical disc drives and drivers in modern PCs under MS-DOS7.
132
The OAKCDROM.SYS driver is developed by Oak Technology for CD-ROM disc drives with standard IDE interface. OAKCDROM.SYS file, dated 1997, is present in WINDOWS-95/98 emergency diskettes. The same version of OAKCDROM.SYS can be downloaded from site http://www.computerhope.com/download/hardware.htm#02 . In modern PCs, equipped with a DVD drive, the OAKCDROM.SYS driver enables access to both CD and DVD discs. But in PCs, produced before 2003, presence of a DVD drive is not enough, since BIOS system may provide no support for ATAPI protocol (see 5.07-01 for details), and then OAKCDROM.SYS will enable access to CD discs only. In such computers access to DVD discs is still possible, but requires ATAPI protocol support module to be installed in advance by ATAPIMGR.SYS driver (5.07-01). The OAKCDROM.SYS driver should be loaded by DEVICE (4.06) or DEVICEHIGH (4.07) command from a line of CONFIG.SYS file, for example: DEVICEHIGH=\DOS\DRV\Oakcdrom.sys /D:MSCD001 /V where: \DOS\DRV\ path example to OAKCDROM.SYS driver. /D:MSCD001 announcement of an arbitrary identifier up to 8 characters long. This identifier enables recognition of the driver by MSCDEX.EXE program (5.08-03) or by SHSUCDX.COM program (5.08-04). One of these should be loaded afterwards, and it must be given the same /D: parameter followed by exactly the same identifier in its command line. /V this option causes status message display. The OAKCDROM.SYS driver is able to search for CD/DVD-ROM disc drives throughout all IDE-controllers having typical port addresses (1F0h, 170h) and typical interrupt request (IRQ) line numbers. If PC is equipped with several such disc drives, the OAKCDROM.SYS driver will take under its control all drives, which will be found. 5.09-02 VIDE-CDD.SYS CD-ROM driver from Acer Co.
Version 2.14 of the VIDE-CDD.SYS driver, dated 1998, is a close functional equivalent of OAKCDROM.SYS driver (5.09-01), but VIDE-CDD.SYS is more compact (size 11.8 kb) and can accept port address(es) together with IRQ line number(s) from command line. The latter feature is important when non-standard interface specifications are used, and search for disc drives must be avoided. SFX archive Apicd214.exe, containing VIDE-CDD.SYS driver, can be downloaded via internet, for example, from ftp://ftp.benq.co.uk/cd-rom/drivers/apicd214.exe . If PC's BIOS doesn't support ATAPI protocol, then VIDE-CDD.SYS can provide access to DVD discs, but needs the ATAPIMGR.SYS driver (5.07-01) to be loaded in
133
Version 4.2 of QCDROM.SYS driver was developed in 2007 by J. R.Ellis on the basis of his earlier driver XCDROM.SYS. Contrary to the latter, the QCDROM.SYS driver is able to provide access to DVD discs and doesn't need ATAPI protocol support neither from PC's BIOS, nor from ATAPIMGR.SYS driver. The QCDROM.SYS driver can control up to three CD/DVD-ROM drives, connected to IDE controller(s) with standard port base address(es) and standard interrupt request line(s): 1F0h with IRQ 14 and/or 170h with IRQ 15. The QCDROM.SYS driver, packed into archive QCDROM42.ZIP, can be downloaded from internet site http://cyberia.dnsalias.com/Cyb.05.Htm . QCDROM.SYS should be loaded by DEVICE (4.06) or DEVICEHIGH (4.07) command from a line of CONFIG.SYS file, for example: DEVICEHIGH=\DOS\DRV\Qcdrom.sys /D:MSCD001 /L where: \DOS\DRV\ path example to QCDROM.SYS driver. /D:MSCD001 announcement of an arbitrary identifier up to 8 characters long. This identifier enables recognition of the driver by MSCDEX.EXE program (5.08-03) or by SHSUCDX.COM program (5.08-04). One of
134
/L
Besides the shown parameters, QCDROM.SYS driver can accept from command line the following options: /A forces to use old alternate IDE controller addresses 01E8h01EFh on primary channel, and 0168h-016Fh on secondary channel. This may be required for "odd" SATA BIOS or other unusual cases. /I forces QCDROM.SYS to arrange its own XMS buffer. This enables to avoid possible conflicts with "odd" DMA and BIOS services. /UF prescription to enable accelerated direct memory access (UltraDMA). Feasibility of UltraDMA is confirmed for many motherboard's chipsets, but not for all. A check whether the /UF parameter is permissible can be recommended for each particular case. /UX refrain from UltraDMA usage, even if both disc drive and motherboard claim support for UltraDMA. The /UX option is used for diagnostics and testing purposes. When /UX option is specified, the QCDROM.SYS driver doesn't need XMS memory. /PM (= Primary Master): don't search for disc drives, but check presence of master disc drive only on the bus of primary IDE controller. /PS (= Primary Slave): don't search for disc drives, but check presence of slave disc drive only on the bus of primary IDE controller. /SM (= Secondary Master): don't search for disc drives, but check presence of master disc drive only on the bus of secondary IDE controller. /SS (= Secondary Slave): don't search for disc drives, but check presence of slave disc drive only on the bus of secondary IDE controller. Up to three parameters, prohibiting search for disc drives, may be specified in one command line. Disc drives will be numerated according to order of corresponding parameters in command line. If specified checks don't reveal presence of disc drive(s), then all other optical disc drives will be ignored, and resident module of QCDROM.SYS driver wouldn't be loaded.
135
The DVS.SYS driver has been developed in 1999 by Digital Video Systems Corp. DVS.SYS driver is able to provide access to DVD discs and doesn't need ATAPI protocol support neither from PC's BIOS, nor from ATAPIMGR.SYS driver. Version 1.1 of DVS.SYS driver, packed into SFX archive Drdvdwd.exe, can be downloaded from internet site http://web.archive.org/web/20030212210152/www.dr-tech.com/drivers/cdroms.html . The DVS.SYS driver should be loaded by DEVICE (4.06) or DEVICEHIGH (4.07) command from a line of CONFIG.SYS file, for example: DEVICEHIGH=\DOS\DRV\Dvs.sys /D:MSCD001 where: \DOS\DRV\ path example to DVS.SYS driver. /D:MSCD001 announcement of an arbitrary identifier up to 8 characters long. This identifier enables recognition of the driver by MSCDEX.EXE program (5.08-03) or by SHSUCDX.COM program (5.08-04). One of these should be loaded afterwards, and it must be given the same /D: parameter followed by exactly the same identifier in its command line. The DVS.SYS driver is able to search for disc drives, but performs search more slowly, than other similar drivers. An experiment has confirmed, that DVS.SYS driver can take under its control at least two optical disc drives, connected to either of IDE controllers with standard specifications of port base addresses and interrupt request line numbers (1F0h with IRQ 14 and/or 170h with IRQ 15).
136
Chapter 6.
6.01 6.02 6.03 6.04 6.05 6.06 6.07 6.08 6.09 6.10 6.11 6.12 6.13
Attrib.exe Chkdsk.exe Choice.com Command.com Debug.exe Diskcopy.com Doskey.com Deltree.exe Edit.com Expand.exe Extract.exe Fc.exe Fdisk.exe
Functions of command interpreter in MS-DOS7 are complemented and extended by separate executable files (utilities). Several utilities for DOS are supplied within Windows-95/98 OS release. If the origin of utility is not specified explicitly in this chapter, hence, it is one of these Microsoft's utilities, which normally can be found in \Windows\Command directory. Besides these, many other utilities can be successfully used in MS-DOS7, including those from previous versions of DOS and those written by various private and non-private software vendors. MS-DOS utilities contain internal help text. It can be displayed, when the utility is launched from command line with a single "/?" parameter. Rarely other utilities can be encountered, which display help text when are launched with "h" parameter or without parameters at all. Some MS-DOS utilities request DOS version number and wouldn't perform their mission, if the number, returned by DOS, isn't equal to the expected one. It is not necessarily caused by incompatibility: most such version-specific utilities successfully operate under MS-DOS7, when the Setver.exe driver (5.01-02) substitutes expected version number from its table for the actual DOS version number. Mismatch of DOS version numbers may cause a problem of other kind: when a synonymous utility, belonging to a different DOS version, is encountered in the current directory, the proper utility from MS-DOS7 can't be addressed via the PATH environmental variable (2.02-02), because DOS begins its search in the current directory and finds the improper utility first. In MS-DOS7 version-specific utilities are: Attrib.exe,
137
6.01
In directories each file is represented by a record (A.09-1). Attribute byte 0Bh in this record specifies file's status and rights of access (A.09-2). Attribute byte 0Bh in record(s), related to particular file(s), can be changed by ATTRIB.EXE utility, launched, for example, in the following way: Attrib.exe +R A C:\DOS\COM\*.txt /S where: +R A set attribute R (read-only) and remove attribute A (prescribed for archiving); there may up to four attributes specified: A, H (hidden), R and S (system), each preceded by "+" (to be set up) or "" (to be removed). Attributes, which are not mentioned, remain unchanged. C:\DOS\COM\*.txt an example of path and mask specifications for the files to be processed (= all textual files in C:\DOS\COM directory). If path is not specified, files in current directory are implied. A particular filename may be used instead of a mask. /S this option prescribes to continue the search for file(s) to be processed in subdirectories of the specified (or of implied current) directory. Note 1: if attributes are not specified in command line, the ATTRIB.EXE utility shows which of the requested files have been found and displays a summary of their features, including attributes.
6.02
CHKDSK.EXE is a utility for analyzing and repairing FAT (File Allocation Tables) on diskettes and on hard disk drives, formatted with file systems FAT12, FAT16 or FAT32. By comparing data in first and second FAT tables (and in directories as well), CHKDSK.EXE reveals crosslinks and lost clusters. The latter are transformed into files
138
Note 1: the SCANDISK.EXE utility (6.21) performs the all the checks which CHKDSK.EXE does, and some extra checks besides that. Therefore CHKDSK.EXE is worthy only as an information utility, displaying summary of disk's usage. Note 2: CHKDSK.EXE shouldn't be applied to network drives, CD-ROMs, and to virtual disks, arranged by utilities Assign.com, Subst.exe and Join.exe. Note 3: the CHKDSK.EXE utility doesn't check whether the files are readable or damaged. Note 4: the CHKDSK.EXE utility with /F parameter shouldn't be applied to disks suspected of being infected by virus: an antivirus program should be applied first. Note 5: the CHKDSK.EXE utility shouldn't be applied to disks having from 4085 to 4087 clusters, because it may report nonexistent errors in such disks, and an attempt to fix these errors may destroy stored data.
6.03
The CHOICE.COM utility is intended for arranging interactive menu in the course of batch file(s) execution by command interpreter. CHOICE.COM accepts a character, sent from keyboard or via redirection, and then sets ERRORLEVEL value (3.15-03, 9.07-03) according to the number of the accepted character in a succession of prescribed alternatives. Here is an example of CHOICE.COM usage, charged with its main mission: Choice.com /C:YNC /T:C,10 Yes, No or Continue where the options are:: /C:YNC the /C: parameter introduces a list of characters to be accepted. Returned errorlevel value corresponds to the order of accepted character in this sequence example: Y 1, N 2, C 3. When the /C: option is not specified, default is YN ( Y 1, N 2 ). /T:C,10 set waiting time limit 10 seconds (0 99 allowed) and then, if no key is pressed, take the C choice as default (errorlevel 3 in this example). When time limit is not set, CHOICE.COM will wait indefinitely. Time
139
140
6.04
Command interpreter COMMAND.COM is a resident program, which presents command prompt, enables execution of commands from command line and automatic execution of commands from batch files as well. File COMMAND.COM contains code of all internal commands, specified in chapter 3. COMMAND.COM gets control over PC at final booting stage, when IO.SYS interpreter executes the SHELL command (4.26) in CONFIG.SYS file. This first execution loads resident module of COMMAND.COM and arranges its primary (parent) environment with global variables. After that each next execution COMMAND.COM creates a derived (child) environment, inheriting copies of all the variables from the former (parent's) environment. Contrary to ordinary utilities, COMMAND.COM leaves no reference in its PSP (= Program Segment Prefix, A.07-1) to the parent's PSP, so the parent's environment is preserved hidden with no legal access. Repeated execution of COMMAND.COM enables to change local environmental variables and execute application files otherwise (run stepby-step, for example). Having accomplished its mission, the last loaded resident module of COMMAND.COM can be unloaded out of memory with EXIT command (3.12). Then its derived (child) environment becomes lost with all its variables, active state of the former (parent) resident module is restored, and the former (parent) environment again becomes accessible. Here is an example of loading the command interpreter, in particular, for step-by-step execution of a single batch file: Command.com C:\dos\ CON /E:1008 /L:512 /U:255 /Y /C R:\Trial.bat where: C:\dos\ an example of a path to COMMAND.COM file. This path (with final backslash!) is used to compile a value of %COMSPEC% environmental variable in the new environment. The path item should precede all other parameters. If the path is omitted, then %COMSPEC% variable will inherit its value from the parent environment. an example of device specification for I/O operations. CON stands for console, that is display for output plus keyboard for input. CON is the
CON
141
142
/Z
Note 1: the /C parameter affects keyboard functions used to terminate execution of batch files (1.03). Note 2: when COMMAND.COM is loaded permanently with /P parameter, its first default task is interpretation of AUTOEXEC.BAT file, which is implied to exist in the root directory of the current disk. Note 3: when execution of AUTOEXEC.BAT is launched implicitly via the SHELL command (4.26), then the %0 parameter inside AUTOEXEC.BAT can't be used to initiate recursion. Note 4: having been loaded with /K parameter, COMMAND.COM is able to accept commands from other processes or from command file(s) via input redirection (see 2.04-02, 2.04-05, and also note 1 to part's 6.05 introduction article). Note 5: being executed, batch files (with *.BAT suffix) share a common environment with their interpreter COMMAND.COM. Ordinary executable files (with *.COM or *.EXE suffix) get a copy of that environment.
6.05
DEBUG.EXE is a specialized command interpreter (debugger), written by Tim Patterson as an instrument for creation of that operating system, which later has been bought by Microsoft and became known as first version of MS-DOS. DEBUG.EXE helps to find out and to fix errors in both program's executable code and PC's hardware settings. Capabilities of DEBUG.EXE are not limited to a set of its internal commands, because these commands enable to assemble just any machine code and to execute it at once. Of course, DEBUG.EXE is not a tool for writing complex programs; it can't compete with high-level languages. But circumstances dictate other criteria, when you can't rely on known compilers, when you have to examine something or to clear up. If you do it with DEBUG.EXE in CPU's real mode, then all AT-compatible computers obediently submit themselves at your disposal. You'll get direct access to disks, to ports, to memory and to code inside executable files. Command line for launching DEBUG.EXE may include name of a file to be loaded just at start and prepared for debugging, for example: Debug.exe Trial.com /B /S
143
144
Having been started, DEBUG.EXE presents its "" (hyphen) prompt. It means that DEBUG.EXE is ready to accept a command. Debugger's commands consist of a one-letter or two-letter instruction name, which may be followed by parameters, separated by space(s) or by comma(s). Separators may be omitted, if their absence in any particular position doesn't cause ambiguity. DEBUG.EXE treats numbers as hexadecimal, upper and lower case letters as identical; the only exception from this rule is data comparison with SEARCH command (6.05-16). Most often the first parameter following command's name specifies a start point memory address. It may be presented in full form as a segment address and offset (for example, 1FA5:0100), or with an explicit reference to a segment register (for example, CS:0100), or in a short form as an offset only (for example, 0100). In the latter case segment will be defined by CS (Code Segment) register for "A" (Assemble), "G" (Go), "L" (Load), "P" (Proceed), "T" (Trace), "U" (Unassemble) and "W" (Write) commands; for other commands it will be defined by DS (Data Segment) register. Offset specifications less than 4 digits long are regarded as having preceding zero(s). For example, offset 100 is interpreted as 0100h. Initial segment address in all segment registers is the same, allocated by DOS on request of DEBUG.EXE in order to lay the code, which is to be debugged. This code will be written not just from the start of the allocated segment, but from a certain shifted point, defined by offset in IP (=Instruction Pointer) register. Initial setting for offset is 0100h (i.e. 256 decimal). Reserved 256 bytes at the start of allocated segment are known as PSP = Program Segment Prefix (details in appendix A.07-1). If action of debugger's command is directed to a group of bytes, then this group is defined either by its start point address and length or by start point address (segment:offset) and end point offset. Parameter, specifying size (length) of a group, is marked by preceding letter "L" for example, L20 specifies a group of 20h bytes. Sum of start offset and length must not exceed FFFFh. If a hexadecimal number in place of length specification is not preceded by letter "L", it is interpreted as end point offset inside the same segment. Separate segment specification for the end point is not allowed. Obviously, end point offset must be greater than start point offset. Having typed a command, the user initiates its execution by pressing the ENTER (or "CR") key. The simplest debugger's commands consist of nothing more than a single character and don't need much comments: Q ("Quit") terminate debugger's session, exit to DOS. ? display a list of debugger's commands.
145
The "A" command switches DEBUG.EXE to translation of assembler language instructions (see chapter 7) into executable machine code. This code is not executed at once, but rather is written into memory, thus forming a succession of machine commands. When translation is finished, the formed succession can be executed or saved in a file. Here is an example of the "A" command specification in debugger's command line: A 0100 Letter-name of the ASSEMBLE command is followed by address of a memory cell, where the first byte of the formed machine code should be written. In the shown example this start address is represented by an offset only, but it may be specified in any of allowable forms, enlisted in article 6.05-01. If segment is not specified explicitly, then it is defined by segment register CS:. Start address may be omitted at all, and then the start cell is pointed at by contents of registers CS:IP. Having accepted the "A" command, DEBUG.EXE shows full address of a memory cell, where the first byte of translated machine code will be written, and displays a blinking cursor, thus inviting you to type an assembler instruction, which should be translated. At that moment DEBUG.EXE doesn't accept commands, described in part 6.05, but accepts only assembler instructions, described in chapter 7. The user confirms an end of each assembler instruction by ENTER keystroke. DEBUG.EXE translates the entered instruction, writes its machine code into memory cell(s), and shows a new line with a new full address, inviting to type the next assembler instruction. In order to terminate translation of assembler instructions you have to ignore debugger's invitation and just press ENTER, while the line is left empty. Then DEBUG.EXE returns to normal interactive operation, shows its hyphen prompt and again becomes ready to accept commands, described in part 6.05. If DEBUG.EXE received assembler instructions from a file via input redirection, then an empty line should be left in
146
The "C" command shows non-coincident bytes from two successions of memory cells. Identical bytes are skipped. Command line with a call for the "C" command may look, for example, as follows: C 113 L8 153 After the letter-name "C" the first and the third parameters are start addresses of those memory cell successions, where are the bytes to be compared. Start addresses may be specified in any of their allowable forms (6.05-01). In the shown example both start addresses are represented by offsets only, and then default segment for both sequences is defined by segment register DS:. The second parameter after letter-name "C" defines either offset of the last memory cell in the first succession or the length of byte successions to be compared (if the number is marked by preceding letter "L"). In the shown example L8 means length 8 bytes. All three parameters after the "C" command are required. 6.05-04 DEBUG.EXE: the "D" (= Dump) command
The "D" command displays hexadecimal contents of a group of memory cells, and at the same time in the right part of display screen shows the same contents, represented by characters and symbols of ASCII code. Here is an example of debugger's command line with a call for the "D" command: D 19A9:02E0 L10 Just after the letter-name "D" there is a full address of the first memory cell in a group to be displayed. Address may be specified in any of allowable forms (6.05-01). If segment is not specified, then it will be defined by segment register DS:. The second parameter after the letter-name "D" defines either offset of last memory cell in a group or a length of that group (if the number is marked by preceding letter "L"). In the shown example L10 means length 10h (i.e. 16 decimal) bytes. If the second parameter is not specified, 80h bytes (i.e. 128 decimal) will be shown. If both parameters are omitted, then 80h bytes will be shown, starting from current offset, which is increased by length of the shown bytes group at each execution of the "D" command. This is why each next execution of the "D" command without parameters will show not the same, but the next group of bytes. Examples of dumps, displayed by the "D" command, are shown in fig. 8 12 (in chapter "Appendixes").
147
The "E" command writes new contents into one or more memory cells. Debugger's command line with a call for the "E" command may look like this: E 0211 In the shown example the letter-name "E" is followed by address (offset) of the memory cell, where writing of new data should start. When segment is not specified, then it is defined by DS: segment register. Address may be specified in any of its allowable forms (6.05-01), but it can't be omitted. Having accepted this command, DEBUG.EXE shows full address of the requested memory cell and shows the data byte, present in this memory cell at that moment. The shown line ends with a dot, which should be regarded as a prompt to type a new data byte for this memory cell. Data in ASCII codes are not accepted by "E" command via keyboard, data should be presented in a form of two hexadecimal digits per byte. Then a SPACEBAR keystroke should follow. If a new data byte has been typed in, it will be written into memory cell, but if a new byte hasn't been typed, the former contents of this memory cell is preserved. In any case DEBUG.EXE will show contents of the next memory cell, inviting to change it in the same way. If instead of the SPACEBAR keystroke the "" (minus, or hyphen) key will be pressed, then the user will be given an opportunity of another attempt to change contents of the previous memory cell. In order to terminate data input, you have to press ENTER instead of SPACEBAR. The "E" command is executed otherwise, without waiting for data input via keyboard, if new input data are specified in the same command line after the memory cell address, for example: E 03E0 'Data error' 0D 0A New input data in command line may be represented either by two hexadecimal digits per byte, or as string(s) of ASCII characters, enclosed at both sides in quotes or in double quotes. Both forms of representation may interlace in one line in arbitrary order. Before being written into memory, ASCII characters are translated into hexadecimal form byte-by-byte, except the enclosing quotes, which are not translated and are not stored. If a byte is represented by a single hexadecimal digit, it will be interpreted as the lower half-byte, for example, the "A" digit will be interpreted as 0Ah. In any case data will be written into sequential memory cells, starting from the specified address, in the order of their placement in command line. 6.05-06 DEBUG.EXE: the "F" (= Fill) command
The "F" command fills a succession of memory cells with a repeated record of a single byte or of any given sequence of bytes. In debugger's command line a call for the "F" command may look, for example, like this: F 03E0 L2E 0D 0A 'Reserved' 90 90
148
The "G" command initiates execution of machine code commands, prepared in memory beforehand. Here is an example of debugger's command line with "G" command: G =100 143 Optional parameters following letter-name "G" are addresses. The first address, preceded by equality sign, points at the first byte of that machine command, which is to start the execution procedure. Though start address may be specified in any of its allowable forms (6.05-01), in the shown example it is represented by offset only; hence, default segment will be defined by CS: segment register. If an address, marked by preceding equality sign, in not present in command line, then the start memory cell will be pointed at by contents of CS:IP registers. Those addresses, which are not preceded by equality sign, are breakpoints. Up to 10 breakpoints may be specified in command line for different branches of the program under test. In those memory cells, which are pointed at by breakpoints, DEBUG.EXE replaces original machine code by code CCh of INT 03 interrupt (8.01-04). Interrupt INT 03 handler returns control back to DEBUG.EXE, and then debugger restores original machine code in breakpoint memory cells, and also stores the state of registers and flags, thus preparing further continuation of debugging procedure. For successful termination of the described operations two conditions must be met. First, breakpoint address(es) must correspond to first byte(s) of machine command(s), since
149
The "H" commands calculates and displays a sum and a difference of two hexadecimal numbers, each of up to four digits long. In debugger's command line it may look like this: H 12BA 00AE In the shown example two parameters after letter-name "H" are original numbers presented for calculation. Any of them or both may comprise less than four digits, and then zero(s) in senior positions will be implied. Presence of both parameters is required. 6.05-09 DEBUG.EXE: the "I" (= Input) command.
The "I" command reads a byte from the specified port and shows it on the screen. The shown byte can't be written elsewhere or stored. A single parameter in command line after the letter-name "I" is port address, for example: I 03f8 Unlike ordinary memory addresses, port addresses have no relation to segments and segment registers. Port address is just a hexadecimal number of up to four digits long. Zeros in senior positions may be omitted. Addresses of several common ports are enlisted in appendix A.14-1.
150
The "L" command reads a succession of codes from disk and loads it into memory, starting from specified address and on. Succession of codes to be read may be defined either by a name of a file or by a number of disk's sector. Here is an example of "L" command usage for loading a succession of codes from a file: L 0100 Single parameter in the shown example is a memory cell address, where writing of code succession should start. Address may be specified in any of its allowable forms (6.05-01), but when segment is omitted, it is defined by CS: segment register. It is assumed, that the name of a file to be read is written already into PSP (A.07-1) by "N" command (6.05-12) or was initially transferred there from parameter of that command line, which has launched the debugger. Moreover, it is assumed, that contents of DS: segment register has not been changed since this name was written into PSP, and hence the "L" command can still refer to segment address in DS: for reading this name from PSP. Address after the letter-name "L" may be omitted, and then succession of codes will be loaded from address CS:0100 an on, except loading from files with suffixes *.EXE and *.HEX. These files contain a header with supplementary loading specifications. Supplementary offset from the header of *.HEX files is added to that taken by default (0100h) or to that specified after the "L" command. For *.EXE files the offset specified after the "L" command is ignored, header of the *.EXE files is not loaded. In order to see "as they are" those files loaded without a header or not loaded at all, their suffix should be replaced (preferably with *.BIN). In any case length of the file is stored in CX register. If length exceeds 64 kb, then senior digits of length are written into BX register. For loading a succession of codes from sectors of logical disk, command line must contain four required parameters, for example: L 0100 2 0 1 The first parameter, just as in previous example, is address of that memory cell, where writing of code succession should start. The second parameter is interpreted as logical disk number: 0 disk A:, 1 disk B:, 2 disk C:, and so on. The third parameter represents actual hexadecimal number of the first sector to be read, the fourth parameter total hexadecimal number of sectors to be read. Up to 80h sectors can be read in one operation. In particular, the shown example specifies reading of a single sector number 0 (the bootsector) from logical disk C: and writing its contents into memory starting from address CS:0100. Contrary to loading from files, loading from disk's sectors doesn't induce writing of loaded succession's length into registers. Physical disk's sectors beyond logical disk(s) are not accessible to "L" command.
151
The "M" command copies a block of data from one place in memory into another. In debugger's command line a letter-name "M" must be followed by three required parameters, for example: M 0100 L20 0180 In the shown example the first parameter specifies start address of the source data block, and the third parameter a similar start address of the target memory space. Both these addresses may be specified in any of their allowable forms (6.05-01). If address is represented by offset only, then segment is defined by DS: segment register. The second parameter in command line represents either the length of the source data block (if the number is marked by preceding letter "L") or offset of its final byte. In the shown example second parameter L20 denotes length 20h bytes (32 decimal) of the source data block. If the source data block and target memory space are not superimposed, then data in the source block remain unchanged. But when target memory space overlaps source data block, data in the overlapped part of this block will be overwritten without error message. In any case the order of copying is chosen so that the bytes to be overwritten are copied first. 6.05-12 DEBUG.EXE: the "N" (= Name) command
The "N" command declares a name of a file, which is to be loaded later by "L" command (6.05-10) or written later by "W" command (6.05-19). Letter-name "N" must be followed by a name of a file, for example: N Trial.com /S /D If suffix of the specified name exists, it can't be omitted. Name of a file may be preceded by a path and may be followed by a group of parameters (as "/S /D" in the shown example). All data, declared by the "N" command, are written into PSP area (A.07-1) at address DS:0081 and on. Besides that, length of the written string is stored at DS:0080, file's name without suffix at DS:005D, suffix at DS:0065. As far as the mentioned addresses refer to DS: segment register, its contents must not be changed up to the moment when the written data will be requested by "L" or by "W" command. When the "N" command is executed without parameters, it overwrites data in DS:005C DS:0080 memory cells and writes code 0Dh in memory cell DS:0081. Note 1: initial settings in CS: and DS: registers are the same. Therefore loading of the program under test below default address CS:0100 may cause overwriting of PSP data (A.07-1), including the stored filename(s). Moreover, loaded code itself may be damaged later because of writing data into PSP by "N" command.
152
The "O" command sends a data byte into specified port. Letter-name "L" in debugger's command line must be followed by two parameters, for example: O 0378 00 The first parameter represents port address, the second parameter is the byte to be sent. Unlike ordinary memory addresses, port addresses have no relation to segments and segment registers. Port address is just a hexadecimal number of up to four digits long. Zeros in senior positions may be omitted. Addresses of several common ports are enlisted in appendix A.14-1. Note 1: incautious usage of the "O" command may affect important PC's settings and cause serious malfunctioning. 6.05-14 DEBUG.EXE: the "P" (= Proceed) command
The "P" command initiates execution of a prescribed number of machine instructions, prepared or loaded into memory beforehand. If execution is initiated by the "P" command, then loops (7.03-55 7.03-57), subroutine calls (7.03-08), repetitions (7.02-03, 7.02-04) and interrupts (7.03-28) are not traced step-by-step, but rather are executed as though it were one machine instruction. This feature is the main difference between "P" and "T" (6.05-17) commands. Debugger's command line with "P" command may look like this: P =0100 5 The first parameter after letter-name "P" is address of machine instruction, intended to start execution. This address may be specified in any of its allowable forms (6.05-01), but it must be preceded by equality sign. If address is represented by offset only, as in the shown example, then default segment is defined by CS: segment register. The second parameter specifies the number of machine instructions to be executed. Both parameters may be omitted, and then only one instruction will be executed, the one pointed at by CS:IP. After execution of machine instructions the "P" command displays current states of registers and flags, and also presents result of unassembling the next, not executed yet machine instruction. Note 1: the "P" command shouldn't be applied to machine instructions, which are read directly from fixed storage chips or from read-only memory (ROM). For such purposes the "T" command (6.05-17) should be used instead.
153
If you type into command line a single letter R and press ENTER, then DEBUG.EXE will show you current states of CPU's main registers and flags. Typical initial states of registers and flags, set by DEBUG.EXE at the moment when it is launched, are shown below in fig.1.
Fig 1
Let's notice, that in all shown segment registers (DS, ES, SS, CS) the same hexadecimal number is written: it is segment address of memory space, allocated by DOS for debugging experiments. Other registers and flags acquire predetermined initial states. Bi-letteral designations of flag's initial states have the following meaning: NV No oVerflow; UP count UP, or incremental calculation of offsets; EI Enable Interrupts; PL Positive number; NZ Non-Zero value or inequality; NA No Auxiliary carry in the 4-th digit position; PO Parity Odd, odd sum of bits in least significant byte; NC No Carry in most significant digit position. The last line of displayed message (fig.1) shows machine instruction code in memory cell, pointed at by CS:IP, together with unassembled representation of that code. Just this machine instruction will be executed, if DEBUG.EXE will be given "T" (6.05-17) or "P" (6.05-14) command with default parameters. You may get an opportunity to change flag's states, if letter-name "R" in debugger's command line will be followed by parameter "F": R F DEBUG.EXE responds to this command by showing current flag's states together with a hyphen, which is an invitation to input bi-letteral designations of desired flag's states. Flag's states, opposite to those shown in fig.1, can be set by typing the following input: OV OVerflow after arithmetic operation; DN count DowN, or decremental calculation of offsets; DI Disable Interrupts; NG NeGative number; ZR ZeRo value or equality; AC Auxiliary Carry in the 4-th digit position;
154
The order of flag's states input is indifferent. If new state for some flags is not specified, those flags preserve their former state. In order to get an opportunity to change a state of a register, letter-name "R" in debugger's command line must be followed by a name of that register, for example: R AX The shown command opens the AX register for writing new value. The "R" command also enables to open registers BX, CX, DX, BP, SP, DI, SI, CS, DS, ES, SS, IP (and PC it is another name for the same IP register). Having got the shown command, DEBUG.EXE displays former contents of that register and a colon, thus inviting you to input new value of up to four hexadecimal digits long. If you wouldn't type new data and just press ENTER, the former value in this register will be preserved. The "R" command doesn't provide separate access to senior byte and to least significant byte of 16-bit registers, for example, to AH and to AL inside the AX register. If you want to change the state of only one byte, you have to specify unchanged former value for the other byte of the same register. Note 1: the 8 flags, mentioned in this article, are not all the flags in modern CPU's. For a more complete list of flags see appendix A.14-4. 6.05-16 DEBUG.EXE: the "S" (= Search) command
The "S" command performs a search for a specified sequence of bytes throughout a limited search region. Both sequence of bytes and search region must be defined by parameters, following the "S" command in debugger's command line, for example: S 0100 L200 20 'st' The first parameter after the letter-name "S" is start address of search region. Though start address may be specified in any of its allowable forms (6.05-01), in the shown example it is represented by an offset only, and then default segment is defined by DS: segment register. The second parameter specifies either a length of search region (if the number is marked by preceding letter "L") or offset of the last cell of that region. In the shown example length 200h bytes (512 decimal) is declared. The third and all the following parameters represent that sequence of bytes, which is to be searched for. At least one byte of this sequence must be specified. Bytes of the sequence may be represented either by two hexadecimal digits per byte or by a group(s) of ASCII characters, enclosed at both sides in quotes or in double quotes. Both forms of representation may interlace in one line in arbitrary order. Before being taken into account, ASCII characters are translated into hexadecimal form byte-by-byte,
155
The "T" command initiates execution of a prescribed number of machine instructions, prepared or loaded into memory beforehand. The "T" command can trace execution of machine instructions inside loops, subroutine calls, interrupt handlers, etc. This feature is the main difference between "T" and "P" (6.05-14) commands. Here is an example of debugger's command line with "T" command: T =0100 5 The first parameter after letter-name "T" is address of machine instruction, intended to start execution. This address may be specified in any of its allowable forms (6.05-01), but it must be preceded by equality sign. If address is represented only by offset, as in the shown example, then default segment is defined by CS: segment register. The second parameter specifies number of machine instructions to be executed. Both parameters may be omitted, and then only one instruction will be executed, the one pointed at by CS:IP. After execution of machine instructions the "T" command displays current states of registers and flags, and also presents result of unassembling the next, not executed yet machine instruction. Note 1: as far as the "T" command traces execution of machine instructions inside loops, subroutine calls and interrupt handlers, it may involve very long sequences of instructions, taking too much time to trace. In such cases the "P" command (6.05-14) should be preferred. 6.05-18 DEBUG.EXE: the "U" (= Unassemble) command
The "U" command displays assembler instructions obtained by translation of executable machine code from a group of memory cells. A debugger's command line with "U" command may look like this: U 014B L10 The first parameter of the "U" command is an address of the first memory cell in selected group. Address may be specified in any of its allowable forms (6.05-01). If
156
Fig. 2
In case of improper start address specification (0180h) translation of bytes at offsets 0180h and 0184h produces invalid results, but after that the "phase" of unassembling comes to a proper steady state. If translated machine instructions are correct and are known to DEBUG.EXE, then stochastic process of reaching the proper steady state usually takes up to 10h bytes and doesn't affect further translation. Of course, commands should be unassembled just as they are apprehended by processor. However, the same machine code may be interpreted in different ways. One reason of differences is that machine codes of short jump instructions don't comprise jump target address, but rather contain a target offset relative to current contents of IP register. Debugger calculates target addresses by addition of these offsets to IP register contents. The latter depends on start offset, where the first byte has been loaded of that code, which is to be unassembled. Therefore unassembling of short jump instructions can't be
157
12 02
158
The "W" command copies a code's succession from PC's memory onto a logical disk, either in a form of a file or just into disk's sectors. Here is an example of "W" command usage for writing a succession of codes into a new file: W 0100 A single parameter in the shown example is a memory cell address, where reading of code succession should start. Address may be specified in any of its allowable forms (6.05-01), but when segment is omitted, default segment is defined by CS: segment register. If address is not specified, reading of code succession starts at CS:0100. Length of code succession, counted from start address, must be prepared beforehand: least significant two bytes of length in CX register, most significant byte in BX register. It is assumed, that name of new file to be created is written already into PSP (A.07-1) by "N" command (6.05-12). The name may have any suffix except *.HEX and *.EXE, because DEBUG.EXE is unable to compile a header for such files. One more assumption is that contents of DS: segment register has not been changed since name of new file was written into PSP, and hence the "W" command can still refer to segment address in DS: for reading this name from PSP. If the prepared name is not preceded by a path, new file will be created in the current directory. If a file with the same name exists yet, it will be overwritten without error message. For writing into sectors of a logical disk the letter-name "W" must be followed by four required parameters, for example: W 0100 0 0 1 Here the first parameter presents start address of code succession, just as in previous example of writing into a file. The second parameter is interpreted as logical disk number:
159
The "XA" command appeals to EMM386.EXE memory manager (5.04-02, 8.03-59) with a request to allocate a specified memory space beyond conventional memory and to assign a hexadecimal reference number a handle to the allocated memory space. Requested operation can't be performed unless the EMM386.EXE memory manager is loaded yet and unless memory above 1088 kb is available. In debugger's command line the name "XA" must be followed by requested number of logical memory pages of 16 kb each, for example: XA 1A The shown requested memory space is 1Ah (26 decimal) logical pages, which will be enumerated from 00h to 19h. DEBUG.EXE responds to the request with a message, for example, "Handle created 0006". Hence, the allocated memory space can be referenced with hexadecimal number 0006h. But this is not enough for access to the allocated memory space, one more operation must be performed: a limited number of selected logical pages from the allocated memory space must be mapped onto physically addressable memory space by "XM" commands (6.05-22). 6.05-21 DEBUG.EXE: the "XD" (= Deallocate) command"
The "XD" command appeals to EMM386.EXE memory manager (5.04-02, 8.03-61) with a request to deallocate a particular memory space, which has been allocated yet by "XA" command (6.05-20). It is assumed, that EMM386.EXE memory manager is loaded and that memory beyond 1088 kb is available. In debugger's command line the name "XD" must be followed by a hexadecimal reference number (a handle), identifying the memory space, which is to be deallocated, for example:
160
The "XM" command appeals to EMM386.EXE memory manager (5.04-02, 8.03-60) with a request to map a 16 kb logical page in allocated memory space onto a "physical" page of the same size. Here the term "mapping" means adjustment of address translation mechanism in CPU so that ordinary 16-bit addresses within "physical" page address space are translated by CPU into 32-bit addresses of real memory cells in that part of address space, which corresponds to specified logical page. It is assumed, that PC has a 32-bit CPU, that amount of memory exceeds 1 Mb, that EMM386.EXE memory manager is loaded yet and that reference number (a handle) is assigned yet to the allocated memory space by "XA" command (6.05-20). In debugger's command line the name "XM" must be followed by three required parameters, for example: XM 0B 03 0006 The first parameter 0Bh in the shown example is a number of requested logical page in allocated memory space. The second parameter 03h in the shown example is a number of "physical" page. The third parameter is a reference number (a handle), which is assigned to that allocated memory space, where the requested logical page belongs. Numbers of "physical" pages may be selected from 00h to 1Bh, but it should be taken into account, that "physical" pages from 04h and on occupy address space in conventional memory. This is why the most actively used are "physical" pages 00h 03h, which by default correspond to segment addresses E000h, E400h, E800h and EC00h accordingly. But their placement in address space may be affected by PC's BIOS requirements and by EMM386.EXE (5.04-02) memory manager's settings. Therefore in each particular case placement of "physical" pages should be checked by the "XS" command (6.05-23) or by a call to INT 67\AX=5800h handler (8.03-70). 6.05-23 DEBUG.EXE: the "XS" (= Show) command
The "XS" command appeals to EMM386.EXE memory manager (5.04-02, 8.03-70) with a request to display data, related to memory usage and to placement of "physical" pages. It is assumed, that PC's amount of memory exceeds 1 Mb and that EMM386.EXE memory manager is loaded yet. Since "XS" command needs no parameters, command line with "XS" command looks like this:
161
6.06
DISKCOPY.COM copies the whole contents of one floppy disk onto another, including volume label and serial number. Both floppies (diskettes) must be of the same type. Here is an example of command line for copying a diskette in a PC equipped with two floppy drives: DISKCOPY.COM A: B: /V where: A: B: /V letter-name example of a drive with source diskette; letter-name example of a drive with target diskette; optional prescription to verify the copy.
Besides the shown options, DISKCOPY.COM can accept also /1 prescription to copy one side only of a diskette (for obsolete diskettes with a single writable side). /M prescription to perform multi-pass copying via memory, when one floppy drive only is available and a buffer-file on a HDD shouldn't be arranged. If computer is equipped with only one floppy drive, then the same letter-name must be specified both for source and for target. In this case DISKCOPY forms a temporary buffer-file on a HDD in a directory, specified by environmental variable %TEMP%, then suggests to replace the source diskette with target diskette, and copies data from buffer-file onto target diskette. After that buffer-file is automatically deleted. But when the %TEMP% variable is not defined (or when /M option is specified), the source diskette is partially copied into available memory space, and therefore you'll have to exchange source and target diskettes several times in the same floppy drive.
162
6.07
DOSKEY.COM is a resident supplement to command line functions of COMMAND.COM interpreter. DOSKEY.COM enables to edit command line text, to recall former commands, to create and execute macrocommands, comprising simple sequences of operations. Procedures, specified via macrocommands, become available after loading of their definitions by DOSKEY.COM into special memory buffer. Besides this buffer, resident module of DOSKEY.COM occupies about 4 kb. DOSKEY.COM in MS-DOS7 has been changed relative to its former versions: it has been given an ability to load a list of macrocommand's definitions from a textual file and to increase sizes of both keyboard buffer and command line editing buffer. DOSKEY.COM can be loaded from command line or from a line of a batch file (AUTOEXEC.BAT or other), either directly or with LH command (3.17), for example: LH Doskey.com /bufsize:1024 /insert /file:C:\DOS\MS7\Macro.scr where: /bufsize:1024 macrocommand buffer's size definition (minimum is 256 bytes, default is 512). This option should be used when DOSKEY.COM is loaded for the first time or is reloaded with /reinstall option (see further). Free part of the same buffer is used to store previous command lines (the history). /insert turns command line into character insertion mode, enabling to insert each next character between those typed earlier. Default is overstrike mode, when next characters replace the former ones. /file:C:\DOS\MS7\Macro.scr is a specification example for loading macrocommand's definitions from a textual file (an example of such file is given further). The path, preceding filename, may be omitted, if this file exists in the current directory. Filename and suffix of this file are arbitrary, but if suffix exists, it must be specified. Other options, allowable for loading operations, are: /echo:off disable display of executed macrocommands on the screen.
163
164
Note 1: macrocommand wouldn't be executed, if its name in command line is preceded by at least one space. Note 2: when macrocommand is synonymous to a command, it disables the latter (macrocommand will be executed instead). Note 3: DOSKEY.COM is NOT compatible with TSR file managers (Norton Commander, Volcov Commander, etc). File managers usually are preferred.
6.08
DELTREE.EXE is an extremely dangerous utility, because it enables to delete directories with all their subdirectories and files, regardless to file's attributes. Only root directories of logical disks can't be deleted with DELTREE.EXE. An example of its usage may look like this: Deltree /Y C:\TEMP\TDIR1 where: /Y an option, prescribing to delete without prompts and confirmations.
165
6.09
EDIT.COM is a popular double-window editor program mainly for textual files, but also with limited capabilities for editing binary files. EDIT.COM enables to keep open up to ten files simultaneously. Fig.3 shows two different files opened in separate windows of EDIT.COM editor.
Fig. 3
The file(s) to be edited may be as large as PC's memory allows. EDIT.COM arranges a clipboard, enabling to send selected parts of text between opened files. Besides that, EDIT.COM is able to cooperate with mouse device drivers, thus making editing much easier and faster. The EDIT.COM editor may be launched from command line without parameters, and then it will show an empty window. The user will have to open file(s) to be edited via menu "FILE". Otherwise the file(s) to be edited may be specified just in command line, for example: Edit.com C:\DOS\Addons.txt Part6.txt Name of the first file to be edited is preceded by a path; without a path the EDIT.COM editor can open those file only, which are present in the current directory. Thus, the second file (Part6.txt), specified without path, must be present in the current directory. By default
166
167
Several "hot" key combinations are shown in upper bar menus. These menus and separate items in these menus can be opened not only with keystrokes, but also with mouse's left button as well. As far as binary files have no line structure, line wrapping specification in command line will make their editing more convenient, for example: Edit.com /78 Sc_sct.dat where /78 an option for wrapping lines to 78 characters wide. Instead of 78 any number up to 255 may be specified, but 78 corresponds to actual editor's window width in 80x25 screen display mode. turn display to monochrome; turn display to maximum allowable number of screen lines; open file(s) for reading only, exclude risk of change(s); force usage of short filenames; display on-line help.
EDIT.COM is able to accept from command line also the following options: /B /H /R /S /?
6.10
EXPAND.EXE is unpacker for files compressed with Microsoft's COMPRESS.COM utility. Each such compressed file contains only one original file and inherits its name, except that the last character in suffix is replaced with underscore, for example *.TX_ instead of *.TXT. Releases of previous MS-DOS versions and several other software packets comprise such compressed files together with EXPAND.EXE unpacker utility. In particular, EXPAND.EXE is present in SFX archive DOS62SP.EXE, which can be downloaded from Microsoft's FTP-server ftp://ftp.microsoft.com/softlib/mslfiles/ .
168
6.11
The EXTRACT.EXE utility unpacks files, compressed by MAKECAB.EXE packer. Microsoft uses this algorithm for compression of separate files in Windows-2000/XP releases, and also for compiling large multi-volume archives with *.CAB suffix in releases of Windows-95/98/ME. EXTRACT.EXE enables to extract separate files from large *.CAB archives and to display their contents. Here is an example of command line for extracting a list of contents from a multi-volume *.CAB archive: Extract.exe /A /D E:\Win95\OSR2.PE\Win95_21.cab > C:\Temp\List.txt where: E:\Win95\OSR2.PE\ example of a path to one *.CAB archive from Windows-95 release. Other volumes of the same archive are implied to exist in the same directory. If path is omitted, archive is searched for in current directory only.
169
As far as *.CAB archives contain a large number of files, it's difficult to perceive their long tables of contents from a scrolling screen. This is why in the shown example output is redirected into file List.txt, which may be analyzed more conveniently with a viewer (6.19) or with an editor program (6.09). Here is one more example of EXTRACT.EXE usage for extracting of a single file from a multi-volume archive, when it is not known beforehand, which particular volume contains the required file: Extract.exe /A /Y /L C:\Windows\System Win95_02.cab Msvcrt40.dll where: an option, prescribing to overwrite any synonymous file in the target directory without prompt. /L an option, prescribing to interpret the following item (C:\Windows\System) as a target path for unpacking. When /L parameter is omitted, default target for unpacking is the current directory. Msvcrt40.dll a name example for the file to be unpacked (there may be several filenames specified for unpacking). In the shown example the first specified filename (Win95_02.cab) is interpreted as a name of that archive volume, where a search for the required file should start. All following filenames are interpreted as names of those files, which should be extracted and decompressed. Execution of the shown command line initiates a search procedure through volumes from 02 to 26 for the specified file. In fact it will be found in the 13-th volume and will be unpacked into C:\WINDOWS\SYSTEM directory, overwriting there a corrupted sample of the same file. Such procedures are much more fast, than total unpacking of a software release. EXTRACT.EXE doesn't allow wildcards (2.01-03) in filenames, but accepts one more optional parameter /E , which forces to unpack all contents of the specified CAB-file. In this case a particular name(s) for the files to be unpacked shouldn't be specified. The /E parameter is expedient for unpacking non-cabinet compressed files (those marked with underscore at the end of suffix) from Windows-2000/XP releases. But total unpacking of large *.CAB files in DOS takes too much time. A combination of /A and /E parameters deserves special caution, because it may initiate a process, which will take hours of time and a lot of disk's space. /Y
170
6.12
The FC.EXE utility enables to compare two files, either binary or textual. Binary comparison is expedient for finding changed bytes in nearly identical binary files: FC.EXE displays byte number for each pair of mismatched bytes and these bytes themselves, taken from each of the compared files. Here is an example of command line for performing binary comparison: Fc.exe /B Trial2.com D:\Temp\Trial1.com where: /B an option, prescribing binary comparison. Trial2.com an example of the first file to compare; since its name isn't preceded by a path, it is implied to exist in the current directory. D:\Temp\Trial1.com a name example of the second file with preceding path. Binary comparison doesn't imply searching for match in mutually shifted successions of bytes. Textual comparison is based on line structure of textual files. FC.EXE compares textual files line-by-line and displays mismatched lines side-by-side. When order of correspondence between line successions becomes disrupted, FC.EXE can restore it by searching for a next group of matching lines. Both comparison and search conditions are specified by options in command line, for example: Fc.exe /A /C /L /LB9 /N /T /W /1 A:\Config.sys C:\Config.sys where: /A /C /L /LB9 /N /T /W /1 display 2 lines only (the first and the last) from each mismatched group of lines. disregard letter's case (for ASCII codes up to 127). prescription for ASCII textual comparison. limit example (9 consecutive mismatched lines) for a region of match search; default is 100 lines. prescription to display line numbers. prescription to avoid expansion of tabulation codes (09h) into spaces. prescription to ignore empty space (tabulation codes and spaces). a number example of consecutive lines that must match after a group of mismatched lines.
171
6.13
Disks, known by their letter-names, are logical disks. Contrary to those, physical hard disk storage devices have no letter-names. Writable storage space in physical storage devices may be divided into several partitions, and each partition may represent a separate logical disk. The FDISK.EXE utility is a proprietary MS-DOS7's tool for arranging partition structures in physical HDDs (Hard Disk Drives). Being launched without parameters, FDISK.EXE asks the user whether large disk support should be provided or not. Rejection of the offer means that arranged partitions within range 512 2048 Mb will be of FAT-16 type, otherwise FAT-32 type will be preferred. FAT system for partitions outside the mentioned range is assigned by default: FAT-32 for partitions larger than 2048 Mb, FAT-16 for partitions between 512 and 16 Mb, FAT-12 for 16 Mb and smaller volumes. Those apt to trust theirselves may specify command line parameters, enabling to get rid of undue questions and restrictions: Fdisk.exe /fprmt /actok The /fprmt parameter cancels query about large disks support and gives all rights on file system choice to the user. The /actok parameter enables to arrange an active partition in any physical hard disk drive (otherwise an active partition may be arranged in the first physical HDD only). Being launched in the shown way, FDISK.EXE presents a menu to select an operation: to display current partition structure, to delete or to create a partition or to make it active. The user is allowed to compose partition structure, but the latter is not written to disk at once. FDISK.EXE gives a chance to correct it. If a partition ought to be bootable, don't forget about making it active. Then you may exit FDISK.EXE. If partition structure has been changed, FDISK.EXE writes it to disk and exits into reboot, because created partitions must be registered by BIOS. PC's BIOS system appoints letter-names to registered partitions. Since that moment all registered partitions become "visible" in DOS as logical disks, but new logical disks are not yet formatted and therefore are inaccessible. New logical disks become accessible after formatting by FORMAT.COM utility (6.15). Besides interactive arrangement of partition structures, FDISK.EXE may be used as ordinary console utility with the following options:
172
Fdisk.exe /cmbr 2
Regardless to purpose of FDISK.EXE usage, its command line may be complemented with /X option, which forces to avoid extended support functions for access to disk(s). The /X option should be remembered, when ordinary usage attempts fail: the HDD either is not recognized, or is found inaccessible, or the PC gets hanged with "Stack overflow" message. Such outcomes may take place because of incorrect configuration, hardware faults, virus MBR infection. Not necessarily, but in some such cases the /X option may help. If an identical partition structure should be formed on several new HDDs, then automatic (non-interactive) arrangement of partitions should be preferred. Automatic writing of a partition structure onto a HDD can be initialized by the following example of command line: Fdisk.exe 1 /PRI:2000 /EXT:8000 /LOG:8000 /Q where: 1 addressed physical HDD number (1, 2, ...). /PRI:2000 arrange a primary partition, for example, 2000 Mb. If FAT-16 file system should be formed in this partition, then /PRIO: parameter (instead of /PRI:) should be specified. /EXT:8000 arrange extended partition, for example, 8000 Mb. /LOG:8000 arrange logical disk, for example, 8000 Mb, inside the extended partition. For sizes not larger than 2000 Mb parameter /LOGO: (instead of /LOG:) means that FAT-16 file system should be formed. /Q "quiet" option, i.e. run without screen messages. Having finished its job successfully, FDISK.EXE initializes reboot. Note 1: overwriting of MBR enables to get rid of MBR bugs, including those inflicted by viruses. However, some BIOS extensions and boot managers use non-standard types of MBR, which can't be restored by FDISK.EXE. In such circumstances other ways of MBR restoration should be preferred (example in 9.02-03). Note 2: Microsoft's FDISK.EXE doesn't support non-sequential placement of partitions and therefore gives no opportunity to bypass worn-out regions of physical disk's surface. FDISK.EXE can't arrange correctly those partitions, which cross the
173
6.14
The FIND.EXE utility acts as a filter for textual data: it receives lines of text from a file or via redirection, selects lines with or without a certain combination of characters, and sends selected lines into standard output channel (STDOUT) for being displayed on the screen by default. Here is an example of word(s) filter usage for searching lines with a specified string of characters: Find /N /I " INT 13 " C:\DOS\SRV\Drives.txt where: /N an option, prescribing to accompany the displayed lines with their line numbers. /I an option, prescribing to ignore the case of letters in specified string of characters. " INT 13 " an example of characters string to be searched for, enclosed in double quotes. Note spaces between words and each of adjacent double quotes this guarantees finding of whole words, but not parts of other words. C:\DOS\SRV\Drives.txt an example of a file to be analyzed (with preceding path). If path is not specified, the file is implied to exist in the current
174
Void string to be searched for is regarded by FIND.EXE as a special non-existing object. Therefore FIND.EXE will simply count all the lines, including the empty ones. After counting the lines FIND.EXE always returns errorlevel 0. The third usage example presents lines of a batch file. Suppose that the target path is given as a value of environmental variable %P%, and it is not known, whether it has a final backslash or not. Since DOS is not indifferent to absence of a the final backslash, you need to append it, if it isn't specified yet. This may be done in the following way: echo %P%\\ | Find.exe "\\\" > nul if errorlevel 1 set P=%P%\ In the first line FIND.EXE analyses redirected output of the ECHO command and tries to find specified combination of symbols, which will be present there if the given path contains final backslash. STDOUT output of FIND.EXE presents no interest and is sent to NUL (into nowhere). The result becomes known via the errorlevel value, left by FIND.EXE. It is analyzed in the second line of the presented example. Errorlevel 1 means
175
6.15
The FORMAT.COM utility arranges logical disks on storage media, including diskettes and partitions of hard disks. Formatting includes testing of each sector's readability, writing sector's headers, creation of boot sector, of file allocation table (FAT) and of root directory. Clusters found to have non-readable sectors are marked in FAT as "BAD" and thus get out of use. Disks of 16 Mb and smaller are formatted with file system FAT-12. Choice of file system (FAT-16 or FAT-32) for partitions of hard disks is made with respect to FAT type identifier (A.13-6), assigned to particular partition beforehand by FDISK.EXE (6.13). Cluster size is calculated automatically as allowable minimum for given disk's size and FAT type. Formatting of floppy disks (diskettes) implies low-level recalibration of tracks, so that actual capacity of a diskette may be altered. An example of command line for formatting a diskette may look like this: Format.com A: /V:Archives /Q /F:1.44 /B where: A: a required letter-name specification of the disk to be formatted. Valid letter-names are appointed to disks at boot time, when disks are registered by BIOS. Those letter-names, which are appointed or
176
/z:64
177
6.16
Volume's label is a word or a group of words of up to 11 characters long, used as a storage media identifier. Volume's label is written into boot sector (A.03-4) and, besides that, into a hidden entry of the root directory. Most often volume's label is appointed during formatting procedure, but it may be assigned or changed later by the LABEL.EXE utility, for example: Label.exe R:RAMDRIVE where: R: a specification example for a disk which should have its volume label altered; when disk is not specified, the current disk is taken by default. RAMDRIVE an example of volume label to be assigned to specified disk. When volume label is omitted, LABEL.EXE shows current label of specified disk and offers to type a new one. New label specification may be accepted via redirection too (2.04-02, 2.04-05). If user rejects the offer, he is prompted to delete (or to preserve) the current label. Having finished its job, the LABEL.EXE utility leaves behind the following errorlevel values: 082 015 002 000 label writing attempt has failed. invalid letter-name, no corresponding drive. drive has no removable storage media inside. disk is either accessible or non-formatted. Anyway, writing of volume's label hasn't been attempted.
The returned errorlevel value may be determined just as it is shown in articles 3.15-03 and 6.03. As far as the returned errorlevel value is informative, the LABEL.EXE utility is sometimes used to test disk's accessibility (example - in article 9.03-02).
178
Chapter 6: Selected utilities for MS-DOS7 6.17 MEM.EXE memory allocation explorer
The MEM.EXE utility is called in order to display information about amount of available memory, about its allocation, about loaded resident modules, for example: Mem.exe /A /C /P where options are: /A append summary with data about free space in HMA area. /C show a summary table of memory usage. The first column of this table enlists names of resident modules, the rest columns details of memory allocation. Instead of the /C option there may be specified: /D show status of resident modules and drivers; /F show nothing but amount of free memory; /M:HIMEM show details about a particular resident module (HIMEM in this example). Its name, specified after the /M option, must be separated by a colon. Names of modules should be taken from the first column of summary table. /P make a pause after each screenful of information.
6.18
The MODE.COM utility implements a number of interface configuration functions for ports, for video card and for character generator. A summary table of current subordinate equipment settings is displayed by MODE.COM utility, when it is called with /STATUS option: Mode.com /STATUS 6.18-01 MODE.COM: ports tuning operations
Interface tuning operations for serial ports (COM1, COM2, COM3, COM4) are performed by MODE.COM as it is shown in the following example: Mode.com COM1:11,E,8,2,B where: 11 E 8 2 set the 110 baud rate; values 11, 15, 30, 60, 12, 24, 48, 96, 19 are allowed and correspond to baud-rates 110, 150, 300, 600, 1200, 2400, 4800, 9600 and 19200 accordingly. implement even parity check; instead you may specify: O implement odd parity check; N no parity check. set 8 information bits per codeword (8 or 7 allowed). set number of stop bits (1 or 2 allowed).
179
Interface tuning operations for parallel ports (LPT1, LPT2, LPT3) imply that the connected device is a printer. This is why for parallel ports the MODE.COM utility accepts other parameters, for example: Mode.com LPT1:80,6,B where: 80 6 B number of characters per line (80 or 132 allowed); number of lines per inch (6 or 8 allowed), means normal reaction on printer errors. Instead of B there may be specified just those options as for serial ports in the previous example.
The MODE.COM utility can readdress messages from parallel port (LPT1 LPT3) to any serial port (COM1 - COM4), thus enabling to use a printer with serial interface: Mode LPT1:=COM2 In order to cancel readdressing the MODE.COM utility should be called once more without further specifications after the same parallel port's name: Mode.com LPT1: 6.18-02 MODE.COM: textual video modes switching
The MODE.COM utility allows two forms of commands for switching textual video modes (A.10-1). Here is an example of the first (most obsolete) form of command: Mode.com co80 where: co80 means color video mode with 80 characters per line. Instead of co80 there may be specified: bw40 monochrome video mode, 40 characters per line; bw80 monochrome video mode, 80 characters per line; co40 color video mode, 40 characters per line.
The second form of command for switching textual video modes looks like this: Mode.com 80,25
180
Note 1: switching of textual video modes is accompanied with loading fonts anew. If current font has been installed by some other program (except MODE.COM), then change of a video mode by MODE.COM may cause a return from national font to default american font codepage 437. 6.18-03 MODE.COM: codepage selection
Commands for codepage preparation and selection operations, performed by MODE.COM utility, usually are written into the AUTOEXEC.BAT file (9.01-02). All these operations need the DISPLAY.SYS driver (5.02-02) to be loaded yet. The first of these operations is preparation of several codepages for further activation: Mode.com CON CP PREP=((437,850,866) EGA3.CPI) where: CON is a specification of the device, addressed by this operation. Instead of CON (console, i.e. keyboard and display) ports LPT1, LPT2 and PRN (printer) may be specified. CP PREP abridged name of operation "Code Page PREPare". (437,850,866) numbers of codepages (A.02-2) to be prepared. Only these codepages will be available for switching by CHCP command (3.04). EGA3.CPI name example of a file, containing all those codepages, which should be prepared.
Then one of prepared codepages should be made active by means of selection operation: Mode.com CON CP SEL=866 where: CP SEL abridged name of operation "Code Page SELect". 866 number example of the codepage to be activated. The codepage, activated for the CON (console) device, defines visual presentation of letters and symbols on the screen. In order to determine which codepage is currently active for a particular output device, you should call for the MODE.COM utility with device specification (CON, PRN, LPT1 or LPT2), with CP (Code Page) operation name and with the /STATUS option: Mode.com CON CP /STATUS
181
6.19
When long messages are sent to display as a whole, text is scrolled over the screen too fast to be perceived. In order to make long messages readable, the MORE.COM viewer sends them to display in a page-by-page manner. Each time the screen is full with text, the MORE.COM viewer suspends output, giving an opportunity to read the text. Each user's keystroke initiates display of the next text page. The MORE.COM viewer intercepts the messages, sent into standard output channel (STDOUT), either by means of input redirection (2.04-02): More.com < D:\MyDocs\Part2.txt or by means of intermediate redirection (2.04-05): Type D:\MyDocs\Part2.txt | More.com where: D:\MyDocs\Part2.txt is a name example of a file to be displayed, preceded by full path. When the path is omitted, the file is implied to exist in the current directory. Type D:\MyDocs\Part2.txt is an example of a command (3.30), sending its output via STDOUT output channel. Any other command, sending its output to STDOUT, may be specified instead. Note 1: messages sent to display via BIOS' interrupts or via STDERR output channel can't be intercepted by MORE.COM. Note 2: when the MORE.COM viewer accepts a message by means of intermediate redirection (2.04-05), this message is written into a temporary file, and access to a writable media is necessary. If current disk is non-writable or write-protected, and if a path to a writable media is not defined in environmental variable %TEMP%, then the MORE.COM viewer can't perform this mission. Therefore interception by means of input redirection should be preferred.
182
Chapter 6: Selected utilities for MS-DOS7 6.20 MOVE.EXE copying and renaming utility
The MOVE.EXE utility is used to rename directories and to move files from one directory into another. When source and target directories belong to different logical disks, moving is equivalent to copying, followed by deleting the copied file in the source directory. But when both source and target directories belong to the same logical disk, moving can be performed much faster by rearranging directory entries: reference record to file's first cluster is moved from one directory table into another without touching the file itself. The MOVE.EXE utility is able to decide, which way of moving should be implemented in each particular case. Moving of file(s) may be accompanied by renaming. Renaming of a directory is also performed by correcting an entry in parent directory table. Here is an example of MOVE.EXE usage for moving files from one directory into another: Move.exe /Y D:\MyDocs\Part*.txt C:\Dos\Chap*.txt where: /Y an option prescribing to overwrite synonymous file(s) in the target directory without prompt. When this option is not present in command line, MOVE.EXE tries to find it in the value of COPYCMD environmental variable. If COPYCMD value contains this option, you may overcome its action by specifying an opposite /-Y option in command line. D:\MyDocs\Part*.txt specification example for source file(s) with preceding path. Path may be omitted, if the file(s) reside in current directory. There may be several source specifications in one command line. C:\Dos\Chap*.txt target specification example, including a mask for renaming the files to be moved. The last of all such specifications in command line is interpreted as target directory specification. If the last name in this specification is not a name of an existing object, then this new name is assigned to the moved file. But when the last name in target specification is a name of an existing directory, file(s) are moved into that directory without renaming. In order to rename a directory, the last name in source specification must be not a mask and not a filename, but a name of an existing directory. In this case the target specification must consist of a new name only without path, even if the directory to be renamed is not a subdirectory inside the current directory.
183
Chapter 6: Selected utilities for MS-DOS7 6.21 SCANDISK.EXE disk(s) repairing tool
SCANDISK.EXE is a program for examination and repairing diskettes and hard disk drives, formatted with FAT12, FAT16 or FAT32 file systems. SCANDISK.EXE checks boot sector, reveals lost clusters, corrects crosslinks in FAT table, examines writeability of disk's surface in each cluster. Non-readable clusters are marked in FAT as BAD and therefore get out of further use. The course of testing and location of bad clusters are displayed in a chart, shown below in fig.4.
Fig. 4
SCANDISK.EXE tries to rewrite information from bad clusters into good ones so as to restore integrity of each file. Being launched regularly, SCANDISK's maintenance procedures enable to keep your computer in good health for a long time. Details of test's structure are defined by parameters, stored in a separate file SCANDISK.INI, which must be present in the same directory with main SCANDISK.EXE file. SCANDISK.INI is a textual file. It contains comprehensive commentaries and can be edited by the user. If you have to check and repair a drive according to all parameters in SCANDISK.INI, you have to launch SCANDISK.EXE with /CUSTOM option in command line. When /CUSTOM option is not specified, only those parameters in [ENVIRONMENT] section of SCANDISK.INI file will be taken into account. Parameters in command line have priority over those specified in SCANDISK.INI file. SCANDISK.EXE is able to fix automatically most part of the errors it finds, but for that it has to be launched with parameters in command line, for example:
184
When /AUTOFIX option is not specified, then before making any changes SCANDISK.EXE offers you to write disk's current state onto UNDO-diskettes. This gives an opportunity to restore current disk's state later, if fixes will happen to inflict something wrong. While making a decision about UNDO diskettes, it should be taken into account, that amount of data in current state record may be enormous. Large partitions of modern HDDs may require hundreds of UNDO-diskettes and a lot of time. This is why SCANDISK's offer about UNDO-diskettes most probably should be rejected. If nevertheless original disk's state was saved in UNDO-diskette(s), and restoration of this state has been found necessary, then restoration procedure must be performed at once, before any new files are written onto this disk: Scandisk.exe /UNDO B: where: /UNDO parameter initiating restoration procedure. B: specification example of a drive, which will be used to read the UNDO-diskette(s). One more operation, performed by SCANDISK.EXE, is exploration of whether a particular file is fragmented or not: Scandisk.exe /FRAGMENT C:\WINDOWS\SYSTEM\Kernel32.dll where: /FRAGMENT an option, inducing exploration of file's fragmentation.
185
6.22
The SORT.EXE utility accepts textual lines from a file or via redirection and sends the same lines in another sorted order via STDOUT channel to the screen (the default), or to another file or device. Sorting is defined by the order of characters in ASCII code table.
186
Second usage example shows input from a source file via redirection and output redirected into another (target) file: Sort.exe /+9 < D:\MyDocs\Unsort.txt > D:\MyDocs\Sort.txt where: D:\MyDocs\Sort.txt specification example for the target file. If this file exists, it will be overwritten without prompt. Specification of the same file for both the source and the target is not allowed (data will be lost!). The last example shows input via intermediate redirection from another command and output of sorted lines to a printer: Type D:\MyDocs\Unsort.txt | Sort /+3 > PRN Note 1: redirection to a printer shouldn't be attempted unless you are sure that your printer is properly connected to LPT1 port, is switched on and is able to cooperate with MS-DOS. Note 2: both output redirection ( > ) and redirection via a "pipe" ( | ) need access to a writable media and can't be performed, if this condition is not met (2.04-03 2.04-05).
6.23
The SUBST.EXE utility arranges virtual disks, used as an equivalent replacement for real paths. Originally SUBST.EXE has been developed as a means of access to subordinate directories for old programs (from DOS versions earlier than 3.0). Early DOS versions didn't "know" hierarchical directory structures, all files were stored in a single root directory. The SUBST.EXE utility enables to address a file in any subdirectory as though it were in the root directory of a disk. Nowadays the SUBST.EXE utility is used
187
Being executed without parameters, the SUBST.EXE utility displays a list of currently active virtual disks. Note 1: virtual disks, arranged by SUBST.EXE, can't be subjected to actions of the following utilities: Assign.com, Backup.exe, Chkdsk.exe, Defrag.exe, Diskcomp.com, Diskcopy.com, Fdisk.exe, Format.com, Label.exe, Mirror.exe, Recover.exe, Restore.exe, Scandisk.exe, Sys.com, Undelete.exe, Unformat.com. Note 2: the paths assigned to virtual disks remain accessible in an ordinary way. Note 3: virtual disks can be accepted by WINDOWS OS, but can't be arranged, when WINDOWS OS is loaded yet. If necessary, virtual disk(s) should be arranged before loading WINDOWS, preferably by SUBST.EXE utility launched from a line of AUTOEXEC.BAT file.
6.24
At a certain stage of PC's booting process control is transferred to executable code, read from boot sector of the boot disk. In its turn, this executable code transfers control to a loader file, specified inside the same boot sector. In order to make a disk bootable with MS-DOS7, an appropriate executable code and the name IO.SYS of MS-DOS7 loader file must be written into disk's boot sector beforehand. Besides that, the IO.SYS loader itself together with command interpreter COMMAND.COM and MSDOS.SYS file (5.01-01)
188
A:
Note 1: SYS.COM utility can't be applied to network disks, to CD/DVD-ROMs and to virtual disks, created by RAM-disk drivers or by utilities ASSIGN.COM, JOIN.EXE and SUBST.EXE. Note 2: the operations, performed by SYS.COM utility, are necessary, but are not sufficient for making bootable a HDD's partition. This partition must be marked active in disk's MBR by FDISK.EXE (6.13) or by some other similar program. Executable code of boot sector will be read for execution just from that single active partition. Note 3: contrary to IO.SYS and_COMMAND.COM system files, the MSDOS.SYS file (5.01-01) is not copied. SYS.COM creates it empty anew. Loading from a new disk with default settings is considered more safe, because former settings may be unsuitable in other circumstances. Note 4: in the 8-th version of MS-DOS the SYS.COM utility has been changed: it always uses the default path to the source directory, and can't accept this path from command line.
6.25
6.25-01
File manager Volcov Commander (VC), written by Vsevolod V. Volcov (Kiev, Ukraine), resembles the known Norton Commander file manager, but VC is more compact and more flexible for adaptation to user's demands. Though VC is an unfinished project and can't be considered quite good, nevertheless it is the best for making reparatory work comfortable under MS-DOS7. Version 4.99.07 of VC, packed into archive vc499.zip, can be downloaded from internet site http://www.fdd5-25.net/shells.php . Just this version, dated 1998, is described below. The latest alfa-version 4.99.08 of VC Shell is dated 2000.
189
All VC's configuration files, except VC.INI, are ordinary textual files, which can be edited with EDIT.COM (6.09) or with any other editor program for non-formatted textual files. Examples of several VC's configuration files are shown in articles 6.25-02 6.25-04. All files of the VC release must be stored in one directory, and the path to this directory should be assigned as a value to environmental variable VC. Therefore file AUTOEXEC.BAT should include a line, for example: set VC=C:\DOS\VC4 VC Shell may be launched from command line as an ordinary program, but it is usually launched automatically from the last line in AUTOEXEC.BAT file, for example: C:\DOS\VC4\Vc.com /TSR /no2E /noswap /nozoom where options are: /TSR activate TSR supervisor, which monitors all loaded later TSR modules and unloads them at VC Shell shutdown. This may help to release memory and sometimes enables to avoid necessity of PC's reboot. On the contrary, when TSR supervisor is not desirable, the /noTSR parameter should be specified instead. /no2E exclude execution of programs via undocumented INT 2E interrupt (8.02-89), use legal INT 21\AX=4B00h (8.02-53) for this purpose. INT 2E is shorter and faster, but is not reentrant and gives no access to local variables of the caller. If nevertheless INT 2E is preferred, you may specify /2E parameter instead. /noswap prescription to avoid swapping of VC's data from memory to a file on a HDD. VC's data swapping is based on CHS access, which is not compatible with large modern HDDs. On the contrary, in obsolete PCs data swapping may be desirable, and then you may specify the opposite /swap option. /nozoom don't zoom message windows (zooming is adopted as the default).
190
Fig 5
191
192
Functions of some "hot keys" are duplicated. Ctrl-J and Ctrl-Enter act just as Ctrl-i: write name of the selected file into command line. Ctrl-Z acts as ALT F10 shows active panel tree. "0" in the numerical keypad acts just as INS: adds the selected item to a list of items, being prepared for performing a group operation. Items, included in the list, are highlighted with colour. Several keys in the numerical keypad are charged with auxiliary functions for preparing group operations: Ctrl + includes all files of the current directory in group list + includes in group list the files, selected with a mask Ctrl discards current selection of files excludes files selected with a mask (wildcards allowed) Ctrl * inverts files selection in current directory * acts as "+", if list of files in current directory is not formed, or as "", if group list of files exists yet When a list of highlighted items is prepared, then operations F5 (copy), F6 (move), F8 (delete) involve all the items in the list. List of highlighted items exists as a temporary file VCLIST.000 in the directory, defined by environmental variable %Temp%. Inside VC configuration files (*.MNU, *.EXT) the prepared list of highlighted items is accessible via special macro commands !~@ (for the active panel) and %~@ (for the passive panel). Thus the user is given an opportunity to define its own group operations (examples in article 6.25-02). If both VC's panels are switched OFF, VC shell provides more opportunities to navigate along the command line with LEFT ARROW and RIGHT ARROW keys, to insert characters into command line, and enables to access its history list with UP and DOWN arrow keys. When NUMLOCK key is switched OFF, arrow keys in numerical keypad act in the same way.
193
VC's wide capabilities of adaptation are achieved due to a variety of macrocomands, which are available inside its menu files (*.MNU) and inside its extension files (*.EXT). Certain groups of syntax symbols and digits, being encountered in VC's configuration files, are interpreted by VC Shell as a call for a macrocommand, and then are replaced by the result, returned by the same macrocommand. This result may be a name, a path, a line, etc. Here is a list of syntax symbol groups and corresponding macrocommands, provided by VC file manager version 4.99.07: ![prompt] invitation to input word(s) from keyboard. The other word(s), specified inside the square brackets, constitute a prompt, displayed before this invitation. Up to 10 independent similar invitations are allowed, implicitly enumerated from 0-th to 9-th. mark for a place to insert a copy of the word(s), which were typed in by the user in response to an invitation, enumerated by the specified number, from 0-th to 9-th. mark to insert letter-name of the disk, opened in active panel. mark to insert letter-name of the disk, opened in passive panel. mark to insert the path, opened in VC's active panel. Returned path ends with a backslash. mark to insert the path, opened in VC's passive panel. Returned path ends with a backslash. mark to insert short name (without suffix) of the file, selected with left mouse's button in VC's active panel. mark to insert short name (without suffix) of the file, selected with left mouse's button in VC's passive panel.
194
Combinations of symbols, including the tilde sign ( ~ ), invoke those macrocommands, which truncate "long" filenames to 8 characters, and "long" suffixes to 3 characters. In all such combinations of symbols the tilde sign ( ~ ) can be omitted, and then the same macrocommands, being executed in "DOS window" of WINDOWS-95\98\ME OS, return long filenames "as they are", without truncation. The user is given an opportunity to specify groups of symbols, invoking any macrocommand, in any command line inside menu file (*.MNU) and inside extension files (*.EXT). All lines in these files can be typed with editor program for non-formatted textual files (6.09). Each item of menu is represented in VC.MNU file by a header line and by at least one command line. VC file manager considers command lines are those non-empty lines, which begin with at least one space (ASCII code 20h). On the contrary, the header lines must not begin with a space. In the header lines the first group of characters, followed by a colon, is interpreted as specification of the "hot key" to invoke function of this menu item. The rest group of words to the right of colon is interpreted as a name, representing this item of menu, when menu is displayed on the screen. When the user has chosen a menu item for execution, the VC file manager replaces all groups of symbols, used to call any macrocommand, by those data returned by corresponding macrocommand. This is done at once in all command lines, following the header line of the chosen menu item. Then these command lines are sent one-by-one for execution to COMMAND.COM interpreter, which is called anew for each command line. Because of this reason jumps between command lines are not allowed, and the values of environmental variables can't be transferred from one command line to the following command lines within the same menu item. Of course, all conditions for proper execution of batch files should be met (see introduction article to chapter 9). An example of VC.MNU file is shown below. Mentioned there files Edit.com (6.09), Fc.exe (6.12), Scandisk.exe (6.21) are programs taken from Windows-95/98 release. Files Arc.bat and Turn_off.com are those described in articles 9.03-01 and 9.05-02 of this book. All these files must be present inside directories, specified in the value of the %PATH%
195
196