Memory Management Tom Kinnen, SWFPCUG Here is an example CONFIG.SYS and AUTOEXEC.BAT that were pulled from systems that are incorrectly configured, along with the corrected versions of these programs. First the incorrect versions: CONFIG.SYS 1. DEVICEHIGH=C:\DOS\SETVER.EXE 2. DEVICE=C:\WINDOWS\HIMEM.SYS 3. LASTDRIVE=E 4. DEVICE=AMOUSE.SYS 5. DOS=HIGH,UMB 6. FILES=99 7. BUFFERS=30 8. BREAK=ON 9. STACKS=9,256 10. C:\PCKWIK\PCKRAMD.SYS /D:512 /S:4096 11. SHELL=C:\COMMAND.COM /P /E:512 12. DEVICE=C:\WINDOWS\SMARTDRV.SYS AUTOEXEC.BAT 1. C:\WINDOWS\SMARTDRV.EXE 2. @ECHO OFF 3. PROMPT $p$g 4. PATH C:\WINDOWS;C:\DOS;C:\UTIL;C:\MOUSE; 5. PATH=%PATH%;C:\MENU 6. DATE 7. TIME 8. VER 9. \MOUSE\MOUSE 10. SET TEMP=C:\DOS 11. SET TASK=3 12. C:\PCKWIK\SUPERPCK /D- /TL 13. MENU 14. WIN 15. 16. C:\QUICKEN5\BILLMIND While not the worst AUTOEXEC.BAT and CONFIG.SYS files on record, there are several problems in each file. Starting right off with line 1 in the CONFIG.SYS, the DEVICEHIGH command cannot be used until after EMM386.EXE is loaded and upper memory is activated. SETVER cannot load high. Line 2 of the CONFIG.SYS is correct, however it should be the first line of the file, followed by the EMM386 line and then DOS=HIGH command, which is in line 5. Line 3 has the LASTDRIVE command, but the default in DOS is for LASTDRIVE to be E, which this line sets, so line 3 is not needed. Line 4 has a mouse driver for a mouse that's no longer on the system (determined by asking the user, the real mouse driver is being loaded in the AUTOEXEC.BAT), so it gets removed also. Line 5 is a common error, in that it will load DOS high, but the upper memory blocks cannot be activated until EMM386.EXE is loaded. While the position of this line isn't important as long as it is after HIMEM.SYS and EMM386.EXE, it should appear as line 3 to prevent anything from accidentally being inserted before it that would need to load into upper memory. Lines 6 and 7 are fine, as is 8, but you may want to put the BREAK command closer to the top of the CONFIG.SYS, if not at the top. The BREAK=ON command checks for the BREAK key being pressed more frequently, allowing you to break into the system during boot-up. Line 9 is required by Windows at the values given, and installed automatically when Windows is installed, but line 10 has a syntax error. PCKRAMD.SYS is Super PC-Kwik's RAM Drive and is a device, so the DEVICE command must appear before it. This line was generating an error in the CONFIG.SYS. Line 11 is fine, and sets the DOS environment to point to the copy of COMMAND.COM in the root directory, as well as expands the default environment space to 512 bytes, but line 12 is a major error for the CONFIG.SYS. The SYS version of SMARTDRV existed in Windows 3.0, but is not available in the Windows 3.1 directory. In the AUTOEXEC.BAT file, SMARTDRV is correctly loaded, but this system is using Super PC-Kwik's cache so we just need to delete the entire line. Also, appearing before the @ECHO OFF command makes it visible (the @ECHO OFF command just hides the commands as they're printed to the screen, as you'll learn in this month's batch file presentation). Lines 3 and 4 are correct, although the mouse directory need not be along the path since the driver is accessed once each time the system is turned on, and line 5 appends the path command with the directory MENU. You can edit the path to include the MENU directory, or in our case we're just going to take it out completely as you'll see. Lines 6 and 7 are throwbacks to the time when PC's had no internal clocks, and will only pause the system to let you check the time and date now. If you have a correctly working internal clock, these lines can be eliminated. Line 8 is similar, in that it only prints the version of DOS being used to the screen, which will then be scrolled out of view by the following commands. We'll simply remove it also. Line 9 loads the mouse driver, and is dangerous in that it assumes you're on the drive the mouse software was installed to and in the root directory. For safety's sake, we'll specify the full path to the command, and also use the LOADHIGH command, abbreviated as LH, to free some lower memory. Lines 10 and 11 are the SET commands for system variables, and should always come as close to the top of the AUTOEXEC.BAT as possible. There can be some problems with SET commands if they occur after any other drivers are loaded. They take space from the environment, which is why the environment space was increased in the CONFIG.SYS with the SHELL command. Putting the systems TEMP files in the DOS directory can be risky, and a separate TEMP directory should be created just for them. Line 12 loads the Super PC-Kwik cache software, and all we'll do is use the LOADHIGH command to move it out of the way. Line 13 however, brings the system to a halt by calling a menu program before finishing the AUTOEXEC.BAT file. By running the menu here, commands following this line won't be executed until the menu program finishes, if at all. Since we'll be running Windows and want the system to boot into Windows, we'll remove the line. Line 14 also has the same problem, running Windows before line 16 can execute. This is strictly the fault of the Quicken installation program, choosing to run Bill Minder always appends the BILLMIND command at the end of the AUTOEXEC.BAT, after any menu program, DOS Shell, or Windows would run. Line 15 is also added by Quicken, and as a blank can be simply deleted. The adjusted CONFIG.SYS and AUTOEXEC.BAT files follow, and we've used the DEVICEHIGH and LOADHIGH commands wherever possible to conserve memory. These commands depend on the CONFIG.SYS line with EMM386.EXE, and the RAM switch on that line, as well as the UMB switch on the DOS=HIGH line to activate the upper memory blocks as useable RAM for the programs to load into. In addition, since we won't need expanded memory on this system, we're using the NOEMS parameter and the M9 parameter to relocate the 64K page frame normally used for tracking EMS memory and gain that memory for our own use. While these configuration files aren't as complicated as the ones at the meeting, they do represent some typical problems seen in many AUTOEXEC.BAT and CONFIG.SYS files. For further help, you can check your DOS manuals or simply type HELP at the command line for some commands. There are also a number of good books on the market that thoroughly explore the DOS configuration and memory management. CONFIG.SYS 1. DEVICE=C:\WINDOWS\HIMEM.SYS 2. DEVICE=C:\WINDOWS\EMM386.EXE NOEMS RAM M9 3. DOS=HIGH,UMB 4. FILES=99 5. BUFFERS=30 6. STACKS=9,256 7. DEVICEHIGH=C:\PCKWIK\PCKRAMD.SYS /D:512 /S:4096 8. SHELL=C:\COMMAND.COM /P /E:512 AUTOEXEC.BAT 1. @ECHO OFF 2. SET TEMP=C:\DOS\TEMP 3. SET TASK=3 4. PROMPT $p$g 5. PATH C:\WINDOWS;C:\BAT;C:\DOS;C:\UTIL;.. 6. LH C:\MOUSE\MOUSE 7. LH C:\PCKWIK\SUPERPCK /D- /TL 8. C:\QUICKEN5\BILLMIND 9. WIN