Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 12 / DECEMBER 1983 / PAGE 350

TRS-80 strings. (color computers, word processors, new programs) (column) Stephen Gray; Stephen B. Gray.

TRS-80 Strings

The fifty-eighth verse of the haunting "Ballad of the TRS-80' tells the tale of two new Color Computers, a full-screen text editor, a Basic compiler, a generalogy program, and a short program that generates random number series.

Color Computer 2

Now there are two new Color Computers: the Color Computer 2, an improved version with a compact white case and an electric typewriter keyboard; and a new version of the old "Chiclet'-key unit, also with a typewriter-type keyboard. The Chiclet-key model will disappear from Radio Shack stores when current stocks are gone. (The TRS-80) Micro Color Computer MC-10 stays in the line.)

The Color Computer 2 comes in two models: 16K Standard for $239.95; 16K Extended for $319.95. All Color Computer 1 programs run on the 2, which has no new software features; the differences are the keyboard, case, and lower price.

The other new machine has the same design of case as the Color Computer 1, but in white. It has the new keyboard, costs $399.95, and is a 64K Extended Basic Color Computer when used with the OS-9 disk operating system. Without OS-9, you can access only 32K of memory.

That new OS-9, by the way, includes an editor/assembler and supports multi-tasking. OS-9 is said to be similar in syntax and structure to Bell Labs' Unix.

Multi-tasking means that more than one task is being run at a time. Actually, only one runs at a time, but the resources of the computer are split between the various tasks, so you get the illusion that many things are happening at once.

Multi-tasking on the Color Computer is not very effective, because of the slow speed (0.894 MHz) of the machine. However, Unix-type syntax is becoming a standard, so learning OS-9 won't hurt if you want to keep up with the world.

Both the Color Computer 2 and the 64K Extended Basic Color Computer have the new white cases that are now standard for all TRS-80 computers (except Pocket Computers); the color is molded in, not sprayed on.

The white (actually, it is more of an off-white) case for the 64K Extended Basic Color Computer is the same case found on the TDP model. This Tandy Data Products machine, the same as the Chiclet-key Color Computer but with the white case, has been supplied to RCA for sale by RCA distributors to their dealers.

Color Computer Peripheral Incompatibility

Two of the Color Computer 1 peripherals won't work with the new model. There is a slight electrical difference in the two machines: one has a 12-volt line to the Program Pak slot; the other doesn't.

As a result, there are disk drives for both models which are not swappable. Both models are $399.95 for drive 0; $279.95 for drives 1, 2, and 3.

The $349.95 Color Computer Graphics Tablet, when used with Color Computer 2, requires the Multi-Pak Interface, a $179.95 peripheral that lets you switch quickly from one Program Pak to another. You can plug up to four Paks into the Multi-Pak Interface, which in turn is plugged into the Color Computer. Just flip the switch on the interface, and the Program Pak you select is connected to the computer.

Full Screen Text Editor

If you do a lot of editing of your Basic programs, you should look into full-screen text editors, which are much faster than using EDIT, line by line, to make changes and corrections, and which have a great many more features.

Some packages include a screen editor, such as the Sams Superkeys program (Sept. 1983, p. 303), which provides a variety of screen editing functions, but not nearly as many as a program designed specifically for the job.

Computer Applications Unlimited specializes in utility packages for the TRS-80. CAU offers screen editors for Basic and assembler, as well as T-ZAL (tape-based Z80 assembler), M-ZAL (disk-based assembler), XBUG (machine language monitor and debugger), FILEXFER (communications package), and several others.

CAU's Full Screen Text Editor is a word processor specifically designed to handle Basic programs instead of letters and documents and offers an amazing variety of features with its 31 commands. You can change, insert, and delete a character or characters; extend a line or insert lines; delete, copy or move statements; do a global search and/or change any specified string; renumber lines; and scroll by line or page.

Also, each of the 26 letter keys is defined as a macro key to represent a Basic keyword; any or all can be changed.

Using The Screen Editor

Any time you are working with a Basic program and want to get into screen edit mode, just enter XEDIT, and you are ready to edit. Arrow keys, used with and without SHIFT or ENTER, provide six cursor movement commands. To delete a character, move the cursor to it, hit SHIFT, the down-arrow, and D. The character disappears, and the rest of the characters in the line move to the left to fill the gap.

