Classic Computer Magazine Archive CREATIVE COMPUTING VOL. 9, NO. 5 / MAY 1983 / PAGE 298

TRS-80 programs and applications for the color computer. (book reviews) Stephen B. Gray.

TRS-80 Programs and Applications for the Color Computer

The beginner who has read Radio Shack's Getting Started With Color Basic, but doesn't know where to go from there, can find a variety of applications in TRS-80 Programs and Applications for the Color Computer, by Alfred Baker. Almost every chapter contains games, which range from Home Inventory to a color version of Mastermind, from a checkbook program to Spaceship. All program lines are very nicely annotated.

If not for you, then these three would make a very nice gift for anyone who has gotten a Color Computer and wants to learn how to make real use of it.

Did It Write to Disk OK?

If you have a disk system, perhaps you just assume everything is working fine when you do a SAVE, and don't bother to check. But if you have ever had the experience of trying to LOAD a disk program, only to find that part or all of it didn't get recorded, or somehow was merged partially with another program, then you may want to check every SAVE with a LOAD.

(Most of these problems occur when your disk drive is out of alignment, and your first inkling of the misalignment is likely to be a bad SAVE. But even after you get the drive repaired, you may find, as I did, that it is a good idea to do a read after a write, meaning a checkout LOAD after a SAVE.)

One way of verifying a SAVE is to clear the screen and then do a LOAD, as some books on the TRS-80 suggest. But if you didn't do a PRINT beforehand, you may lose the entire program. This is one reason for always printing your program before doing a SAVE, especially if it's late and you're a little tired; it's amazing how many wrong keys get pressed after midnight. (Assuming you have a printer, or course; one of my main uses for a printer is to put every program of Scripsit text on a readable medium before a SAVE. If this seems like a great deal of work, consider the large number of backup files that have to be made constantly in business applications, just to make sure nothing is wiped out for keeps.)

But even if you did print the program, having to enter it all over again by hand, because the SAVE went wrong, isn't much fun. There is a simple way to look at the SAVED copy without first erasing the original from the screen.

If you use Scripsit, after you have done a

S PROG23 for example, just do a load-and-chain with

L, C PROG23 and the SAVED text will be displayed right after the original. If there is anything wrong with the second text on the screen, you still have the original text.

Checking a SAVEd Basic Program

Reading back a Basic program after you have SAVEd it to disk is a little more complicated than checking a Scripsit text, but it can be well worth the time, especially if you have a long program and suspect there is something wrong with your disk drive. First you write the program

10 CLS

20 X=RND(128)-1

30 Y=RND(48)-1

40 SET(X, Y)

50 GOTO 20

and SAVE it in ASCII format with, for example,

SAVE "PG47', A

rather than in the usual compressed format.

Then renumber the program on the screen with, for example,

NAME 100, 10, 20

which will renumber all the lines starting with line 10, change the first line number to 100, increment the subsequent lines by 20, and renumber line references within the program:

100 CLS

120 X=RND(128)-1

140 Y=RND(48)-1

160 SET(X, Y)

180 GOTO 120

Now merge this program on the screen with the original program on disk, using

MERGE "PG47' (which requires that the original program be stored on disk in ASCII format) and the display turns into

10 CLS

20 X=RND (128)-1

30 Y=RND (48)-1

40 SET (XY)

50 GOTO 20

100 CLS

120 X=RND(128)-1

140 Y=RND(48)-1

160 SET(X, Y)

180 GOTO 120

That may seem like more work than it's worth, but if you have ever wiped out a long program you spent many hours on, you will find it well worth the extra time spent.

Of course, the renumbered program should have line numbers far above the line numbers of the original program to ensure that there is no interference between them. Otherwise some lines from the renumbered program might be inserted between lines in the original program, or worse, replace those lines.

This method for checking a Basic SAVE assumes that you are using TRADOS, which has both renumbering and merge routines. Not all DOS programs have both.

Flippies

What's a flippy? A double-sided floppy, that's what--a floppy disk you can turn over and use on both sides. Who makes them? Well, for one, Omni Resources Corp. (4 Oak Pond Ave., Millbury, MA 01527). For another, Nashua Corp.'s Computer Products Division (Nashua, NH 03061).

There's some controversy about the wisdom of using the both sides of a floppy disk, mostly coming from companies that make floppies, but not flippies. One such company spoke only of the "contamination factor.' Another told me, "When you turn the disk in the opposite direction, you're liable to dislodge dust and dirt particles that have gotten nicely embedded in the felt pad that presses against the disk, and cause hard errors.' But they had to agree that this isn't likely to happen if you perform standard preventive maintenance, changing the pad and cleaning the head regularly.

Verbatim did have a 5 1/4 flippy, but dropped it from their line because of low customer demand. "Most people weren't using the flippies, except for law offices, where they have a lot of text to store,' a Verbatim salesman told me.

