The old DOS days. Still there a few things to learn

What do you think about DOS?

  • Still Useful

    Votes: 0 0.0%
  • Why need?

    Votes: 0 0.0%

  • Total voters
    41
Status
Not open for further replies.

akshar

Broken In
DOS

DOS; Disk Operating System was a revolution in the history of Operating System. However today we have so many GUI operating systems because of which we call DOS a useless operating system. DOS was worlds most popular operating system even today it is. At the same time I would say it is the most easiest to learn. I am saying this in a developer point of view. DOS is single user, non-multitasking operating system. It differs from today's multitasking operating systems in many different ways. Even today Windows 98 uses DOS to boot.

There are some characteristics of DOS which are necessary to know for a DOS user.

DOS can use only 1 MB RAM
If you are using DOS on machine with 128 MB RAM then you will be surprised to hear that your OS can use only 1 MB RAM and remaining 127 MB RAM is left unused. However there are some driver programs known as Extended memory and Expanded memory which helps DOS to use remaining memory too. It is beyond my capacity to tell you how this is made possible ;)

DOS can handle only one task at a time
You can not run two programs simultaneously on a DOS machine. This is because DOS is a serial processing operating system. It handles program one by one. There are concepts such as reentrancy which you should study. You can refer any book on Operating Systems for this. DOS loads one program in memory executes it then loads second one and runs it. Previous program is removed from memory. There are some programs which are not removed from memory but remain there and evokes themselves during a particular event (this word is not so perfect). These programs are called TSRs.

Little about TSRs
Very few people know what is a TSR. Since you are not using DOS today (and you should not unless you believe in some culture protector philosophy) you may not know how TSRs so important for DOS. All viruses are TSRs. These programs keep themselves in memory and steal some bios routines. That is bios is given a particular function to execute when a particular event occurs. Example: Say you press a key on keyboard, bios knows that when such thing happens that particular character must be shown on monitor screen. Not TSRs deceive bios and forces bios to execute the TSR defined function instead of the pre-existing function. Also these TSRs take care that the pre-existing function is also executed and the user never knows that something happened in between. These events vary from pressing a key on keyboard to beeping of PC speaker. You may refer Y. P. Kanitkers Writing TSRs in C for more information. That is the only book I have seen explaining TSRs in so detail. There exists one TSR with allversions of DOS called DOSKEY try it on your system.

DOS commands
DOS has a command interface. That is we have to manually give a command for any operation we want to do. To copy a file we have to give a command. To delete any file we should type a command. These commands are interpreted by a command interpreter command.com. Three most important files in DOS are command.com msdos.sys and io.sys. msdos.sys is called DOS kernel. Kernel is that part of operating system that communicates with hardware maintains file system etc.
As I have stated above command.com executes all the commands that we type. command.com has two parts resident portion and transient portion, resident portion remains in memory all the time but transient portion does not.

autoexec.bat
More about batch files (.bat) latter but I will tell you what is autoexec.bat does. Whenever you start your opearting system may be DOS or windows this file gets executed. This file contains few DOS commands which are executed one by one. You open this file in any text editor and see it's contents also you may edit that file.

Batch files
Batch files are executable files having extension .bat. They contain simple DOS commands that are executed as we run that file these commands are executed. You too can write a batch file, just add few commands to text file with extension .bat each on separate line and execute the batch file. C:>batchfilename

Device Drivers
Each hardware item is represented using a file in DOS. (Do not compare this characteristic with unix , frog is big is a true statement but it does not mean that it is as big as elephant). These files are called device drivers. Some popular drivers are
con -------> Keyboard and Monitor (Basic Input Output)
nul -------->means nothing (I am not lying it means nothing)
prin --------> printer


Let us start using dos the hacker way. We will start with doskey. It is a TSR program and very usefull too. give a command doskey at the dos prompt and you will get an message saying that dos key is installed. But you don't know what it is. So how do you find out? Read this


--------------------------------------------------------------------------------

TIP: To get help info on any dos command give a command C:>mycommand/? this will give you info about mycommand.


--------------------------------------------------------------------------------

Consider this command c:>doskey easy=cd windows$Tcd cd temp$Tdel *.* as you can see there are three commands separated by $T next time you give only one command easy to execute all these three commands. Once you exit from DOS this macro gets outdated. To overcome this difficulty add it too autoexec.bat. Just add one line
c:>doskey easy=cd windows$Tcd cd temp$Tdel *.* on a new line and you are done. doskey is also capable of showing you the history of your commands.

Now we turn to redirection. There are 4 types of redirection operators. >, >> ,<, |. Not heard about this then please don't go after Linux or UNIX you don't have that right. These 4 are called redirection operators. The redirect you output or input. consider the command
c:>copy file.txt con
You will find that this file works just fine like type command. What it does is copies the contents of file.txt to basic output driver con. As we have seen above con represents monitor screen or keyboard. In this case it is the screen.
What if you give a command c:>del *.* it gives you an output x files deleted. You don't want this message to appear because you have written a nasty batch file that deletes some important file. You don't want the person to know what really happens after you execute that command. just make that command appear c:>del *.* >> nul
We know nul means nothing hence output goes to nothing hence output is not displayed at all. (type @echo off on the first line of batch file is you want to hide from user what commands are executed by that batch file).
Then what is the difference between >> and >. consider the command c:>type file1.txt > file2.txt
this command copies the content of file1 to file2 and file2 is overwritten if already present. That is original contents of the file2 are lost. But if you use > incase of >> contents of file1 are added to the end of file2 if present else a new file is created.
What is | ? It is called pipe. Using this command is referred as piping. It is not so important in DOS but extremely useful on *nix (Unix or Linux) machines. C:> command1 | command2 means that output of command1 serves as input for command2.
 

tuxfan

Technomancer
First things first, I loved DOS and I still like it. :) I was so comfortable!! :D

IMHO, Windows has a few new names for old DOS things. For example, a shortcut is nothing more than a very basic .bat file!! .bat file can act as a shortcut and can achieve a lot more! I had made a .bat file that even accepted command line arguments and had decision making statements in it :)

As for GUI, I had made a GUI based software in C under DOS and that used a mouse. Even for text based softwares, I had used a mouse as old as 1994.

I had made a program in C that looked like being event drive, actually it wasn't. But I could create that effect using sequential programming.

As for multitasking, start a few processes under Windows and see how slow the machine will become. It could almost be dead. So where's the multitasking gone? It looks that each process is given some time to perform its task. Its more like time sharing than multitasking.

And when we talk about TSR, don't they make you think that multiple softwares are running at the same time? You can have many TSR running. I had made a TSR clock (sounds childish now :)) So other softwares were running and my clock would keep running on right hand top corner.
 

cyberia.in

In the zone
well, the point is that DOS is still an essential tool for many. it's the last hope when that (what do you call that thing someone called gates owns) crashes, which it frequebtly does
 
Status
Not open for further replies.
Top Bottom