To copy or move statements (or blocks of statements), you get into Clear Command mode by hitting CLEAR. With C you mark a statement to be copied; M marks one for moving. Then move the cursor to where the copied or moved statement is to go, hit H, and that't it. This editor even assigns new line numbers to copied or moved (or inserted) statements, automatically, with a line number 5 greater than the preceding line number. You can change that increment to any value you desire. Or you can renumber the entire program, starting with any line number you wish, and using any increment value you want.

You can search for a statement, which scrolls the display to any point in your program. Just type in

S270

and the display scrolls so line 270 is at the top of the screen. If there is no line 270, you get a message

NOT FOUND

which is the same message displayed if the editor doesn't find a character string in the program. Type

FC=

and the display is scrolled so that the first line that contains this string (C=) is at the top.

When you are at the first occurrence of a string, you can make a global replace. To change all PRINT statements to LPRINT, just scroll to the top of the display, get into the Extended Command mode by hitting CLEAR and the spacebar, type

FRINT

and the display scrolls to the first occurrence of PRINT. Now get into Extended Command again, type

CLPRINT

and every single occurrence of the string PRINT in the program will be changed to LPRINT.

Macro Keys

CAU's Full Screen Text Editor uses the 26 letter keys in Extended Command mode to insert Basic keywords into programs. The 26 are preprogrammed, from ABS (on the A key to STOP on the Z key. If you like, you can change the character string associated with any key, and use any letter or number combination up to six characters per key.

Renumbering Lines

All you need do to renumber the program is to enter N and two numbers, for the first line and the increment:

N100,5

will renumber the entire program with lines 100, 105, 110, etc. The big thing about this command is that when the editor renumbers the lines, it also changes all line number references within the program to reflect the new numbers.

Loading

Loading the screen editor turned out to be a little different than what the manual specifies. Use this sequence (if you have a 48K TRS-80):

XEDIT48

BASIC

RUN "XEDIT/BAS'

LOAD "SAMPLE/BAS'

XEDIT

That fourth line loads a sample program provided on the tape for demonstrating all the editor's features.

The CAU Full Screen Editor is $29.95 for 16K, 32K, or 48K Model I/III/4, supplied on tape, with instructions for moving it to disk. (It is not available for Level I machines.) The editor on disk is an extra $5. Add $2 for shipping in the U.S. and Canada.

ZBasic 2.2 Compiler

Simutek Computer Products, which offers CopyArt II, a "word graphics data processor' that combines a word processor, graphics, math, sorting and mailmerge (June 1983, p. 304), also has a Basic compiler that may knock your socks off.

Try the following on your TRS-80:

100 FOR X=0 TO 127

110 FOR Y=0 TO 47

120 SET (X, Y)

130 NEXT Y: NEXT X

and see how long it takes to turn the graphics area from black to white. That is about 46 seconds on a Model III.

If you have previously loaded the ZBasic 2.2 compiler, you write the program in TRS-80 Basic as usual, then hit the Z, X, and C keys simulatneously. ZBasic compiles the program in machine language in a trice, then asks if you want to run the compiled version, save it, or return to Basic. Run it, and the screen turns white in a little less than two seconds.

Simutek advertises ZBasic 2.2 as "the world's fastest TRS-80 Basic compiler,' for $89.95 on disk (with both 32K and 48K versions), $79.95 on tape (16K, 32K and 48K versions on the same tape), $99.99 for both disk and tape, and $25 for the manual only.

For each memory size, there are versions (on the same disk or tape) with and without high precision math, which is accurate up to 62 places.

ZBasic is also advertised as "the only interactive Basic compiler for the TRS-80,' meaning that your TRS-80 memory contains both the original Basic program and the compiled machine language version, and you can use either.

By the way, ZBasic was written by Andy Gariepy, whose brother Mike (president of Simutek) wrote CopyArt II with a special version of ZBasic.

Nearly a third of the 72-page manual consists of an annotated list of ZBasic keywords to let you know which are used in ZBasic and how they differ from TRS-80 Basic keywords, if at all. Most are exactly the same, but a few are new or different. Some have the same name as TRS-80 Basic functions, but do very different things.