Omni Resources, which runs ads in these pages, has no problems with spinning floppies in both directions. When I asked marketing manager Paul Johnson about the story that reversing the direction of a floppy can bring out dirt, he said they had tested what Omni calls "Flip/Floppy reversible' disks for long periods, reversing them over and over, and found no significant excess wear over normal disk wear.

Omni has a network of dealers in the U.S. and Canada. If you can't find one locally, you can get reversible 5 1/4 Omni disks at $39.90 for ten, plus $2 for shipping and handling, from Archive (152 Boston Turnpike, Shrewsbury, MA 01545). Remember to specify what type of machine and disk drive you're using.

Can't you use both sides of any floppy? Yes, but not without some alterations. You have to cut a write-protect notch in the opposite edge of the disk jacket, otherwise you will never be able to write on the second side. Also, you must cut another index hole thru the jacket, so the photocell can detect the light from the LED for sector timing when the disk is turned over. The Omni Flip/Floppies come with two sets of notches and holes.

The head of a software company gave me the details, "You can take floppies and notch them yourself. If you don't write on the disks, you needn't make the notch. You can use a paper punch that makes a round hole for the write-protect notch; it's better for strain relief than the dies used commercially, because the circle doesn't crimp the cardboard as much as the die.'

As for the index hole, he said, "Use the paper punch, open the pocket, and punch holes in the top and bottom. Don't touch the disk itself.'

The main problem with using the other side of single-sided disks is that those other sides aren't certified as being error-free. So you can't be sure they will write data properly, and read it all back. Omni certifies its Flip/Floppy disks to be 100-percent error-free on both sides. For about 1.7 times the cost of a singlesided disk, you can double the storage capacity to each disk by using a Flip/Floppy, and cut your disk-storage space requirements in half. (Omni single-sided double-density disks for the Model III TRS-80 are $23.90 for ten.)

School Newsletter

For several years, a computer newsletter was published for teachers in the Cleveland public school system, which had started to use the TRS-80 computers throughout the secondary schools, and for the educational computer organizations in the area.

Wallace P. Havenhill, who edited the newsletter, tried to publish it monthly, but had to suspend it due to lack of time. He hoped to start it up again, last time we talked.

The first issue, published in September 1979, provided three graphics programs (graphing functions, drawing line segments, and line graphs) with program lines explained; a merge program; and five pages of basic TRS-80 tutorial (with simple programs for hands-on use).

Later issues included information about computer courses given by local Radio Shack stores, tutorials on TRS-80 graphics, a glossary of computer terms, and details of an upcoming computer programming contest.

In his most recent letter, the newsletter editor noted that although the schools had several dozen of the Model I (connected to TV sets with 23 screens) and had ordered a dozen of the Model III, he suspected that "the Color Computer will be a better general purpose educational computer than the Model III or Model I.' (At the time of the first newsletter, he was a math department chairman in one of the junior highs, but as the number of computers grew, he was reassigned "to train teachers to use computers, to develop educational software, and to advise the subject supervisor on what hardware is needed or best suits our needs,' as he put it.)

Hopefully the newsletter was (or will be) resumed but, having published the first personal computer newsletter in the world (from 1966 to 1977), I know all too well the problems of trying to find time, as well as money.

Short Program #38: Screen Editor

This letter with a very clever program came some months ago from Alex Lewin of North Haven, CT:

"I am twelve years old, and have a TRS-80 Model I Level-II with 16K RAM. I was once trying to solve a very complex puzzle on the computer, but I gave it up (it would have taken about 30 hours). Instead, I made a screen editor and solved it easily.

"To operate this program, type it in and RUN it. The cursor can be moved, without harming whatever it passes over, by using an arrow in conjunction with SHIFT. Things may be typed as normally done. Pressing CLEAR will clear everything below the cursor. You may erase single characters by using SPACE or the left-arrow.

"The T in the lower-right corner indicates text mode. To move into graphics mode, press SHIFT G. Typing in three-number sequences will produce the corresponding character. Graphics mode may be exited by pressing SHIFT T or an impossible character (such as 783).'

Line 40 puts a T in the lower-right corner of the screen. Lines 50-60 cause the screen to display the character corresponding to whatever key is pressed, unless the character is SHIFT G (g or ASCII code 103). If it is, then the program moves to line 70, which puts a G in the lower-right corner.

Line 80 counts three key depressions, and lines 100-110 turn the three numbers (if they are between 128 and 191) into a graphics character and display it on the screen. Unless the user presses SHIFT T (t or ASCII code 116), in which case line 100 moves the program to lne 40.

As written, this program, which does a great deal for such a short one, can create text or graphics on the screen but can neither save them nor edit previously written programs. So I wrote Alex to ask what he used the program for. He replied:

"I used the program to solve

DONALD

GERALD

ROBERT

where D=5, and each letter represents one digit (no two letters are the same digit). What I did was this: I set up a chart like this:

5onal5

geral5

robert

and when I found something out about a letter, I replaced it in the problem with the appropriate digit.'

Can you solve the DONALD+ GERALD=ROBERT problem with the screen editor?

Table:

Review Grade: A