home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / sysutl / tryst.arc / TRYST4.DOS < prev   
Text File  |  1988-03-31  |  17KB  |  322 lines

  1.                               TRYST DOS #4
  2.  
  3.      In the last article, the parts of DOS were covered.  This time,
  4. CONFIG.SYS and AUTOEXEC.BAT will be discussed.
  5.  
  6. CONFIG.SYS
  7.  
  8.      In TRYST3.DOS, the IBMBIO.COM portion of PC-DOS was explained.
  9. Since IBMBIO.COM is the part of DOS which controls the hardware, it
  10. makes sense that this is the portion of DOS which looks for, and
  11. executes CONFIG.SYS, since that file allows the user to customize
  12. their system and include any instructions for operating any hardware
  13. devices unknown to DOS.
  14.  
  15.      Essententially, CONFIG.SYS is a text file, ("text" meaning that
  16. the user can read the file).  In this file, the user enters commands
  17. which optimize their hardware or which contain instructions on how DOS
  18. is to handle unknown devices such as a mouse or a hard disk with a
  19. hard disk controller which DOS does not recognize.
  20.  
  21.      Users who have IBM PC-1 systems and have not upgraded the ROMs
  22. will recognize this hard disk problem.  The ROMs in the original PCs
  23. do not know about hard disks and they do not search through the PC for
  24. other ROMs.  In newer machines, the PC's ROM searches certain
  25. locations for other ROMs, and these "foreign" ROMs contain the
  26. instructions used by the system to control the new hardware.  On a
  27. hard disk controller board, there is a ROM which tells the system how
  28. to access the hard disk.  Since the original PC's ROM does not search
  29. for other ROMs, it has no way of knowing that a hard disk, or any
  30. other similar hardware, is installed.  Therefore, on a PC-1 system,
  31. you must either replace the ROM so that it will look for other ROMs,
  32. or you must boot up on a floppy with a CONFIG.SYS file containing the
  33. instructions for operating any hard disk you may have installed.
  34.  
  35.      So, the CONFIG.SYS file is used by DOS to operate any hardware
  36. which DOS' IBMBIO.COM does not have explicit instructions for.  During
  37. the booting process, IBM's ROM BIOS makes a trip around the system and
  38. looks for other ROMs.  When it finds foreign ROMs, it allows them to
  39. take control to check out the new devices and to incorporate their
  40. controlling instructions into the working BIOS.  When all the ROMs are
  41. done, IBM's IBMBIO.COM is executed to make any last minute changes to
  42. the ROM BIOS, and to add any new code.  On a hard disk system, the
  43. hard disk controller's ROM contains access instructions, and since the
  44. hard disk is probably where your operating system software and your
  45. CONFIG.SYS file are located, it makes sense that the IBM ROM looks for
  46. and executes this ROM before attempting to continue the booting
  47. process.  If the computer does not have the instructions for spinning
  48. the hard disk and moving the read/write heads, how is it going to read
  49. IBMBIO.COM, IBMDOS.COM and your CONFIG.SYS files?
  50.  
  51.      At any rate, when all the ROMs have been located and executed,
  52. portions of their code remain in memory and become "part" of the BIOS.
  53. Then IBMBIO.COM is read off the hard disk and in its turn, it looks
  54. for the CONFIG.SYS file.  Since THE IBMBIO.COM file is not very big
  55. and not very bright, CONFIG.SYS must be in the root so that it can be
  56. found and executed.  After all, even if you set up your AUTOEXEC.BAT
  57. file to include the "PATH" command to specify the directories on your
  58. hard disk where you keep your programs, the AUTOEXEC.BAT file has
  59. not been executed at this point, so the only location DOS will search
  60. is the root.
  61.  
  62.      After IBMBIO.COM locates the CONFIG.SYS file, it loads any device
  63. drivers listed in this file and they become further extensions to the
  64. BIOS.  A device driver is simply instructions for handling other
  65. devices and the data going to or from the device.  Device drivers are
  66. files which have a .SYS, (or .BIN), extension on them.  Some samples
  67. are:  MOUSE.SYS to operate a mouse, VDISK.SYS to take a portion of RAM
  68. and set it up to run like a disk, and ANSI.SYS which allows the user
  69. to control the display of information on the monitor.  All these
  70. files must conform to standards set out by IBM on how a device driver
  71. should be written, and since they are in machine language, the user
  72. can not display their contents.
  73.  
  74.      If you are installing a mouse, for example, there is probably a
  75. diskette with a MOUSE.SYS or some other .SYS file on it.  To set it up
  76. you would use an editor which can produce a plain ASCII file, such as
  77. WORDSTAR in the non-document mode, IBM's EDLIN editor, or Microsoft
  78. WORD.  You just need one line:  DEVICE=MOUSE.SYS.  Save the file as
  79. CONFIG.SYS and then reboot.  You must reboot to have this go "into
  80. effect" since only on booting are device drivers installed with the
  81. BIOS.
  82.  
  83.      You can have as many device drivers in your CONFIG.SYS file as
  84. you need, using one "DEVICE=" line for each one.  A sample CONFIG.SYS
  85. file could be:
  86.  
  87. DEVICE=C:\MOUSE\MSMOUSE.SYS
  88. DEVICE=C:\DOS\VDISK.SYS 128 512 /E
  89. DEVICE=C:\DOS\ANSI.SYS
  90.  
  91.      As you can see, if the .SYS file is in a subdirectory, such as
  92. MSMOUSE.SYS being in the \MOUSE directory, you MUST specify the
  93. directory as well.  The AUTOEXEC.BAT file has not been executed yet
  94. so there are no search paths specified.
  95.  
  96.      The VDISK.SYS and ANSI.SYS files come on the DOS diskette.
  97. VDISK.SYS is a nice utility which lets you set aside part of your RAM
  98. to emulate a disk.  For example, if you have an AT, you could set
  99. aside the extended memory above 640K with the /E switch and make a
  100. virtual drive of 512Kb (assuming you have that much memory above
  101. 640Kb).  Then, you could copy files to the RAM drive by simply copying
  102. to the D:  drive (assuming you have a C: hard disk already).
  103. VDISK.SYS uses the next available drive designation, so if you have A:
  104. & B:  floppies and a C:  hard disk, the virtual drive will be D:.  On
  105. a system with just A:  and B:  floppies, the virtual drive with be C:.
  106.  
  107.      One thing you want to remember when you set up a virtual drive,
  108. it is wiped out everytime you turn the computer off, so you must
  109. remember to copy files back into your hard disk or floppy before
  110. turning it off.  If you think you are likely to forget this, or are
  111. afraid of power glitches, you could just copy your application program
  112. files to the virtual drive, then it doesn't matter.  Keep your data on
  113. the hard disk or floppy.  For example, if running DBASE, you could put
  114. all the DBASE files (DBASE.EXE, DBASE.OVL, ASSIST.EXE, etc.) on the D:
  115. virtual drive and just leave your database on the C:  drive.  You
  116. would then access your data by including the drive designation with
  117. the filename, such as C:MYDATA and C:MYINDEX.  Copying the DBASE files
  118. into the D:  drive could be accomplished when you boot up by including
  119. the "COPY DBASE.* D:" command in your AUTOEXEC.BAT.  You would not
  120. have to copy the things from your virtual drive back to your hard disk
  121. when done, since you still have the copy of the program on the hard
  122. disk.
  123.  
  124.      ANSI.SYS is often required by software which wishes to position
  125. the cursor on the screen by using escape sequences.  It is easier to
  126. do this than to use the video software interrupt provided by the BIOS,
  127. since many other kinds of computers use the same or similiar escape
  128. sequences to control the location of the cursor.  Some games require
  129. ANSI.SYS, and some software which allows the user to set up the screen
  130. with different colors also use ANSI.SYS.
  131.  
  132.      In addition to adding new devices to your PC, CONFIG.SYS files
  133. also have commands to "tweak" the best performance out of devices DOS
  134. already knows about.  Some of the commands available include:
  135. BUFFERS, FCBS, FILES, and LASTDRIVE.  A few software packages actually
  136. insist that you use some of these commands in order to run their
  137. application.  An example of this is DBASE, where you must increase the
  138. default number of files which can be opened at one time or you will
  139. not be able to use several indexes with your data base file.
  140.  
  141.      BUFFERS:  The BUFFERS command allows you to increase the number
  142. of disk buffers allocated in memory when DOS is started.  This is a
  143. tricky operation, too few buffers means hard disk access will be slow,
  144. and too many will chew up your memory.  A buffer is an area used by
  145. DOS to store data being read from a disk.  DOS tries to anticipate
  146. what the user is going to be doing and be ready for it by reading
  147. ahead.  When you ask for a record in a data base, DOS will read that
  148. record and then the next couple of records, hoping that if you
  149. continue working, you will request the record following the one you
  150. are working on and it will not have to access the hard disk.
  151.  
  152.      But, each buffer increased the size of DOS by 528 bytes, so if
  153. you go crazy and specify 99 buffers, you could find that you don't
  154. have enough memory left to run your programs!  For most people, if you
  155. are running a database, you will probably find that something between
  156. 10 and 20 will suit you.  To specify buffer size, you would enter the
  157. following line in your CONFIG.SYS file.
  158.  
  159. BUFFERS=15
  160.  
  161.      On systems with hard disk, you will need a minimum of 3 buffers.
  162. The default value for a PC is 2 and for an AT it is 3 buffers.
  163.  
  164.      FILES:  FILES allows you to specify how many file handles can be
  165. opened concurrently.  The default value is 8.  This is the "newer"
  166. method to opening files and you can see a "progression" in the
  167. applications software.  Older DBASE programs ask the user to specify
  168. FCBS=16, while newer versions which use file handles instead of FCBs
  169. will request the user to have FILES=20 in the CONFIG.SYS FILE.  The
  170. difference is important mainly to the programmer - with the older
  171. system, the programmer was required to use FCBs to open & close files,
  172. with file handles, the programmer simply asks DOS to open a file
  173. and DOS creates the control block in its own memory on behalf of the
  174. application and give the application a number, or file handle, with
  175. which to refer to the file.  DOS then takes care of all the messy
  176. details.
  177.  
  178. There is a limit to the number of handles open for each process, or
  179. application.  That limit is 20.  That means that only 20 files,
  180. including the application programs, its support files, and the user's
  181. files, are able to be opened at one time.  DOS also uses 3 file
  182. handles out of that 20, so the user can't expect to open dozens of
  183. index files on a data base, for example.  From what I have been able
  184. determine, if you are running other programs in the background, such
  185. as the print spooler provided by DOS, (PRINT), those also take up file
  186. handles, but they are considered to be independent processes, which
  187. means they each have their "own set" of 20 handles.  IBM's network
  188. also takes file handles, so if you are running the network, you will
  189. want to have 20 handles available for the network + 20 for your
  190. applications, so you should have a minimum of 40 handles.  But again,
  191. increasing the number of handles uses up memory, so you need to
  192. balance the number of handles to allow for the system against the
  193. amount of RAM you need.
  194.  
  195. SHELL:  This command can be used to tell DOS that you want to run your
  196. own command processor, rather than using DOS' COMMAND.COM, or you can
  197. use it to specify the directory where COMMAND.COM is stored on your
  198. hard disk.  If you have put this file in a directory called DOS, you
  199. could use the command "SHELL=C:\DOS\COMMAND.COM" to tell the system
  200. where to look for the command processor, COMMAND.COM.
  201.  
  202. SHELL also has a parameter, "/E:nnnn", which allows the user to
  203. indicate how many bytes they want their environment size to be.  It
  204. can be from 160 to 32768 bytes.  Specifying "SHELL=C:\DOS\COMMAND.COM
  205. /E:320" would give you an environment of 320 bytes.
  206.  
  207. The environment is an area used by DOS to pass names and parameters to
  208. applications.  If you set a path to be searched when executing a
  209. program, or you customize the prompt, or you use set to keep a certain
  210. string in memory, all these things are kept by DOS in the environment.
  211.  Some applications ask you to use the SET command to set up the
  212.  directory name where you keep your data.  Then, when you use the
  213.  program, it can look in the environment, pick up the string and know
  214.  where on your hard disk to look for data files.
  215.  
  216. DOS makes a copy of the environment for every program you run, so you
  217. do not want to make this area too large if you are running memory
  218. resident programs.  Each program gets it's own copy and if the
  219. environment is large, they will take up more RAM.  One tip, if you are
  220. running memory resident software, such as Sidekick, or Superkey, do
  221. not set a long path, or put a long string in the environment before
  222. executing the program.  In your AUTOEXEC.BAT file, execute Sidekick
  223. and then do your path commands and prompt commands.  That way,
  224. Sidekick's copy of the environment will be smaller and you will be
  225. using up fewer bytes of RAM.
  226.  
  227. If you are setting up long paths and get the error message that you
  228. are out of environment space, you can use the "SHELL=C:\COMMAND.COM
  229. /E:NNN" to get more space.  This command is valid for DOS 3.1 and 3.2.
  230.  
  231. AUTOEXEC.BAT
  232.  
  233. The AUTOEXEC.BAT file is executed after COMMAND.COM has been loaded.
  234. COMMAND.COM contains the batch file processor, as well as the internal
  235. DOS commands, so it is necessary for COMMAND.COM to be present and
  236. running before the AUTOEXEC.BAT file is executed.  If the AUTOEXEC.BAT
  237. file is not located in the root (\) directory, it will not be run.
  238.  
  239. The AUTOEXEC.BAT file contains normal DOS commands, in straight ASCII
  240. text, which the user would like executed when the system is booted.
  241. Generally, it will contain a "PATH=" command to set up a search path
  242. to the user's directories, memory resident programs, and maybe a
  243. "PROMPT" command to set up a custom prompt.  An example of an
  244. AUTOEXEC.BAT file is:
  245.  
  246. cd \sk
  247. sk
  248. cd \
  249. cd \utils
  250. scrnblnk
  251. cd \
  252. path c:\batch;c:\dos;c:\nu;c:\utils;c:\pe;c:\sk;c:\
  253. prompt $p$g
  254. rxbak
  255.  
  256. You will see that there are two memory resident utilities being
  257. executed, SK (SIDEKIDK), and SCRNBLNK (Screen Blanker).  They are the
  258. first lines in the AUTOEXEC.BAT file, along with the "CD" commands to
  259. change into their directories.  Since every memory resident utility
  260. keeps its own copy of the environment, they are placed before the long
  261. "PATH" command, and because of this, it is necessary to do the "CD"
  262. commands to find the programs.
  263.  
  264. The "PATH" command tells DOS where to look for programs which are not
  265. in the current directory.  When setting up a search path, try to place
  266. the most frequently used directory first.  For example, if you do a
  267. lot of disk formatting, and have DOS commands in a directory called
  268. DOS, then put "\DOS" first.  Then if you are in another subdirectory
  269. and you execute the "FORMAT" command, it will find it faster than if
  270. it was at the end of the list.  When using a hard disk, it is often
  271. helpful to set up batch files to change subdirectories and start
  272. programs for you, for example if you have Lotus' 1-2-3 in a
  273. subdirectory called 123, you could set up a batch file called 123.BAT
  274. containing:
  275.  
  276. cd \123
  277. 123
  278. cd \
  279.  
  280. You could keep all such batch files in a subdirectory called \BATCH
  281. and by putting this as the first or second subdirectory on the search
  282. path, you would have quick access to your programs without having to
  283. remember to do CDs all the time.
  284.  
  285. The PROMPT command is probably the most commonly used command after
  286. PATH.  It allows you to change the prompt from a plain "C>" to
  287. something you prefer.  You can have it display text, or even more
  288. useful, you can have it display the subdirectory you are in.  For
  289. example, the command:
  290.  
  291. PROMPT $P$G
  292.  
  293. in the AUTOEXEC.BAT file would display the following when in the root
  294. (\) directory:    C:\>
  295. or if you are in the \123 directory:  C:\123>
  296.  
  297. The $P is replaced with the current path, and the $G is replaced with
  298. the greather than (>) symbol.  You can also have it display the time,
  299. or even change the screen color if you have the "DEVICE=ANSI.SYS" line
  300. in your CONFIG.SYS file.
  301.  
  302. One last thing, if you wish to execute another batch file and come
  303. back to the AUTOEXEC.BAT file to continue to the next command, you can
  304. add the following line to your AUTOEXEC.BAT file (this also works with
  305. any other batch files, allowing you to execute a secondary batch file
  306. and come back to the first one):
  307.  
  308. COMMAND /C SECOND
  309.  
  310. This would execute a second command processor (COMMAND.COM) which
  311. would run the SECOND.BAT file.  In SECOND.BAT you should have the
  312. command "EXIT" to then get out of this secondary COMMAND.COM and
  313. continue processing the first AUTOEXEC.BAT file command (or the
  314. calling batch file).
  315.  
  316. That's all the tips for this article.  Hope you get something out of
  317. this that can help you tame DOS.
  318.  
  319. ajg
  320.  of 320 bytes.
  321.  
  322. The environment is an area used by DOS to pass names an