silvio neris (the master of disaster)
MS-DOSThe DOS 1MB limit
The operating system DOS was designed for the original IBM PC which had an Intel 8088 processor. This processor had a 20-bit address bus.
The control bus carries signals which causes some action to occur or alert the motherboard. Since each address is a binary string of 0's and 1's, the number of possible locations addressable by the CPU must be related to the size of the binary string. If you had a 3-bit address by that; in a bus with 3 lines each of which could carry a 0 or a 1, you could only send across 1 out of 8 addresses (2 to the 3). With the 20-bit address bus, the total number of locations addressable by the 8088 was 2 to the 20. Each location holds 1 byte of data. The maximun amount of memory addressable by an 8088 was therefore 2 to the 20 bytes. This explains DOS' inability to see more than one MB of memory.
We know why DOS was limited to a maximun of 1 MB of RAM. But things get even worse. Room had to be set aside for certain system requirements like video memory, Basic Input/Output Services (Bios) routines in ROM, device buffer areas, etc. The PC makers decided to reserve the top 384 kilobytes of RAM for these systems requirements. This forced the DOS designers to make DOS capable of running itself and user programs only in the first 640KB of RAM. Hence the 640KB-Barrier of DOS.Now RAM is divided into 2 parts, Upper Memory (where the drivers, cards memory, etc. are usually loaded ) and convencional Memory (where the programs and some times DOS are usually loaded).
There is an analogous memory management situation similar to fixed partitions (variable size) utilization. It occurs with DOS and its inability to use unused partitions of the Upper Memory Area. With the help of memory managers, DOS is capable of placing "small" programs into these unused blocks of memory.
To put programs into Upper memory Blocks Manually would require you to:
(1)Get a list of available Upper Memory Blocks and their sizes.
(2)Get a list of the programs to load on their sizes. Upon loading.
(3)Arrange the lists so that the sizes for each list compare reasonably.
There is a DOS program called memmaker (warning! do not use memmaker if you're using windows 95) that can do all of this for you as well as modify the appropiate startup files so that the configuration is reproduced the next time. To see memory cofiguration under DOS, get to the DOS prompt and type: "mem /c | more".
Batch Files
A batch file in DOS is a test file containing DOS commands that executed in sequense. The batch files have names ending in .bat extentions. A special batch file is the autoexec.bat. It contains DOS commands that help set up the environment for the user and application programs. It is automatically executed at boot up. One example of one of the use of the autoexe.bat file is to load Windows 3.x on startup. Windows 3.x runs on top of DOS therefore DOS has to be loaded prior to running Windows 3.x. Windows is not an operating system. It's just a DOS shell.
Here is an example of an autoexec.bat file:
@ECHO OFF |
rem CD \PCSPGMS | rem DACSRES /Q /AUTOLOGON |
rem PCSLGOFF |
PROMPT $p$g |
rem PATH C:\DOS;C:\PCSPGMS |
PATH C:\DOS |
SET TEMP=C:\DOS |
1h UBNICPS2 0X69 |
DOSKEY |
WIN |
The DOS Loading Sequence
(1)Computer is switched on and all circits are initialized.
(2)An instruction in ROM belonging to a program called the Post (power on self-test) is executed and the CPU proceeds to test all the parts of the computer (RAM, Ports, etc). If any serious errors occur, the computer halts.
(3)If all is well, a program called the Bootstrap Loader executes next and looks on the first sector of the A: drive for the Bootstrap proram. If there is no A: disk, then the loader looks at the hard disk. The sector containing the Bootstrap progam is is called the boot record.
(4)Once the Bootstrap program is loaded, it looks on the same disk for the following system files:
[a] IO.sys (a hidden file located in the rest of the disk).
[b] MSDOS.sys (another hidden file in the root).
(5)IO.sys executes and looks for a configuration file called confy.sys again in the root. If confy.sys is present IO.sys loads the device drivers specified by confy.sys.
(6)After setting up the system with confy.sys, MSDOS.sys is executed after which Commad.com is loaded. Command.com is the DOS command interpreter resposible for producing the prompt and executing commands.
(7)Command.com executes a batch file called autoexec.bat which contains DOS commands to set up users enviromemt. After autoexec.bat is executed you see a prompt.
(8)If any of the system files are missing or damaged, the boot sequence halts with an error message.
Segment:Offset
Even though DOS cannot multitask and does not need to partition memory for multiple programs to run simultaneusly, DOS was forced to treat the 1MB memory in 64kb partitions for the following reasons.
DOS was designed for the Intel 8088. This CPU had a 20-bit address bus allowing it to get to a maximun of 2 to the 20 bytes (which is equal to 1MB). Unfortunately the size of the address register in the 8088 (and 8086) was 16-bits. To be able to generate 20-bit of address from 16-bit register the designers decided to use pairs of registers to form an address. There were segment registers and these were combined with offset registers.
The segment registers hold the starting address of a particular 64kb region called a segment. Some other registers could contain another value called the offset which, when added to the address in a segment register in a particular way formed the actual address within that segment. The strange addition is needed to generate the 20-bit address from two 16-bit addresses. The way is done is:
(1)Take the segment address in Hex and stick a 0(Hex) onto the right side of the address. Example, ABC2 is the code segment register. So before adding you write ABC20.
(2)Add the new 5 digit Hex address you just obtained to the offset to form the 5 digit true address.
If you have any comments, questions or suggestions simply e-mail Silvio Neris(the master of disaster)