Since our publication of Wilf Rigter‘s WRx16 high-res discovery (SWN Vol. 4, #2), several enterprising folks have been hard at work, developing new refinements in high-res and other “cheap video”. Mr. Rigter worked up a new version of the “core,” overcoming some previous hardware limitations. Gregory C. Harder, W. C. McGrath, and undoubtedly many others have made other discoveries. I worked up a couple “Interesting, maybe even useful” routines presented in this article.
But whoa! our esteemed Editor (and probably most other folks) thinks that this is going to be yet another of Fred’s incomprehensible but presumed sensible high-tech ravings. Not at all. This is a “play by doing” thing that let s you do neat things with those little TS1000’s or TS1500’s.
There WILL be theory sections, for your information later on, once you feel the urge to go beyond basic experimentation. The possibilities are many and varied, but there are some inevitable limitations. The theory sections will help you learn to more fully control your machine’s video.
For now, though, skip these sections and just enter, enjoy, and play with the demos.
HISTORY
To make a long story short, high resolution has always been possible on the ZX81/TS1000. It has also, somehow, always seemed out of reach, ignored, or both. Until WRx16.
In 1986, Wilf Rigter demonstrated a system of high resolution display to the Vancouver Sinclair User Group, one of the most if not THE most active ZX81 hardware group in existence. The ZX computer had just a little tack-on board, and it produced high-res screens. No internal mods were needed.
It later resulted in the commercial high-res version of SINC-ARTIST (Callisto Software) dubbed THRUST by its distributor, Weymil Corp. Because of the large number of “Hunter” board owners, the program found its way to many users, and became a classic “must-have” for this machine. It represents the entry-level of high-quality graphics development, giving you an Artist program with many features of programs for larger machines.
The rest is “history.” When we ran it over a year ago, we had no idea that this would stir as much of a resurgence of interest in the ZX81. One short 79-byte program and a small memory board, and it makes this computer once again a viable tool in a world of IBMs, Ataris and others. The saga continues….
DESCRIPTION
WRx16 is a system of high-resolution (256×192) display using simple multi-purpose hardware; a suitable non-volatile 8K static RAM, such as the one we ran in SWN 4:1. What’s more, programming for it is comparatively simple. An Extended BASIC is available, and several applications have sprung up using this system. There are even programmers working with this in the U.K. It should be interesing to see what they come up with.
Here and now, there are yet more vistas in display exploration for the ZX81-family. Some will allow the creation of a windowing 128-line Editor routine, which allows instant horizontal scrolling of the 64-column window. New possibilities for modemming exist, involving the use of a 1200-baud modem for the machine. All at very low cost.
On that subject, the VSUG newsletter, ZX-Appeal, reports in the Feb-Mar ’88 issue that TS1500’s with TS2040 printer are available for as low as $30 from Electronic Surplus Inc. in Cleveland. This, plus a small static memory board, is a small investment for a high-res-capable learning system. You can even do “real work” with it, as communicate to BBSs and info services. In the future, you will be able to do far more.
HARDWARE
What do we mean by “suitable static memory?” This is the only thing that might be construed as a “catch.” Fortunately, you have several options.
1: Modified Hunter board. See the Theory section for the mod. It just involves soldering two small, cheap parts, and cutting one trace of the board. This popular device was sold into the thousands years back, and is still a popular commodity to haggle over with other users.
2: Built-in NVM. See SWN 4:1, for a circuit worked up by Wilf for Gerd Breunung, who developed it into a truly professional construction article. This just plugs into the 2K RAM socket on the board, with seven small wires to connect to the circuit board. No trace-cuts are necessary, if you are concerned about that but aren’t afraid to do a little “kitting.”
NOTE: If you haven’t already built and debugged this little project, here’s some more motivation for you. We’re working up a way of easily adding another 32K of static memory. By adding another chip, this same tiny board can now be a real powerhouse!
3: Tim Stoddard‘s 64K RAM. This was published in Time Designs Magazine and (in abbreviated form) in Computer Shopper. This is a neat modification to your ZX81/TS1000 that fills the full 64K with static memory. It requires several trace cuts and jumpers, so may not be up everyone’s alley. TDM also ran Tim’s article on interfacing the Larken DOS to the high-res system, which should be applicable to any RAM arrangement.
An important note: All developments to date assume static RAM in the entire 8-16K region. If you wish to use other things that use this memory, you will need a way to disable either conflicting device.
4: Commercial alternatives. I sell an update of the Hunter board, using 1-8K I.C. instead of 4-2K chips. Being more cost-effective, I can sell it for less than the price at which the Hunter board sold. However, I ask that you allow me at least several weeks for delivery, since parts availability seems to be a chronic problem.
A better bargain for many users will be Wilf Rigter’s own 32K NVRAM. He also worked up a very good RAMDOS for it, allowing you to keep an entire collection of short programs (or a couple long ones) for instant availability when you power up. It is easily re-mappable, using a series of DIP switches, to result in virtually unlimited options with other hardware. You can even enable RAM in the ROM region, and modify the operating system to your heart’s content. Note, the character sets cannot be modified.
MOVING ALONG
So you have the basic picture. Why is this worth doing? Have someone at your local group demo this for you. You might just be amazed. There’s already a lot of great software commercially available or in public domain. There are entire collections of interesting pictures available. You will step into the world of “real computing” with a small inexpensive communications device.
Yes, communications. I didn’t say “computer” because that can be a scary word. [You REALLY have to be wary of people like me, who often refer to “the machine” in articles.] You can’t use a computer if you cannot see what’s going on, or otherwise communicate with it. WRx16 improves your vision by a factor of 16. The resolution is just as good as the TS2068, in normal display mode, except without the color. The quality of the display much better; it is clear and rock-steady on any reasonably good monitor. For people who, like me, don’t have a NEED for color in a “serious” computer, its lack is actually an advantage because of the resulting simplicity.
In a future installment we’ll tackle the last remaining gripe against the machine; its speed. The result will be a machine (preferably TS1500) running almost twice as fast as before (in SLOW mode), with full software compatability. All at a cost of only a few dollars. Add a couple more bucks for a switch, and you can use either mode. There are even software-only methods, such as “Quick” mode in SWN 5:2. At this writing we are investigating even far more significant possibilities for speed (and possible resolution) increase.
LET THE FUN BEGIN
In this first article of a possible series, we present a new WRx16 core. This overcomes several (virtually all) limitations of the original routine published in SWN 4:2. This is a GOOD THING TO DO to your existing WRx16 software, since it makes it usable with a greater range of hardware combinations. New programs should use this routine to prevent problems later.
I’ll also demonstrate a couple interesting alternatives, using demos that you’ll find in the listings.
The goal is to make you want to understand it all better, and before long you’ll be poring over the theory section and your ROM disassembly, etc. Don’t be afraid to experiment. You will then be on the fore-front of a wave of development that may yet result in a very inexpensive yet competent personal communications computer. This wave has already seen working prototypes of easy-to-use 256K bank-switching. It promises new hardware advances in display resolution. It can be made operable at low power, making it an interesting and useful tool, midway between the lap-top and the desk-top. It combines some advantages of both, at a fraction of the cost of either.
Best of all, (I’ve been saving this little tidbit all this time), your machine will be virtually always be repairable. We’re working on ways of building such “Super-ZXs” onto a single board, containing NO custom chips! (If you don’t believe that it’s possible, look at a ZX80 schematic!) So even if your Timex ULA or SCLD goes out, your machine can still live on. You can afford to devote interest, time and money into a device that can greatly enhance your personal productivity. You don’t have to wonder if your computer will still work next week. Now isn’t that a pleasant thought in trying times?
WRx16 VERSION 2
The WRx16 core that we published in 4:2 works fine with the usual 16K RAMpack on a ZX81/TS1000. It also works, with two restrictions, on most 64K packs. The first is that the dynamic RAM should preferably be switchable in the 8-16K region. This restriction still exists on the new version; we can’t do much about that. However, even some RAMs that can’t be switched out here, will work in spite of the apparent conflict.
The other restriction is that we had to take special measures in software to ensure that a portion of the high-res system be copied in the top 16K block. This can get messy, since it will corrupt any other data you might have up there.
WRx16 Version 1 does not work at all with certain hardware combinations; e.g. the TS1500 alone (without external 16K pack), and the Memotech 32K pack alone. Both will work if a standard Timex 16K or similar pack is added.
Refer to the Theory and Listing 1 (disassembly) to understand why this is.
The new routine, refined by Wilf Rigter, took a few more bytes than the original routine. I (fn) then did a little byte-pynching to make it fit into the same space as before. It can therefore replace existing software, such as the utilities and demo given with the original article.
ENTERING THE NEW ROUTINE
If you entered the version 1 demo, your task is much simplified. Use the loader (GOTO 9000) to enter the values of Table 2. Use START=16514, BYTES=128 just as when filling the 1 REM line in the original article. If you prefer, use Hot Z and Listing 1 instead. After saving the new version to tape in case of bugs, run the demo. It should work as before. The difference is that it will work with virtually any memory configuration. (Including 2K, incidentaly, provided the necessary 8K static RAM is present.)
If you’re new to this, follow the article in 4:2, replacing Table 1 with the version presented here.
THEORY
WRx16 V1 will not work if the 48-64K block is fully decoded. This is because it relies on the high-memory echo of the dummy display file. If this is not present, either in “echo” RAM or in real RAM (as 64K), the routine crashes. With 64K, we can physically place a copy exactly 32768 bytes higher than the “actual” dummy display file in the 16-32K region. However, with either of the 32K configurations mentioned above, the 48-64K region will be truly blank; no RAM, and no echo of the 16-32K block either.
More precisely, only the last two bytes of the DDF need exist in high memory. To understand why, let’s review how the line-scanning system works. On receiving an interrupt, the main display loop is started. After taking care of housekeeping (counting lines), the program jumps to the high-memory echo of the dummy display file. When an M1 cycle (instruction fetch) occurs with A15 high (original ZX81) or A15 and A14 high (TS1500 or ZX81 with “Oliger mod”), the ULA takes over control. It uses the (previously set) I and R regiters as a pointer to the address (in low memory, i.e. bit 15 is held low) being displayed. This is what causes the hardware to read the contents of memory directly during the refresh interval provided for dynamic RAMs. This is why we have to AND REFSH* and RD* when controlling the SRAM’s chip select. (On the Hunter board, for instance, cut the trace from RD* to CE*, bridge the gap with 4.7K, add diode from CE* to REFSH*, cathode towards REFSH*.)
The final result on the data lines is then fed serially to the TV. Meanwhile, the CPU gets fed NOPs (00h) instead of the true contents of the instruction being “fetched.” It therefore delays for 4 t-states, exactly the time it takes to display 8 horizontal dots. (Have you ever wondered why the clock crystal’s frequency is twice the CPU clock frequency?)
This process continues until all 32 horizontal bytes have been displayed. At this point, the code of the instruction being fetched will have bit 6 high. (Commands like HALT, used in the normal display system; RET, used in quasi hi-res routines, and JP as in WRx16 V1 all have this in common.) This is a signal to the ULA that display is complete, and it returns control to the CPU. The CPU then executes the command.
The problem with JP is that during the data-fetch part of the cycle, when the address to which to jump is being obtained, the CPU will still think it is running in high memory (PC has bit 15 high). If the RAM is fully decoded, (i.e. no “echo” or duplicate of the low-memory copy) it will only find garbage there, and jump to some uncharted never-never-land.
Version 2 fixes this by using JP (IX) to return the line-scanning operation to the main program, instead of a JP to a fix address. This way, there is no data fetch after the instruction fetch, and the high-memory echo is no longer requird. (Note also that JP (IX) meets the requirement of having bit 6 of the opcode set.)
To compensate for the difference in timing that results from using this approach, some of the “delay” commands had to be changed. This moves some of the entry points, and is why we are presenting the new routine in its entirety. The timing is about the only thing that could mess you up in experimenting. It is very critical, and has to reach certain key points at exactly the right T-state. So if you change anything, you have to be careful that the timing of your new code matches that of the old. You do this by trimming the dummy timing commands. These are marked in the listing as DELY, and timing loops are marked TILO. Get out your Zaks handbook or other Z80 reference, and keep track of T-states.
Finding suitable timing values with a minimum of required space, while not interfering with your program, can be quite an interesting challenge. Beware of some, like RRD, which appear to be great, compact time-consumers, but may not do what you expect (RRD and RLD operate on (HL) as well as A).
THE AMAZING BI-PLOT
We all know, of course, that the daffy-nition of BI-PLOT is “the purchasing of a devious plan.” Or any number of other bizarre things, which I’ll leave you to decipher.
Ah, but let’s get back to the real world. This article gives a demo of a way to do high-resolution grey-scale graphics. That’s right! Though I may be stretching the definition, we’ll actually see the ZX81/TS1000 display a high-res scale of three shades – black, white and grey. A quote I just invented runs, “Three shades doth verily a grey-scale maketh.”
We’ll once again use bizarre methods to put that remarkable ZX hardware/software combination to work, deviously planning to make it do things even that IT never thought possible. Best of all, you won’t have to purchase a thing (assuming that you’re with us so far on this high-res stuff).
For the sake of the demo, let’s go back in time. Way back…. do you remember SWN Vol. 1, Kids? This contained a lot of (sometimes embarrassing) “early Fred Nachbaur,” including a “GreyPlot demo” that I also used in my CE-AMP program (now in shareware). Well, what could be better than to repeat that early demo, using this modification of WRX16?
WHAT IT DOES
BIPLOT works much like “QUICK” mode (SWN 5:2) does, in the sense that it uses the built-in FRAMES counter (FRMS in Hot-Z-ese) to display different things in alternate fields of the TV display. Unlike QUICK, though, we have a continuous display, even though the speed is no faster than normal SLOW mode. (The good news is, we can use FAST mode to do all our plotting, then get into compute-and-display mode to view and play with the result.)
The way we do it, is to toggle between two different high-res display files. Anything plotted in both display files shows up as black (or white in inverse mode). Anything plotted in only one display file will only be displayed every other time. As a result, these points will look “grey.” Anything else is in the background color (white or black, in normal and inverse modes respectively).
In the demo, two sets of axes are drawn, one in each display file. However, different horizontal axes are printed just for demo purposes. Two different functions are plotted into each of the display files; their product is printed in both.
After the display has been created, you can view either hi-res display file, or both. You can also reverse the video at any time.
THE DEMO
This demo displays several of WRX16’s unique features:
1: Bit-mapped video file. This makes our plotting, etc. extremely compact (the whole mini-operating system takes less than 256 bytes). It’s memory-mapped, allowing us write to it from BASIC, using POKE.
2: Any or all vertical columns can be reversed. To reverse a column, change the corresponding element of the dummy display file to 128 (decimal). Our “reverse” (RVRS) routine simply toggles all 32 locations (columns) between 0 and 128 whenever it is called.
3: WRx16 is extremely adaptable. We can change the number of hi-res and low-res lines at will. We can do different things in different fields of the TV display. We can even do “QUICK” mode! (Topic for a future installment, if the interest is there.)
4: Since a full hi-res bit map of a 256*192 screen takes 6K, and we only have 8K available, we have to cut down the size of the hi-res portion to 2/3 of its full size. This gives two 4K blocks that can be used for two display files. With the high-res display files in high memory (as with Tim Stoddard’s setup or with Delta), these could possibly be brought back to full size. However, this version demonstrates yet another neat trait of WRx16: you can display any combination of hi-res/low-res rows on one screen.
ENTERING THE PROGRAM
THE EASY WAY
One way to do this one is from the ground up. However, if you have followed the demos so far, you can save some time. Load the demo program of 4:2,
To be concluded next month
From ZX-Appeal, Vancouver SUG, April, 1988