Some ZBasic Functions

AUTO generates a musical sound, with tone, duration, and frequency parameters, for sound effects or music (in TRS-80 Basic, AUTO renumbers lines automatically).

CDBL performs a very fast search, looking for a particular byte among a specified number of bytes, starting at a given memory location and searching backwards. CINT is the same, but searches forwards.

CONT returns the video memory address of the screen at a given point expressed in graphics point coordinates. DEFB specifies the integer format; all subsequent output statements, such as PRINT, will output the low byte of an integer in hex form. Thus DEFB:PRINT 255 will print FF on the screen.

DEFN is similar, outputting a signed number. DEFU outputs an unsigned number. DEFW outputs the integer as a hex word.

DEFDBL defines specified variables as strings, because ZBasic does all its floating point math in strings.

ERL moves a certain number of bytes starting at a given memory location to another memory location.

FIX performs the XOR function in memory and is a good way to invert the graphics screen, creating quick flashes for explosions or signs or whatever.

LOC returns the present record number.

LSET loads a string into a fielded buffer.

And there are many more. Not supported by ZBasic are ATN, COS, DEFUSR, DEFFN, EXP, INT, LIST, LOG, NEW, SAVE, SIN, and TAN.

The manual goes on to show how to use MERGE to insert machine language code into a ZBasic program, how the PRINT USING function has been made more versatile, how to relocate ZBasic programs, to any part of memory you choose, how to chain ZBasic programs, how to convert Basic programs so they will run in ZBasic (the main difference is the floating point math package and disk I/O,) and how to use the MISOSYS utility for appending or merging compiled programs and machine language programs from tape or disk. (That last one is for 180-proof computerniks.)

ZBasic is fast and good. Programs run from 10 to 100 times as fast as in TRS-80 Basic, Compilation time is typically two seconds for a 4K program.

No royalties are imposed on registered owners who sell (or buy) programs created with ZBasic; they need only give credit to Simutek (with a copyright notice) in the program and in the documentation.

For the fastest Basic you can imagine, try Simutek's ZBasic 2.2 on your Model I, III, or 4. It works with almost any DOS, and could become your most useful program.

Acorn Software

Several programs from Acorn Software Products have been reviewed here, including Astroball, Lost Colony, and Money Manager (Nov. 1982, p. 310).

However, not much has been heard from Acorn recently, because the company that owned Acorn, the Program Store, in Washington, DC, decided to focus on retrailing and get out of publishing.

Acorn was bought this last July by Banbury Books, of Wayne, PA. Banbury publishes mass market books and has just started publishing computer books, such as James Kelly's on the IBM PC.

Banbury will offer some of the previous Acorn programs in repackaged form, and new ones will be added. They will be available in some computer stores, or directly from Acorn.

One program that Acorn offered before, and which will be advertised under the new aegis, is Family Tree, written in Basic for a 32K TRS-80 Model I/III/4; $29.95 on disk. If it isn't available at your local computer store, you can get it for an additional $2 for shipping and handling, from Acorn Software Products.

Family Tree

Family Tree is a genealogical program that lets you set up a database to hold information about each ancestor, including name, date and place of brith, marriage and death data, a comment line, and a number to indicate the person's generation in your family tree.

The information can be printed out in a variety of formats and combinations; you are not held to the standard forms used for genealogies.

The program accommodates direct ancestors only: parents, grandparents, great grandparents, etc., to the limits of your family history, or your computer memory. According to the extensive 20-page manual, "Uncles, cousins, nieces, and second spouses are peripheral to your family tree. However, you may elect to use the "comment' area of your ancestor records to include siblings.'

Running Family Tree

The Family Tree program includes 20 sample records and is set up to show you, through examples, how the program works and how the various records are constructed. When you are ready, you enter your own records in place of the samples.

The first display shows 20 last names and says there is

SPACE FOR ABOUT 224 MORE

The next display is a menu offering a dozen options regarding the first of the 20 family names, which in this case is Smith:

THE SMITH FAMILY TREE

?

1-SEACH BY BURNAME

2-SEACH BY GIVEN NAME(S)

3-SEACH BY YEAR OF BIRTH

4-SEACH BY PLACE OF BIRTH

5-SEACH BY YEAR OF MARRIAGE

