Graphics And Programming Utilities For Sinclair/Timex
Arthur B. Hunkins
Softsync, publishers of high-quality software for Sinclair/Timex, has recently released two useful utility packs for the 16K Sinclair line – Programmers Toolkit and Graphics Kit. The two "kits" are compatible; i.e., they are designed to be used together (though they need not be).
Both are in machine language, hidden away – protected – in high memory. Programmers Toolkit occupies the top 1K; Graphics Kit requires an additional 1K-plus. The packages are not user-relocatable, no doubt in part because allowing this option would have compromised security; these programs are well protected.
Graphics is a collection of 23 graphics routines; Toolkit includes eight utilities. The nature of the packages is evident from their titles. The individual routines are quite useful, provided one doesn't expect too much from them. They operate by calling USR, often after POKEing specific information into key memory locations. This procedure is somewhat unwieldy, requiring you to remember – or constantly refer to – many different memory locations (i.e., five-digit numbers). Graphics Kit has no ready reference guide to these locations; the documentation for Toolkit is better in this regard.
The Most Important Routine
The software is well-written throughout. Aside from its cumbersomeness, I find only one thing to criticize about Toolkit: it omits a repeat key routine. Perhaps a repeat function was not considered appropriate for the package, but it surely would have been useful. I can't think of any utility that would do more to facilitate programming on the Sinclair/Timex.
The most important routine in Toolkit is Renumber. This routine renumbers an entire program, with any starting line number and any increment (default values are 10). It handles GOSUB and GOTO; the only difficulty – and something of a nuisance – is that GOTOs and GOSUBs must be four-digit numbers. If they are not, the routine ignores them.
Perhaps next most useful are Search And List and Search And Replace. The former lists line numbers (not entire statements) where a designated character is found; the latter replaces all occurrences of one designated character with another. Equally handy is Free, which prints the number of bytes free at any given point.
Reverse and Fill affect a specified number of lines on the screen, starting with the topmost line. Reverse inverts the field of the area; Fill fills it with any specified character. There is no provision for reversing or filling partial lines, or implementing any other kind of screen partition.
Probably the most fascinating routine is Hyper-Graphics Mode, which changes the start address of the character table. A demo program illustrates the "exploded" characters that result; clearly Hyper-Graphics is an entry into the intriguing world of user-created character graphics. Unfortunately, no further software is offered; let us hope that Softsync soon releases additional tools.
Finally, Wait does a program "hold" until it senses input from the cassette player, whereupon the BASIC program is continued. Toolkit's documentation includes a set of short programs that nicely demonstrates the various utilities.
A Wealth Of Useful Aids
It is difficult to select highlights from Graphics Kit. There are a wealth of useful routines here; most are well illustrated in the demo program included on tape. The demo is impressive, and would serve well as a repeating window display. Perhaps the best way to become familiar with Graphics is to study and work with this program. It is entirely in BASIC. Note at the outset that Graphics Kit has no high-resolution capability, nor does it permit you to create your own character set.
It does, however, allow you to define your own multi-character shapes, and to Draw or Undraw (erase) them anywhere on the screen, using PRINT AT. Draw, probably the classiest utility of the package, lets shapes be defined in REM statements, using the usual graphics characters and a system of "cursor controls" (directional arrows).
One useful feature that appears in the demo, but is not referred to elsewhere, is the quote character (″), which serves as a cursor blank (in place of the space). There is a difference; "background" shows through the cursor blank, while it does not for the space. The demo shows a worm marching ("crawling" would be stretching a point) along the screen, behind a cactus and in front of a background. Not spectacular, but not bad either.
A number of other routines also "do" and "undo" various features: Foreground On, Foreground Off; Border, Unborder; Onscreen, Offscreen; Background On, Background Off. Foreground On is especially interesting, as it "protects" everything currently displayed, causing graphics added later to "pass behind" the protected display. Background On works on a related principle; it creates a background of a specified character upon which everything else is projected – including Foreground and other characters.
Thus a simple three-dimensionality is created. Background can include one or both edit lines, if desired. In general, Graphics routines can use or exclude these lines at the user's option. Most routines optionally permit working with fewer than 20 lines.
Border places your choice of character around the outside of the screen. Offscreen blanks the screen to its normal background color (not black), while saving its contents. The documentation stresses that Fast is not used in this operation.
A multi-directional scroll capability is also most attractive. Upscroll, Downscroll, Rightscroll, and Leftscroll move the entire screen display (with wrap-around) one position in the appropriate direction for each call. Edit lines are included in the scrolling. The documentation is correct when it states "characters ... will wraparound ... except when Border is on."
When a border is present, it normally does not scroll; in reprinting itself, it erases any scrolled material it encounters. What the documentation fails to mention — the demo illustrates it admirably — is that there is a location to POKE that permits any border to scroll appropriately along with everything else. The required statement is: POKE 31743, 0. Now watch it go!
Editprint changes the current print position to the first of the two edit lines. This change is for a single PRINT only; the following PRINT reverts to the normal placement unless Editprint is called again. Square is a handy utility that draws squares and rectangles according to two sets of coordinates — one specified by PLOT, the other by a pair of POKEs. The width of the line is one-half character.
Other miscellany regarding Graphics: Graphics routines use Slow mode only; and substantial error code recovery is implemented. These codes are nicely summarized, in tabular form, in the documentation. Error recovery is not available in Toolkit, where it is not nearly as important.
I discovered no program bugs, and — with minor exceptions — found the documentation quite satisfactory. When instructions for LOADing are precisely followed, all goes well. I particularly recommend Graphics Kit and its well-done demo program as helpful tools for exploring the Sinclair/Timex graphics capabilities.
Programmers Toolkit Graphics Kit
P. O. Box 480, Murray Hill Station
New York, NY 10156