-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- PCM Online December 1994 FEATURES Contents: [] XLSCOM: Choose your own command-line color scheme -- without resorting to ANSI.SYS. [] Whammy: A graphical dice game that requires luck -- but also skill and self-control. [] Alternate Operating Systems: Novell DOS 7.0 -- Exploring operating-system alternatives to MS-DOS. Entire contents copyright 1994 by Falsoft, Inc. PCM -- The Premier Personal Computer Magazine -- is intended for the private use and pleasure of its subscribers, and reproduction by any means is prohibited. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- XLSCOM ~~~~~~ < Look for it in the file PCMO9412.ZIP. Ask your SysOp for the location of this file.> What you need to run the program: MS-DOS, BASIC or QBASIC "Choose your own command-line color scheme -- without resorting to ANSI.SYS" XLSCOM by Oscar C. Ulman Working at the DOS command line is colorless, since the default DOS colors are gray text with a black background and border. Written in BASIC, XLSCOM is a small, specialized compiler that allows you to create .COM files you can use in place of the DOS CLS command. These files set the screen and border colors, clear the screen, and place the cursor in the "home" position. XLSCOM.BAS can be entered into the GW-BASIC interpreter that came with your system or the QBASIC interpreter with DOS 5.0 and up. XLSCOM can also be compiled, as written, to an .EXE file using the QuickBASIC, Turbo BASIC or Power BASIC compilers. If you are new to BASIC, make frequent saves as you enter the program. [PCM Online readers: the .BAS file is made available to you, so there is no need to type in the listing.] Refer to your computer manuals if you have questions. Print your listing if possible, and check for errors before you try to run it. When running the program, the user selects from a color-coded number display for text, background and border colors. The selections and color numbers are the same as in BASIC's COLOR command. The screen is then cleared to the colors selected. If the user does not like the color combination, he can loop back for a new selection. When the selection meets with approval, the program asks for a filename (the .COM suffix is automatically appended by the program). A .COM program is then written to disk with the filename given. The user can now create another color/clear screen program or exit to BASIC (in the interpreter only) or DOS. The programs XLSCOM creates are very small. Those constructed in the BASIC interpreter are 58 bytes in size, while the ones created by the .EXE from a compiler are 57 bytes. The compilers do not write an EOF marker to the .COM file. The .COM program thus created can be run by entering the filename at the DOS command line. The screen clears to the designated colors and the cursor returns to the home position. As an example, if you choose 15,1,1 for bright white text on a blue background and border and name your program BLS, all you need do is type BLS at the command line and press ENTER. Issuing the CLS command at any time restores the default gray on black. To restore your colorful screen, just enter BLS again. Note that the .COM files created do not function properly if ANSI.SYS is loaded. Make sure your CONFIG.SYS file does NOT contain the line DEVICE=ANSI.SYS. For years I have been using ANSI.SYS to set the screen colors. This is slow when run from a batch file, and it adds another layer of interpretation to every DOS command. Some TSR programs that do the same thing are available, but they use precious memory and/or produce (sometimes strange) side effects in other programs. Every time I wanted another color combination, this assembly program had to be rewritten, the color attribute recalculated, and the program assembled and linked. There had to be a better way, and XLSCOM.BAS was the result. I found the bytes that compose the instructions of BLS.COM by disassembling it using DEBUG with the /D switch. This displays the file as lines of Hex bytes. Converted into decimal, these form the DATA statements for XLSCOM. The places in the code where the text-color attribute and border color were placed were left open, to be filled in as needed. XLSCOM began as a simple assembly program (Listing 2). It was assembled and linked, producing a .COM file that works like the BLS.COM example above. The procedure section has routines to position and home the cursor, clear the screen by scrolling, and set the border color. All these routines use functions of the BIOS interrupt (INT 10 Hex). The comments in the assembly listing should answer most of your questions. The important bit is in the main program, where the first instruction moves the color information called the attribute into Register BH. Notice that the border color is set to 1 (blue). The BORDER procedure uses the BIOS Set Palette function to set the color palette in graphics mode. In text mode it sets the color of the overscan area of the screen, which most of us refer to as the border. The color-attribute byte is the information placed in Register BH before the call to scroll the screen. This information consists of the foreground color (0 through 15) and the background color (0 through 7). Eight bits of storage, numbered 7 to zero from left to right, are available in BH. If all the bits are turned on (11111111), the sum of the bits equals 255 (128+64+32+16+8+4+2+1). Bit 7 is reserved for the blink attribute so only bits 6 through zero can be used to store the colors. If Bit 7 is set to 1 (on), the foreground color blinks. The background color must fit into bits 6 to 4. That is why Line 3130 of XLSCOM.BAS multiplies the background color by 16. This effectively performs a four-bit shift of the background color, moving it up to bits 6 to 4. Three bits limit the value held to 4+2+1, so the background is limited to the values zero to 7 before the shift. The foreground color occupies Bits 0 to 3, so four bits make color values zero to 15 available. When the attribute byte is complete, the call to scroll the screen is made. You can add 128 to the foreground color when you choose colors while running XLSCOM. Making the foreground color 143 instead of 15, for instance, toggles on the blink bit for blinking white text. This isn't too practical for a CLS replacement, but you might try it to see how it works. XLSCOM.BAS consists of less than 100 program lines. Line 30 sets up the screen and sets all variables to integers to make the program run faster. Line 40 calls a subroutine at Line 1000 that gives the program name and some simple instructions for its use. Lines 70 through 200 contain the main program loop. The code to query the user and get inputs for the colors to be set are located here. Each choice has a call to a color-display subroutine at Line 2000. This is called with the number of colors to be displayed set before the call. The number of colors available for that portion of the screen is then displayed. Line 120 sets the screen to the colors chosen. Line 130 asks if the colors are acceptable. If so, the .COM file-building subroutine at Line 3000 is called; if not, the program loops back to Line 20 to start again. After a .COM file has been created, lines 150 to 190 allow the user to create another .COM file or exit the program. The subroutine located at lines 3000 through 3270 builds the .COM file. It asks for the root name and appends .COM to it. The file is then opened for output. A subroutine at lines 3500 to 3600 is then called to write the instruction bytes to the new file. This read and write routine is called with the number of bytes to be read from each line in the DATA statements in lines 4010 to 4060. The routine reads the bytes, writes them to the output file, and adds their decimal value. The final value on the line is a negative number. When this is added to the sum of the other values on the line, the result should equal zero. If it does not, you've made a mistake in entering some value on the line. It is also possible to have entered the correct values but in the wrong order. Checking a printed listing before you run the program for the first time can save you some grief. Each line is checked to make sure its line sum is zero. If not, the line where the error has occurred is listed and the program ends. The value for the color-attribute byte is calculated from your choices and written to the output file by the code at Line 3130. The border color value is inserted at Line 3170. When the output file is completed, it is closed at Line 3210 and a message is printed for your information. Line 3240 calls a subroutine at Line 1900 that functions as a simple wait for a keypress before proceeding. The DATA in lines 4010 to 4060 is restored at Line 3250. This makes it available for use if you want to create more than one colorful CLS program in one session. Line 5010 is a single line of instructions to execute a DOS shell. To execute it from BASIC, type RUN 5000. This shells you to DOS. Entering EXIT at the DOS command line returns you to the BASIC interpreter. Do not run the first .COM file you create with XLSCOM before checking its size. After saving your program, use the routine at Line 5010 to shell to DOS. Enter DIR *.COM and check the size of the .COM file you created. If it's greater than 58 bytes, you've probably forgotten one or more semicolons in the subroutine that builds the .COM file. The PRINT #1 statements in lines 3070 to 3170 must be terminated with semicolons, which cause the bytes from the DATA statements to be written to the file in sequence. If the semicolons are missing, the PRINT #1 statements will write a new line to the file after each byte. The resulting .COM file will be larger than the required size and, if run, will probably lock up your computer. When you get a .COM file that is the right size, run it. If it executes correctly, you can safely create as many .COM files as you want. -=*=- A paper-company employee, Oscar Ulman programs in many languages but still enjoys "hacking code" in GW-BASIC on his Tandy 1000 SX. He can be reached at 127 Ohio St., Millinocket, ME 04462; (207) 723-9034. -=------------- -=*=- -=*=- -=*=- -------------=- Whammy! ~~~~~~~ < Look for it in the file PCMO9412.ZIP. Ask your SysOp for the location of this file.> What you need to run the program: MS-DOS, CGA Graphics, BASIC or QBASIC "A graphical dice game that requires luck -- but also skill and self- control" WHAMMY! by Bill Bernico I know what you're wondering: "Did I roll six times or only five?" Since this is Whammy!, the most addictive game for your computer, you also have to ask yourself one more question: "Do I feel lucky?" The object of the game is to be the first person to accumulate a predetermined number of points by rolling two dice. You can roll as long as you like. This may sound easy -- but keep in mind that if one of your dice comes up with a W (there are no 1s), you lose whatever points you've accumulated during the round. If you roll two W's, you lose all the points you've accumulated up to that point in the game! If you've rolled five times without a Whammy! showing up and you have 50 points so far, I'd say it's a good time to pass the dice to the next player. You get to keep those 50 points and start from there on your next roll. You can play this game by yourself, but it's designed to accept up to four players. Each player must enter his name at the prompt, keeping the input to 11 characters or less. You can also decide how many points a player must accumulate before he's declared the winner. From there you're taken to the playing screen, where the players' names are displayed at the upper left of the screen. The upper right displays the number of points needed to win, how many points you've accumulated for this turn, and how many total points you have toward the goal. Finally it displays the winner's name and total points earned by the winner. The middle of the screen is where the game is played. A large arrow points to the right where two dice appear. Inside that arrow is the name of the person presently rolling the dice. If you roll a Whammy! or a Double Whammy!, the information window appears below the arrow and dice. At the bottom of the playing screen, you'll see a prompt asking if you want to roll again. If you answer yes, your next roll is automatically executed. If you answer no, the next player's roll is executed. I wish I could sit down and play this game with Clint Eastwood. Just once I'd like the opportunity to ask him, "Do you feel lucky? Well, do ya, punk?" -=*=- A frequent contributor to PCM, Bill Bernico enjoys writing and recording his own music. He can be reached at 16721 Lakeshore Road, Cleveland, WI 53015; (414) 693-3289. -=------------- -=*=- -=*=- -=*=- -------------=- Alternative Operating Systems ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Exploring operating-system alternatives to MS-DOS" NOVELL DOS 7.0 by Emmett Dulaney Contributing Editor The most intriguing thing about Novell DOS 7.0 is that software reviewers have been writing about it since the days when Wheel of Fortune used to stop the puzzles after every round and make the contestants enter a "prize room" wherein they had to spend all their winnings before the show could continue (you could also put the money into a certificate, Pat). Add to this the fact that the software was unavailable for purchase until the end of February, and you get a troublesome condition. Many reviewers not only wrote of it but sang its praises to the high heavens. How could they do this on a product that couldn't even be purchased yet? They wrote their reviews and articles on press releases and beta versions. The dangers inherent in this practice are multifold. Press releases are issued to stir interest in a product -- not to provide technical specifications. Often they constitute nothing more than wish lists of what the vendor would like to put into the program in the absence of gravity and other laws of physics. My fellow compu-nerd Jason (the job of running this company is everybody's business) Shoults and I have had an ongoing battle for the last few months to see who could be the first to get a final release of Novell DOS. I am sad to report that he beat me by a couple of days -- and happy to report that he did much of the original research. With that said, let the review begin. >>[ History ]<< Digital Research established a name for itself by releasing a PC operating system that competed with Microsoft's DOS. DR DOS was always one step ahead of Microsoft in offering utilities and features its counterpart did not have. DR DOS was the first to have disk compression, standard undelete utilities and so on. A few years back, Novell went on a buying spree and purchased Digital Research when its version of DOS was up to 6.0. Novell sat on the product for a while (bundling it with NetWare Lite and so on), allowing Microsoft and IBM to catch up in terms of features. Release 7.0 is the first offering from Novell, and it incorporates directly into the operating system the features of NetWare Lite, now often referred to as Personal NetWare. >>[ Strengths ]<< Novell DOS 7.0 is the only DOS version available that incorporates networking directly into the operating system. With network cards installed in the PC and appropriate cables connected, a peer-to-peer network can be up and running in no time. With such a network multiple users can share a common database of information or have access to a printer or other device connected to only one of the PCs. With a 286 computer task swapping is available. This allows you to open several "windows" or application sessions -- such as DOS, a word processor and a spreadsheet -- and you can easily switch from one to another without closing either. When you do so, the session you leave stops processing at the moment you leave it and waits until you come back before continuing. With a 386 or better, task swapping is replaced by multitasking. The same concept holds true of allowing you to open multiple sessions. The difference is that when you switch from one window to another, the window you are leaving continues processing whatever requests have been made. This slows down the operation on which you are working, but by a very small amount not even noticeable to most users. The disk compression that came with DR DOS 6.0 was provided by Addstor's SuperStor utility. With Novell DOS 7.0 this has been replaced by Stac Electronics' Stacker. Stacker presently is the best compression utility on the market, and the inclusion of it with the operating system amounts to a definite benefit. If you install Novell DOS on a system presently running SuperStor or compressed with Microsoft's DBLSPACE, you can continue to use those compression routines as you normally would. Personally, however, I would highly recommend switching to Stacker. A nice utility that ties in is PREVIEW.EXE, which computes the savings that would occur if a hard or floppy disk is compressed. Password utilities are included, allowing you to assign a user name and password to individual files, subdirectories or the entire drive. Disk caching and performance optimization are possible through two utilities -- NWCACHE.EXE and DISKOPT.EXE, respectively. Combined, these two utilities allow you to reduce the amount of access time required for information on your drive. The tutorial program supplied with the package is exceptional. It breaks every category into multiple categories and explains them in precise detail. If every vendor's tutorial were as good as this one, the learning curve for users to get up to speed on new products would be greatly reduced. In addition to all these strengths, the operating system is fully compatible with Windows, and it offers most of the utilities users have come to expect. These include virus scanning, undelete utilities, command history and an online manual. >>[ Weaknesses ]<< While Novell places a great deal of emphasis on compatibility, slight differences exist in the ways Novell and Microsoft handle some of the more basic commands. For example, Microsoft offers the following parameters with the DIR command: /A -- show files by attributes: A (archive), D (directories), H (hidden), R (read only), or S (system); /B -- bare format; /C -- file-compression ratio; /L -- lowercase; /O -- list in order: C (compression ration), D (date and time), E (extension), N (name), and S (size); /P -- pause after each screen; /S -- include subdirectories; and /W -- use wide format. Novell on the other hand has mixed and matched, offering these parameters: /A -- show all files; /C or /R -- make other switches the default next time; /D -- show files without the system attribute; /L -- give a long (standard) listing; /2 -- show the long listing in two columns; /N -- return to default paging switch; /P -- pause after each screen; /S -- show files with the system attribute set; and /W -- use wide format. There are no parameters for listing hidden files, showing compression ratios, or altering the list to appear in a sorted order. Most of these operations can be done with an external utility, XDIR.EXE; doing so requires summoning the PATH statement, however, when the operation could be more efficiently handled internally. It is these little discrepancies that become annoying if you are accustomed to using all the features DOS offers. Lacking as well is any sort of programming language. Microsoft offers QBASIC to allow you to create routines that cannot be supported with simple batch files. Novell offers no such routine. The memory manager, EMM386, must be running before task-switching and multitasking can take place. In fact, it must be running before many of the advanced functions supported by the operating system can be used. Unfortunately, EMM386 is a throw-back to the memory management first included with MS-DOS 5.0 and is very cumbersome and difficult to use, to put it mildly. It requires a great deal of fine-tuning to get working properly (and even an occasional call to Novell). Difficulties abound if you are loading a lot of drivers -- primarily because they can load in only one order, and there are no clues to this. Further, if EMM386 isn't properly installed, Windows may not run in Enhanced mode -- if at all. Once operating properly, Novell's EMM386 works almost as well as any other manager available, but be forewarned that the initial setup does take some time. >>[ Favorite Feature ]<< The batch language has been enhanced over competitors' products, with many of its enhancements coming from Novell's own NetWare (and they will look very familiar to system administrators). For years this has been an underused feature of the operating system. Batch processing allows you to automate steps by combining commands, and I have always been under the impression that extending the language would allow more automation to take place. Following are the environment variables now understood by Novell DOS batch files: APPEND -- the APPEND search path; COMSPEC -- location of the current COMMAND.COM file; NWDOSCFG -- location of the current configuration files; OS -- the current operating system name; PATH -- the executable-file search path; PEXEC -- the variable executed by the PROMPT command; PROMPT -- the current user prompt; TEMP -- subdirectory where temporary files go; and VER -- the version of the current operating system. As well as the inclusion of new environment variables, these system variables are not available elsewhere: AM_PM -- whichever is appropriate for the time; DAY -- the numerical day of the month (01 to 31). DAY_OF_WEEK -- name of the day (Sunday, Monday, etc.) ERRORLEVEL -- the existing error-code level GREETING_TIME -- Morning, Afternoon or Evening HOUR -- nonmilitary time representation (1 to 12) HOUR24 -- military representation (00 to 23) LOGIN_NAME -- the user's login name (with network enabled) MINUTE -- numerical (:00 to :59) MONTH -- numerical (1 to 12) MONTH_NAME -- full name (May, June, etc.) NDAY_OF_WEEK -- numerical day (1=Sunday, 7=Saturday) OS -- the operating system (NWDOS is returned) OS_VERSION -- the operating system version number (7) P_STATION -- the physical station number (network required) SECOND -- numerical (:00 to :59) SHORT_YEAR -- last two digits (94) STATION -- the network station number (network required) YEAR -- four-digit (1994) In addition to the expansion of available variables, included are five key commands (some new, some from DR DOS) that no other operating system offers in quite the same fashion: ? -- A question mark preceding a line causes the operating system to prompt the user to answer a question by pressing Y or N. If the answer is Y, the command following the prompt takes place; otherwise it does not. To delete all backup files, for example, the file command is ? "Delete the old batch files" DEL *.BAK. The prompt appears as Delete the old batch files (Y/N) ? Pressing Y carries out the next action -- the actual deletion. CHOICE -- This command, originating with DR DOS, lets the user make a selection from a list. This concept has carried over to MS-DOS, but the operation is still slightly different. With Novell DOS the syntax for a sample operation is: :begin echo A. Q&A 3.0 echo B. Q&A 4.0 echo C. Q&A 4.0 for Windows CHOICE /C:abc Please make a selection if errorlevel 3 goto 4_Windows if errorlevel 2 goto Four if errorlevel 1 goto Three :4_Windows WIN QA goto begin :Four cd\QA4 QA goto begin :Three cd\qa3 QA goto begin The prompt following the CHOICE command becomes the new prompt. The only valid entries that can be given are those following /C. The first choice returns an error level of 1, the second an error level of 2, and so on. By default, the only entries CHOICE accepts if the /C parameter is not used are Y and N. A /T option can also be used, causing the question to time out after a specified number of seconds and take one of the choices as a default. GOSUB and RETURN -- These statements, popular in BASIC language programming, are supported in Novell DOS. They allow execution of the file to jump to a specific set of commands, execute them, and then return to the leaving point. This differs from GOTO (also supported), in which processing jumps to a subroutine and never returns. DIREXIST -- This command is used to check for the existence of a directory path. If it exists, an error level of 0 is returned; otherwise the error level is 1. SWITCH -- This command allows processing to switch between subroutines, depending upon parameters given when the batch file was executed. This temporary switch addresses only the first nine parameters and differs from SHIFT, wherein the parameters permanently switch positions. >>[ Internal Commands ]<< The internal commands in MS-DOS and Novell DOS are the same with only a few exceptions, the following three commands built into the Novell version and not Microsoft's: The DELQ command performs the same action as DEL /P in both operating systems -- asking you whether or not specified files should be deleted. This same command can be specified as ERAQ -- erase files with query. The ERASE command itself can be shortened to ERA. The IDLE command checks idle time -- primarily of use with laptop computers and the need to save the battery as long as possible. >>[ External Commands ]<< A majority of the commands included with MS-DOS 6.x are also in Novell DOS 7.0. There are a few differences in utility names as they relate to compression (DBLSPACE versus Stacker) and so on, but primarily the same function is performed in each case. A handful of exceptions to this are utilities in Novell DOS that are not in MS-DOS or vice versa. The only ones worthy of note in MS-DOS that aren't present in Novell DOS are QBASIC.EXE (the BASIC language interpreter), MSD.EXE (the Microsoft System Diagnostic utility), and POWER.EXE (the utility that allows power savings on laptops). The following are found in Novell DOS but not in MS-DOS: ASSIGN.COM, an old command no longer supported by MS-DOS, lets you redirect disk requests to another drive. While the antiquated BACKUP.COM is still offered as a command-line backup, a far superior graphical-menu utility -- Fastback Express -- has been licensed from Symantec. COMP.COM, another old command MS-DOS no longer supports, allows you to compare files. Both MS-DOS and Novell DOS also include FC.COM, which does a far superior job. CURSOR.EXE allows you to change the size of the cursor and change the flash interval. This is particularly useful on laptops, where the LCD display can be hard to find. DPMI.EXE and DPMS.EXE let you run the DOS Protected Mode Interface and Protected Mode Service, respectively. Both pertain to the extended- memory manager (and are as difficult to understand as nuclear medicine). FILELINK.EXE replaces MS-DOS's INTERLNK and is far superior. It allows two computers to connect together for downloading of files (such as from a laptop to a desktop PC). It is remarkably easier to use than INTERLNK and much needed in these days of laptop-carrying travelers. JOIN.EXE, another old MS-DOS command, allows two drives to appear to be joined as one. LOCK.EXE lets you lock the terminal with a password before walking away. You must give that password when you return to begin working again. If someone attempts to reboot the PC, he still must give the password before being allowed to continue. Needless to say, remembering the password you've assigned is crucial. NETWARS.EXE is a computer game that can be played individually or across a network if so connected. The object is to destroy alien ships on a 3-D battleground. If your computer is a stand-alone PC, you play against the enemies. If you are connected to a network, other players share your plane and attempt to destroy you as well. PASSWORD.EXE allows you to assign a password to a file, subdirectory or drive. You can choose when the password is to be required on the object -- i.e., to read, write or delete the file, or any combination of the three. SCRIPT.EXE offers PostScript printing directly from DOS. Novell DOS is the only operating system to include such support directly. For laser-printer users this is a big benefit. TASKMGR.EXE, the task manager, lets you switch between sessions while leaving other applications open. TOUCH.EXE, a carryover from the UNIX operating system, changes the date and time associated with files. "Touching" a file is useful in changing dates prior to backups of files modified within a certain time period. XDEL.EXE allows you to delete multiple files and/or subdirectories. It accepts filenames from the command line, or you can specify the name of a file that contains a listing of other files on which to perform a specific operation. This is redirection at its finest. XDIR.EXE performs the same operations as the DIR command but provides parameter support the internal DIR does not -- such as looking for hidden files and sorting in a given order. >>[ Summation ]<< Novell DOS 7.0 is a very viable alternative to MS-DOS 6.x. It offers numerous features not available from Microsoft and should be placed high on the consideration list by users who are interested in networking their computers or who need security features. By purchasing the operating system, a user also obtains (among other things) a full copy of the Stacker disk-compression utility, NetWare Lite and Fastback Express -- all at a price cheaper than purchasing any of the three separately. Novell DOS 7.0 requires 640K of RAM (4MB for multitasking) and 6MB disk space (12MB for full installation). It works with a 286, but a 386 or better is highly recommended. Novell, Inc., 122 East 1700 South, Provo, UT 84606; (800) 453-1267; $99. -=*=- Emmett Dulaney, who writes PCM's Business as Usual column, can be reached on the Internet as edulaney@aol.com or via America Online, username EDULANEY. -=------------=- T-H-E E-N-D F-O-R N-O-W -=------------=-