6--SEACH BY PLACE OF MARRIAGE

7-SEACH BY YEAR OF DEATH

8-SEACH BY PLACE OF DEATH

9-SEACH BY COMMENT

10-ANCESTRAL CHART

11-PEDIGREE

12-INDIVIDUAL RECORD(S)

0-END SESSION

You can search the Smith tree in nine ways: by surname, given name(s), year or place of birth or death, year or place of marriage, or by comment. Option 10 displays a three-generation chart, based on somebody you select. Option 11 displays a pedigree, which shows a direct line of descent from any ancestor you select to the subject of your genealogy. Option 12 allows you to search your records one by one.

After you have experimented with the sample database and become familiar with the various options, you can start entering your own records, using DATA statements to replace the samples.

There are some limitations, naturally, because of the size to which a family tree can grow. Comment fields are limited to 25 characters. Dates are year only.

On the other hand, some latitude has been built into the search mode. You can search for a first name with only part of it. Thus if you want the record of JOHN PETER, you can retrieve it with J, JO, JOHN, JOHN P, JOHN PETER, PETER, P, or just E (because there are E's in Peter). You can search for a date by the exact year (1892), a decade (189), a century (18). And if you want to list (or print) all your records, ask for the millennium (1).

Once you have started a search, you can refine it at any time. If you ask for all ancestors born in England, and several turn up, you can then ask for only those born in the 18th century to be displayed.

Once you have all the family tree information stored, you can search it in many ways, and then display or print out a variety of pedigrees and three-generation charts.

Migration Map

A novel feature of Family Tree is the migration map. In the pedigree option, you are asked if you want to see an outline map of the United States to show the movement of a particular family line across (or around) the country, generation by generation.

If you ask to see it, the computer draws the map and plots your ancestors by generation number in the state locations in which they were born. Foreignborn ancestors are identified as "born abroad.'

Although of limited use to those who want to keep track of a complete genealogy, Family Tree can be recommended to those who prefer to keep to direct ancestral lines, and to those who would like to computerize the basic outlines of their complete genealogies.

Short Program #45: Random-Number Series

From Port Tobacco, MD, Frederick P. Burggraf writes, "I thought I might pass on an idea I have incorporated in a number of my programs, and which might be of interest to your readers.

"What do you do if you want to generate a series of random numbers in a certain range, so that no number is repeated? For some time, I used the approach in Listing 1.

"That program will produce and print a series of numbers 1-30 with no repeats. Sample times for this process range from 12 seconds to 33 seconds. Clearly, this is too long for many applications. If cardshuffling was going on in a game program, it might take minutes for a 1-52 series to be generated.

"My alternative program is printed in Listing 2. The average time for this program to produce and print the 1-30 series is 2.8 seconds, with very little variation in the sample times.

"In line 40, R1 will point to the beginning of one number in the string. In line 50, DU$ stores a two-character number representation. Line 60 removes the number from the string and reconcatenates. Line 70 stores the value in the array.

"This program can be very useful when the range is specified by an INPUT statement or when counters have kept track of input from tape or disk. A few lines must be added in such cases, to allow NU$ to be built. If N items have been read in from a file, the lines in Listing 3 will generate the NU$ upon which the program above can act.

"Now, by simply merging this into the program, and changing 30 to N in lines 25 and 30, the program will function in a variety of situations where items need to be randomized.

"The program can also be modified to handle larger sequences. The string in line 20 must, of course, be extended to the desired length, and more string space must be CLEARed in line 10. With each additional number added to the string, six more bytes must be set aside. Thus, for a series of 1-52, the total number of bytes to be CLEARed is:

172 (enough for 1-30) 132 (6 bytes X (52-30)) 304 bytes

"The DIM statement in line 25 must also reflect the higher series amount, and the upper number in for FOR . . . NEXT loop of line 30 must take on this new high value.'

Firms Mentioned In This Column

Acorn Software Products 7655 Leesburg Pike Falls Church, VA 22043 (703) 893-0868

Computer Applications Unlimited Box 214 Rye, NY 10580 (914) 937-6286

Simutek Computer Products Inc. 4897 E. Speedway Tucson, AZ 85712 (602) 323-9391

Table: Listing 1.

Table: Listing 2.