IBM images. (new software, computer languages, adaptations for Reindeer program) Susan Glinert-Cole.
Today is a balmy 105 degrees in Baltimore, and I have been having a difficult time setting the mood for a Christmas column. I contemplated climbing into the refrigerator, but unfortunately it was already occupied by other members of the household who refused to yield to my glib argument about how hard it was to set a tone for December when I could fry an egg on the system unit.
Using a technique often employed by members of the acting profession (method acting), I decorated my feet with ice cubes and pretended to be a Christmas tree. This had an altogether salubrious effect, so without further ado, I proceed to the matters at hand.
Utilities and languages can be as entertaining as games and are usually far more intellectually stimulating. Alas, it is true that some utilities crash more often than they inform, and some compilers are so poorly documented that using them is a little like learning Japanese from sidewalk graffiti. I would rather talk abotu the better products, so read on.
Coping With The Rule Of Stuff
Everyone has suffered, at one time or another, from the inexorable Rule of Stuff: stuff expands to occupy all available space. Almost everyone has some variety of stuff that multiplies in the dark; our household is particularly plagued by newspapers and plastic bags. Some friends of ours have terrible problems with little soap bars. Victims of the rule mumble a great deal about not knwoing where all this stuff came from.
Files, being composed of elemental stuff matter, will naturally expand to occupy all available disk space. Most computer users are plagued by this problem, but there are uitlities available that can trim inches away in seconds.
Starside Engineering offers Compress, a utility that is very effective in reducing the size of ASCII files up to 50%. Every piece of software I have seen from Starside Engineering is impeccably constructed. Their documentation is readable, informative, and often entertaining; in short, everything software documentation is supposed to be but usually isn't. The software is uncrashable and has excellent human interface. Updates are available for $5 and the original disk. Starside also provides five pre-typed labels for backup copies.
The programs in this package, COMPRESS and DECOMPRESS, are invoked by typing the name after the DOS prompt. If no file is specified as a parameter, each program enters a "command mode' which presents a help screen and an asterisk prompt. The file(s) to be operated on may then be entered. COMPRESS produces a file with the extension .TOT as its output unless the file has no extension to begin with; in this case the extension %.qqq/ is appended to the original file name.
DECOMPRESS works in a similar manner, but it has a preview option that allows you to inspect a specified number of lines of a file before decompression. The output from this command may be redirected to the printer. As in COMPRESS, multiple files may be specified at once; options are available to print a formfeed between files and insert a carriage return/linefeed pair after each line.
Both utilities are written in assembly language and zip right along. A 15,104-byte file took six seconds to compress to 9224 bytes and about three seconds to decompress. The utilities use Huffman coding, which is based on the principle that some letters of the alphabet occurmore often than others.
COMPRESS analyzes a file and creates a table of the ASCII characters found in the file. It then assigns variable-length codes to the characters. The characters found most often, e's and a's for example, become a two-bit code, while the less common ones may take seven or more bits. The translated file, along with the translation table, is written out to the disk.
DECOMPRESS uses the translation table to convert the file back to its original form.
The documentation explains that files containing many vowels and spaces may realize a 60% compression, while files with an even distribution of ASCII characters may derive very little benefit from this utility. Because Basic program files tend to be composed of radomly distributed op codes, COMPRESS may not be able to whittle down the size of a Basic program very much. The manual suggests that it is hard to predict just how well this utility will work on a given file; the only way to find out is to experiment.
The package works with either DOS 1.1 or 2.0, any monitor, and 64K of memory. Starside Engineering also offers a screendump utility, Frieze, and a graphics scratchapad program, Glyphix, that I hope to look at next month.
The Basic Development System
SofTool Systems has put together a wonderful package for the Basic programmer. BDS requires 64K of memory and will work with either DOS 1.1 or DOS 2.0; in both cases it is called from DOS and runs Basic(A) as a subtask. The installation procedures differ for each version of DOS. For DOS 2.0, BDS is simply copied to the working disk; for DOS 1.1, a set of patches is included to modify Basic or BasicA. In either case, the user has the option to run BDS as a disk or memory resident module. Once installed, the facilities provided by the seven utilities become an integral part of the Basic command set and are used transparently by the programmer.
BDS is called by entering the following command after the DOS prompt:
BDS m [X] [.[d:] [p]] b where m specifies Memory or Disk resident mode; X is an optional parameter for the extended Cross-Reference format; ".', "d:', and p tell BDS where to look for the BDS.COM file if the program is being used with the disk resident mode. The b is a command line for starting Basic(A) and is entered exactly as it would be if BDS were not present. The command:
BDS D BASICA
would start advanced Basic with BDS in the disk resident mode; the program would expect to find BDS.COM on the default drive and current directory. It is possible to run Basic(A) without BDS by specifying a switch in the command line.
The documentation is excellent and comes punched for insertion into the Basic manual. A quick reference card is thoughtfully provided, and the manual has some nuggets of information about Basic that are not readily available elsewhere.
The XBasic utility accepts one letter abbreviation for ten standard Bastic commands and a new one provided by SofTool. The screen can be cleared by typing a C (for CLS). L lists a program. N clears the workspace, and so on. The command UN-NEW (U) restores the resident Basic program if you cleared the workspace unintentionally.
XBasic lets you step through a program line-by-line in several different ways. CTRL-PgUp lists the first line, PgDn lists the next line, PgUp lists the previous line, CTRL-PgDn lists the last line, and . lists the current line of a program. These commands are meant to be used in conjunction with the single step trace facility which is invoked with:
SYSTEM TRON [line number]
This command, and its opposite numbe SYSTEM TROFF, may be used inside a program or in the direct mode. Prior to executing a statement, the trace option will display the line number of the statement in the upper righthand corner of the screen, and execution is suspended until a key is pressed. The keystroke is left in the keyboard buffer to allow INKEY$ and INPUT statements to be processed normally. CTRL-Break halts the program in the usual fashion, and other BDS debugging tools can then be called into play.
The state of all program variables can be examined with the Variable Dump Facility. There are eight formats for the V command, which allow you to specify selected variable listings and direct the output to the screen or the printer. The variables are displayed, followed by the data type (single precision, integer, and so on) and the current value.
The FIND utility (F) is similar to the Variable Dump, but produces listings of Basic keywords and strings alongside the line numbers where they are located. Listing 1 is a listing of a program entitled Nonsense; one result of FIND on Nonsense is shown in Listing 2.
XREF outputs a list of any or all constants and variables, cross-tabulated by line number. If the variable has been modified on that line, the line number is preceded by an asterisk. There are two different output formats for XREF and FIND; selection is done by specifying a parameter at the time BDS is invoked. Listing 3 is the default XREF output, and Listing 4 shows the extended cross eference format.
SUPER RENUM renumbers lines in ways that MicroSoft never dreamed of. It allows you to specify an upper limit on a block of lines to be renumbered, lets you relocate or duplicate sections of the program, and keeps you informed as to the number of program lines and text size before and after it executes. With this program you can even change the order of program lines with one renumbering command.
The last two utilities, COMPRESS and UNCOMPRESS, are specifically for use with Basic programs (as opposed to ACII text as in Starside Engineering's Compress). COMPRESS squeezes out all extraneous blanks, colons, remarks, trailing quotation marks, non-executable program lines, and so on; in the process it reduces the size of the program to the minimum required for optimal program execution. By following COMPRESS with various parameters, the compression process can be tailored to your own specifications. Thus if you don't want blanks or remarks removed, you can instruct COMPRESS to leave them in.
The function of UNCOMPRESS should come as no surprise; it reverses the actions of COMPRESS, with some modifications. If remarks were removed, this utility cannot replace them. A gain, the expansion process can be tailored to your own particular taste in spacing, indentation, and variable typing characters.
The set costs $79 and is well worth the price. It is one of those pieces of software you will wonder how you ever did without.
PCTools offers a duo of uitlities for PC Basic: PrettyPrinter and CrossReference. The documentation and the programs themselves are excellent. The author spices the manual with charming digressions on code legibility, strengths and weaknesses of IBM languages, and programming philosophy; there are also some little-known facts about Basic scattered around. The pretty printer transforms your ugly (but compact and efficient) program into a readable and tasteful listing. Multi-line statements are properly disentangled and each statement is printed on its own line. Basic keywords are transofmred to lowercase, and block conditional statements (if . . . then . . . else and while . . . wend) are given a Pascal-like structure. Remarks may be highlighted either with boldface type or by separating them from the body of the text with any chosen character. Listings 5 and 6 show what PrettyPrinter can do to an efficient, but unsightly program.
The CrossReferencer is not quite as powerful as that which comes with BDS, but it is easier to use, and the output is much tidier (see Listing 7). You can cross-reference by variables, line numbers, and keywords; these options are chosen from a menu when the program is run. The two programs cost $39 on one disk and are a good buy.
Name That Disk
I hate formatting disks. I simply cannot get interested in feeding little plastic frisbees into the maw of a disk drive and "pressing any key to continue.' My aversion to the process is so strong that I usually format two boxes of disks at once, so as to have a plentiful supply on hand. While the drive is creaking and groaning, I can eat a couple of pounds of grapes. This state of affairs makes it impossible for me to give the disk meaningful volume names and, while it was a nice touch to include this facility in DOS 2.0, the fact that a volume name cannot be added or altered after formatting is very inconvenient. ErgoSoft offers a nifty little utility, PCDiskid, that can manipulate volume labels (add, delete, or change), unerase a program, and print a sorted directory listing. The programs will work on a fixed or floppy disk and require DOS 2.0 or higher.
The documentation, a well-written little pamphlet, is almost unnecessary, because the program is completely self-explanatory. The menu presents five choices: Add/Change a volume label, Delete a volume lable, Unerase a file, List a sorted directory, and Exit to DOS. If you choose to add or change a volume lable, the program displays the current lable (if present) and prompts for a new name. If you choose the delete option, a confirm prompt ensures that the erasure is not done accidentally. The unerase utility attempts recovery of the specified filename, but because DOS erases a file by changing the first letter of the file, filenames that are identical except for the first character cannot be distinguished (e.g. 1FILE and 2FILE). PCDiskid resolves the conflict by recovering the file with the most recent directory date.
The directory listing utility will generate an alphabetical list of all files on the disk, including hidden and system files, in four different formats. Three of the formats are suitable for viewing: five or nine filenames per line and the regulation DIR output. The output of these three choices may be directed to the display or the printer. The fourth option is a lable format (4 X 1 7/16 ); printing will continue on consecutive labels until all the filenames are printed.
There are no unpleasant surprises in this package; it is fast, friendly, and an excellent buy at $30. ErgoSoft is working on a larger set of utilities for the IBM PC. Given the high quality of this piece of software, I look forward to seeing their next offering.
What The Best-Dressed Computers Are Wearing
The appurtenances of computers fade in and out of fashion with a rhythm reminiscent of the Seventh Avenue hemline oscillation. Every year it seems, produces a modish new language, database, word processor, hardware appliance, and ergonomically designed disk container. The blinding speed with which the computer industry progresses relegates your system to obsolescence almost before the last shreds of packing material have been picked out of the disk drives. It is interesting to follow the meteoric ups and downs of these fashionable items an speculate on tomorrow's electronic hemline.
Computer enthusiasts will usually argue in a persuasive, albeit polite, manner about their pet spreadsheet or utility, but for some reason, when the discussion turns to favorite programming languages, the urbane and polished bon mots degenerate into scurrilous diatribes. I don's think there is another subject that arouses the chauvinistic nature of a programmer the way languages do. People are even classified by their native computer tongue as in: "Oh, he programs in Basic . . .' (said with a disdainful curl of the lip). The best way to counter the question of what programming language you use is to say "Well, it depends . . .' This will imply that you are familiar with at least five of them and is a good status symbol. tatListing 7. I feel somewhat obliged to keep the readers of this column au courant of languages, fashionable or otherwise, lest they have nothing to argue about at user's group meetings. Let's begin with Ada.
Ada, as everyone probably knows by now, was commissioned by the Department of Defense to help keep costs down in the DoD's computer centers. The rationale is that different departments have been writing programs in several assorted languages, making maintenance difficult and portability impossible. With only one language to contend with, the price of electronically defending the U.S.A. should, theoretically, plummet accordingly.
Ada is not well regarded by Those Who Know Computer Languages, because it is complex, difficult to use, and has all of the warts associated with a language designed by a committee. Ada will be about as fashionable and well loved as Cobol, another DoD creation. Regardless of the prevailing opinions about it, programmers who learn it will have an advantage job-wise over those who don't.
There are several compilers for the IBM PC on the market which are subsects of Ada. Be aware, however, that the DoD will not allow a subset to be called Ada; only fully validated compilers can use the name. The two compilers I am aware of at the present time are Supersoft's Ada and RR Software's Janus/Ada. Both companies eventually intend to upgrade their products to fully-validated implementations.
By far the most fashionable language of 1983 is C. There are at least a dozen C compilers on the market for the IBM PC, and more leap into the fray every month. I have done very little programming in C, and so have only a bystander's view of it. C contains many facilities, such as bit-manipulation operators and pointer arithmetic, that make it easy to control low-level machine functions and can provide a very rich set of data structures.
The model supplied by C is inherently flexible; this allows extensions to the language, as well as adaptation to different machines to be easily done. It is no wonder that C is enormously popular with system developers. The ability to remain close to the machine model while coding in a high-level language is certainly appealing; many programmers, system developers, and software houses are busily converting everything in sight to C.
The opponents of C, when they dare come out into the open, say the C has wishy-washy type checking, produces unreadable source code, and is not really as portable as it is advertised to be. C is very popular with assembly language programmers, but most Pascal adherents find it uncomfortable to use, I guess because its laxity in type-checking allows the user to commit truly spectacular programming errors.
Let us not forget, however, that Unix (and Xenix) are written primarily in C. If MS-DOS is upwardly compatible with Xenix, it doesn't take much to figure that IBM will be soon offering their own C compiler. In fact, Microsoft has converted much of their program development to this language, and already offers Lattice C under their own labe. If the language doesn't appeal to you, memorize a few buzzwords. At least it is easy to spell.
I really didn't mean to mention C and Ada; I started talking about fashion primarily as a lead-in to another language altogether: Modula-2. Modula-2 is Niklaus Wirth's answer to Ada as Pascal was his answer to Cobol. Because I think both of his languages are remarkable, I can doubly admire his backhat to the Department of Defense. Modula answers many of the objections to C, such as cryptic code and lack of type-checking, while still allowing flexible, low-level programming.
Modula-2 was designed, in part, to address some of the sticky wickets of Pascal. Not surprisingly, the two languages are remarkably similar and share an underlying common structure and syntax. The module concept is central to the language, allowing large programs to be written in smaller pieces called (surprise!) modules. Parts of the module may be designated as visible to the outside world, while other sections are sheltered inside the module.
This philosophy has many advantages, particularly when many people are contributing to a large programming project. For example, machine-specific information can be hidden in the body of the module, while a high-level interface is publicly presented. This makes it relatively easy to transport a program to other machines, because only the machine-specific portion, and not the interface, need to be rewritten.
Like C, Modula has the facilities for low-level machine access, such as pointer and address arithmetic, interrupt handling, direct access to memory, and relaxed type-checking. Modula suports co-rountines, which can be viewed as processes that execute independently and call each other as co-routines. This provides the concurrent processes and task scheduling so dear to the hearts of systems programmers.
Pascal programmers will thrill to Modula's dearth of BEGINS and ENDS; they will also enjoy the addition of the LOOP command. Less pleasant is Modula's WRITE statements: a separate WRITE is needed for each data type (e.g., WriteReal, WriteString, and so on). This makes output a drag to code.
Volition Systems offers Modula-2 running under the USCD p-System ver.2.0. Logitech is rumored to be producing a version that will run under DOS 2.0. I have only seen Volition's version, and it is admirably done. The package includes Niklaus Wirth's book Programming in Modula-2, the Modula compiler, a Pascal compiler, an excellent editor, a library of utilities, and one of the best language tutorials I've ever seen.
A programmer conversant in Pascal can be writing Modula programs in a couple of hours with Volition's kit. However, it is not inexpensive at $595, and programs written in this language must, by virtue of the odd operating system chosen, be stand-alone programs. The rumor is that Volition will be converting the compiler to run under MS-DOS. I hope this rumor has some substance, because the volume of applications programs written in MS-DOS would only enhance the usefulness of this well-designed package.
A Note On SHELL
In DOS 2.0 it is possible to invoke a secondary command processor that will be loaded in place of COMMAND.COM with:
A> SHELL = "filename'
This command is useful to system programmers who are knowledgeable in the ways of operating systems. Of interest to Basic programmers is the fact that SHELL is also a new keyword in Basic 2.0 and can be used inside a program to carry out commands from DOS. This sounds like a swell enhancement, but unfortunately, it seems to have some bugs in it.
Type in this ?? program:
10 X 42; y = 73
20 shell "DIR'
30 cls:print x, y
When run, the program will exit to DOS at a secondary command level, print the default disk directory, return to the program, and execute line 30. The following programs is even more flexible:
SHELL without any parameters will return you to DOS where, to all intents and purposes you can do anything you usually do form DOS, like crease files, format disks and so on. To return to Basic, type EXIT after the A> prompt. You cannot return to Basic by typing Basic; this gives the curious (and undocumented) error: "you cannot run Basic as a child of Basic.' HSELL itself can be used any number of times inside a program with no ill effect. This really seemed whiz-bang neato, until I tried to list the program. This action produces various unpredictable results consisting mostly of screen garbage, an occasional system crash, and some flashy visual displays. The junk can be cleared out of the program space with NEW, but typing SHELL again (even in a program line) will usually freeze everything and require a cold reboot. SHELL is probably meant to be used in invoking a secondary command processor from Basic; using it with COMMAND.COM itself leaves the program workspace in a mess after the program has finished running.
A Little Christmas Spirit
The small program listing (Listing 8) called Reindeer is by way of a small Christmas present to the column readership. It will print out a mildly artistic decoration that can be used either as a weired ornament or as a bulky Christmas card. The printout looked extremely boring in black and white, so I was impelled to find a way to wring something more colorful out of my printer without investing a small fortune.
I understand, from some of the statistics floating around the office, that some overwhelming percentage of the people reading these words are of the masculine persuasion; consequently, the item that does the trick (dressmaker's carbon paper), will probably not be in your vocabulary. This stuff is found in stores that carry sewing supplies. The best kind is made by Dritz; it has a thick, waxy coating and comes in six or eight different colors. Some dressmaker's carbon paper looks like blueprint paper and it won't work because the coating is too thin.
Anyway, the general procedure is to obtain a long sheet of either boring white printer paper or some dazzling shade of wrapping paper cut to fit the printer and place a sheet of the carbon paper, waxy side down, on top of the first sheet. Roll the whole thing into the printer and run the Reindeer program. Multi-colored animals will prance down the page. It looks particularly nice with white reindeer on dark blue paper. Merry Christmas.
Firms Mentioned in this Column
RR Software P.O. Box 1512 Madison, WI 53701
Supersoft P.O. Box 1628 Champaign, IL 61820
ErgoSoft P.O. Box 454 Oakhurst, NJ 07755 (201) 493-8352
Starside Engineering P.O. Box 18306 Rochester, NY 14618 (716) 461-1027
PCTools Box 207 Centerville, MD 21617
Volition Systems P.O. Box 1236 Del Mar, CA 92014
SofTool Systems 8972 Hampden Ave. Suite 179 Denver, CO 80231
Table: Listing 1.
Table: Listing 2.
Table: Listing 3.
Table: Listing 4.
Table: Listing 5.
Table: Listing 6.
Table: Listing 8.
Table: Listing 9.