Introduction
The Z88 Source Book is designed to be a good reference on the Z88, how to interface it with the world, how to do things with it, what products are/were available, and what dealers carry them. It is not designed to be a replacement for the Z88 User Guide, but as a supplement to it, filling in areas not covered by the User Guide.
This Source Book also comes with a number of utilities and files for the Z88 on QL or MS-DOS disks. Although the Z88 can interface with any computer with a serial port, these are two that I have chosen to focus on. Those who have interfaced the Z88 with other computers can submit the details so that they may be added to this book. All utilities that come with this book are either Shareware, Freeware, or Public Domain and may be freely distributed.
The reason for this book comes from when I was a new Z88 owner and did not know how to get it to interface with any computers. I initially got some help from Dave Bennett, but still had to fumble a bit in the dark. The Z88 documentation assumes that one purchased the QLink, PC-Link, or Mac-Link software and cable and does not discuss the ways to transfer files to another computer. From my initial lack of knowledge came the idea for a Source Book to assist new (and old) Z88 users, including utilities to help.
This book relies heavily on the work of others and their exploration of the Z88. A lot of the information in this book comes from a variety of publications and people. I am indebted to both Dave Bennett and Frank Davis for providing the back issues of various newsletters. Below is a list of publications and persons from which/whom this book is indebted.
Update Magazine, Z88 Fax News, PipeLine, Z88 EPROM, Dave Bennett, Frank Davis, Phil Wheeler, Chris Fenn, and other contributors of Z88 articles to the various newsletters.
Throughout this book I will reference various parts by their Radio Shack Part Number. I’m doing this not because I favor Radio Shack, but because Radio Shack is everywhere and the part number references a specific item. One last item, if you have not read the Z88 Manual all the way through, then I recommend it. In the tradition of other Sinclair documentation, the manual is full of good information, but it’s hiding. A cursory reading of the manual will not reveal all of the neat tricks the Z88 can do.
Conventions
There are a number of keys on the Z88 that are not on other computers. Below is the convention of how they will be used in this book:
[] - Square Key <> - Diamond Key
History
The Z88 started off as the “Pandora” project when Sir Clive Sinclair sold off Sinclair Research Ltd. to Amstrad. It was first introduced in England in June of 1987. It was sometime in 1988 that the Z88 was introduced in the US, being sold by Cambridge North America. The market life of the Z88 was rather limited. After coming on strong in 1988, a number of vendors and magazines started folding around 1990. The official Z88 magazine, “Z88 User”, folded in 1989 after publishing for a year. Cambridge North America folded in 1990 after some rather complicated legal dealings.
When the Z88 was introduced to the US, the reviews in computer magazines seemed to be fairly polarized. Either the reviewer loved the Z88 (like Stan Veit) or wrote it off completely. Most reviewers cited the fact that the Z88 was not MS-DOS compatible as being a large reason why it would not sell. Despite the reviews, the Z88 did sell fairly well to Macintosh users, who did not care about it not being MS-DOS compatible, and were used to paying the high price that some dealers were selling the Z88 for.
PipeDream Tips
Multiple Columns
Change the width of Column A with <>W to 40. Set a right margin of 38 with <>H. Goto Options with <>O. Set justify to Y. Set the page length to what you want. Set Header, Footer, and Bottom to 0 and Left to 2.
Editing is more difficult with multiple columns, so 99% of the editing is done with the text in column A. Any insertions and deletions of lines of text must use the commands <>EIRC and <>EDRC. <>N and the <>Y insert and delete in ALL columns.
Now you are going to separate and move your text into column B. There will be a jagged line across the column where you previously set the page length. Now move the cursor one line past this marker. Type <>Z and then move to the end of the text with <> and Down Arrow. Type <>Z again. All the selected text will be highlighted on the screen.
Press TAB to move your cursor to Column B and use the arrow keys to put the cursor where you want the moved text to start. Now type <>BM for Block Move. Your selected text will be moved to your cursor position.
BBC Basic Tips
The Z88 Manual is very terse on how to program in BBC Basic. It discusses the commands, functions, and operators of the language, but does not cover how to put these together to construct a program. For the experienced Basic programmer BBC Basic should be fairly familiar. For the novice, it is a more daunting task to put together a program.
A full discussion of how to write a BBC Basic program is far beyond the scope of this book. One way to learn BBC Basic is to go over the Basic programs included with the Source Book. They should provide you with a fairly good set of examples of how to do various tasks in BBC Basic. There are a few books on BBC Basic:
“Using BBC Basic”, P.J. Cockerell, 1983, John Wiley and Sons (ISBN 047190242X).
“BASIC Programming on the BBC Microcomputer”, Neil & Pat Cryer, 1982, Prentice Hall.
“BBC Basic Reference Manual for the Z88”, D.J. Mounter
The first two books were designed for the BBC Micro and some portions of the text will not apply to the Z88 version of BBC Basic. They are good starting points for the novice programmer. Optionally, a novice programmer could pick up a book on general Basic and translate the examples to BBC Basic.
Star Commands
There are some commands that are not documented in the Z88 User Manual that are covered in other Books.
*CLI – Execute CLI Commands.
10 *CLI #F – invokes the Filer.
*DELETE – Delete Files.
10 *DELETE pd/file – Deletes file in the pd subdirectory.
*ERASE – Same as *DELETE.
*REANME – Renames a file. Execute it just like *DELETE.
*NAME – Assigns a name to a BASIC program.
The VDU Command
A number of less documented features of BBC Basic are accessed via the VDU command. The VDU command is almost equivalent to the CHR$ command. VDU X = CHR$(X). Using the command VDU 65 will print out the A character ( A = ASCII 65). The ASCII codes from 0-31 and 127 will perform special tasks with the VDU command. Not all of these VDU commands are documented.
Some of the VDU commands are documented in the BBC Basic book by P.J. Cockerell. Most do not apply to the Z88 since they are graphics commands. One is completely different than that used on the Z88. The following VDU commands are not used on the Z88.
VDU 17 Color Control VDU 19 Actual color to logical color VDU 22 MODE Command VDU 23 Create User Defined Characters (see below) VDU 26 Restore Default Windows VDU 28 Define Text or Scrolling Window VDU 30 HOME the Cursor VDU 31,x,y TAB(x,y)
The following subsections document the known Z88 VDU commands.
This includes screen controls, sound, and user defined graphics.
Screen Control Codes
The Z88 has a number of codes that are used to control the screen and to print special characters (ones not on the keyboard). Remember VDU X is the same as CHR$(X).
VDU 8 Move cursor Left
VDU 9 Move cursor Right
VDU 10 Move cursor Down
VDU 11 Move cursor Up
VDU 1,32 Three Dots
VDU 1,33 Bell Symbol
VDU 1,39 Backwards Apostrophe
VDU 1,42 Square
VDU 1,43 Diamond
VDU 1,45 Shift Symbol
VDU 1,124 Upright Slash
VDU 1,142 Block
VDU 1,224 Space Symbol
VDU 1,225 Enter Symbol
VDU 1,226 Tab Symbol
VDU 1,227 Delete Symbol
VDU 1,228 ESC Symbol
VDU 1,229 Menu Symbol
VDU 1,230 Index Symbol
VDU 1,231 Help Symbol
VDU 1,240 Left Key Arrow
VDU 1,241 Right Key Arrow
VDU 1,242 Down Key Arrow
VDU 1,243 Up Key Arrow
VDU 1,244 Thick Left Arrow
VDU 1,245 Thick Right Arrow
VDU 1,246 Thick Down Arrow
VDU 1,247 Thick Up Arrow
VDU 1,248 Thin Left Arrow
VDU 1,249 Thin Right Arrow
VDU 1,250 Thin Down Arrow
VDU 1,251 Thin Up Arrow
VDU 1,ASC("B") Bold Characters
VDU 1,ASC("C") Toggles Cursor
VDU 1,ASC("D") Slows the Display
VDU 1,ASC("F") Flash Characters
VDU 1,ASC("G") Bright Characters
VDU 1,ASC("R") Inverts the Screen
VDU 1,ASC("S") Screen Scrolls from Top to Bottom
VDU 1,ASC("T") Small Characters
VDU 1,ASC("U") Underlines Characters
Key Codes
Sometimes it is necessary to know the codes that keys generate. To find out what codes a key press generates, enter the following program:
10 PRINT "Hit Key or Combination";
20 Z$ = GET$
30 PRINT Z$,ASC(Z$)
40 GOTO 20
The Diamond <> Key acts like a CTRL key.
Key Alone Shift Key Ctrl Key <> UP 0, 255 0, 251 0, 247 DN 0, 254 0, 250 0, 246 RT 0, 253 0, 249 0, 245 LT 0, 252 0, 248 0, 244
Other interesting codes:
CTRL TAB 0, 194 CTRL DEL 0, 195 CTRL 28 CTRL = 0, 0 CTRL - 31 CTRL ] 29 CTRL ` 96 CTRL [ 27 CTRL ENTER 0, 193
Line Graphics
The Z88 is capable of producing “IBM style” line graphics. These are generated by VDU commands in the following form:
VDU 1,ASC("2"),ASC("*"),ASC("char")
where char is a letter in the range A to O.
Here is an example program:
10 Z=65
20 REPEAT
30 VDU 1,ASC("2"),ASC("*"),Z
40 VDU 9
50 Z=Z+1
60 UNTIL Z=80
Sound
The Z88 is capable of limited sound. Variations can be made of the Z88’s beep. Below are three examples to experiment with:
VDU 1,52,33,38,34,34
VDU 1,52,33,34,33,34
VDU 1,52,33,40,33,33
User Defined Characters
The Z88 has the ability to have up to 64 user defined characters. Characters can be defined from CHR$(64), the @ symbol, to CHR$(127), ESC. They are defined in the following format:
VDU 1,138,ASC"=",ASC"char",n0,n1,n2,n3,n4,n5,n6,n7
where char is the ASCII character that this new character is assigned to. n0 through n7 are the decimal equivalents to the binary code defining the character.
The characters are defined in a 6 column by 8 row matrix. The rows are defined by the numbers n1 to n7 in downward sequence (n7 is the bottom row) and the columns are defined by the six lower bits of the binary form of these numbers (bit 0 is the right-most bit). It appears that the setting of the two highest bits is not important.
Here is an example of a Smiley Face character:
Binary Decimal 0 0 0 1 1 0 1 1 27 <-- n0 0 0 0 1 1 0 1 1 27 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 4 0 0 0 0 0 1 0 0 4 0 0 0 1 0 0 0 1 17 0 0 0 0 1 1 1 0 14 0 0 0 0 0 0 0 0 0 <-- n7 | | -- Blank Column for space between characters
Printing HEX Values
Using a tilde (~) with the ASC command in a print statement will print out the HEX value of the character being operated on. ~ASC”A” will print out the HEX value of the character A (41). ASC”A” is 65.
PRINT "A", ASC"A", ~ASC"A"
will produce: A 65 41
BASIC Inline Assembler
BBC BASIC on the Z88 comes with an inline assembler built in. The variable P% is used as a program counter. The user must set P% to the desired start point for the machine code before invoking the assembler. The assembler can be invoked with the [ symbol on a single line. It is uninvoked by a ] on a single line. Below is a sample program:
10 DIM code 100
20 P% = code
30 [
40 LD BC,50
50 RET
60 ]
It is recommended that the user have a good knowledge of Z80 machine code programming before trying the assembler. Locking up your Z88 could cause it to do a hard reset (take it to a “virginal” blank state).
A Hint on the OPENUP Command
The command OPENUP (OPEN for UPdate) is a little odd on the Z88.
The typical syntax might be:
10 F% = OPENUP(F$)
20 PRINT #F%,G$
But this will result in the current contents of F$ being overwritten, not appended. To OPEN for APPEND, you need to move the file pointer to the end of the file:
10 f% = OPENUP(F$)
20 PTR #F%=EXT #F%
30 PRINT #F%,G$
This will add G$ at the end of the file, instead of overwriting the existing contents.
Reading the Serial Port
Here is a short BASIC routine that demonstrates how to read the serial port.
10 channel% = OPENIN(":COM.0")
20 BPUT# channel%,outputbyte%- set byte
30 inputbyte%=BGET# channel% -read byte
Testing the Speed of the Z88 in Basic
Benchmark speed tests are standard ways of comparing different computers in relation with each other. I have converted one benchmark program from the QL to the Z88. It’s a fairly simple prime number calculating program, originally written by Duane Parker to test out different compilers and languages on the QL. I use it here to compare the Z88 with the QL.
The QL is known for having a slow display. I ran the benchmark on both computers with the output of the program being displayed and not displayed. The key thing I found out from this test is that the Z88 does not suffer a slow down when outputting information to the display. The results for the Z88 were the same on both runs.
The benchmark determines all of the prime numbers from 32767 to X, where X is less than 32767 and greater than 0. In the benchmark tests that I ran, I had the program determine the primes from 32767 to 29000. These were the same numbers used in earlier tests with the benchmark. Using the fastest Z88 and QL times, the Z88 ran the benchmark in 326 seconds and the QL in 229 seconds.
This means that the QL is 1.4 times faster than the Z88. Considering that the QL is running a 68008 at 7 MHz and the Z88 is using a Z80 at 3 MHz, the Z88 does fairly well.
The program is as follows:
10 PRINT "Stop Calculations at what
value less than 32767?"
20 INPUT V
30 P = 32767 DIV 100
40 IF V>32767 OR V<0 THEN PRINT
"INVALID": GOTO 10
50 PRINT "Primes < 32767 & > ";V
60 A$ = TIME$
70 FOR I = 32767 TO V STEP -2
80 FOR J = 3 TO 191 STEP 2
90 IF (I MOD J) = 0 THEN GOTO 140
95 NEXT J
100 IF (I<P*100) THEN PRINT : P=P-1
110 PRINT I;" ";
140 NEXT I
150 B$ = TIME$
160 PRINT A$
170 PRINT B$
Cables
The serial port is the primary way to get data into and out of the Z88. Below are cable diagrams for linking a number of computers, a modem, and a printer.
Cable Making Hints
I have found through experience that a cable may not turn out the way I feel it should. When I first made my Z88 cables, I used standard 9 wire cable ( about 3/8″ wide). This was what I expected a cable to look like. Well, after using them for a few years, I found the cable too thick and unyielding to use.
After some thinking, I remembered some serial cables that were built with phone wire. Phone wire is flexible and easy to use. Since I had a few extra phone cords running around, I snipped off the RJ-11 jacks and soldered some 9-pin D ends and away I went.
Phone cable comes in 4- (RJ-11), 6-, and 8-wire (RJ-45). For connections to other computers, I found 4 wire to be fine. For a printer or modem cable, you will need either 6- or 8-wire, which may be harder to find.
Also, make your cables plenty long. I thought I had made mine long enough, but I found out how wrong I was when I went to use them. The distance from the back of your computer to a space right next to it (for the Z88) is longer than you think. Be on the safe side and make them long.
Cable Diagrams
Z88 Z88
--- ---
2 ----------------- 3
3 ----------------- 2
|-4 4-|
|-5 5-|
6 6
7 ----------------- 7
8 ----------------- 9
9 ----------------- 8
Z88 QL SER2
2 ----------------- 3
3 ----------------- 2
|-4 ----- 4
|-5 | 5
6 | 6
7 -----------|----- 7
|-8 ---------| 8
|-9 9
Z88 MAC
--- ---
2 ----------------- 5
3 ----------------- 3
5 ----------------- 1
7 ----------------- 4
8 ----------------- 1
9 ----------------- 2
Z88 PC DB25
--- -------
2 ----------------- 3
3 ----------------- 2
|-4 4-|
|-5 5-|
6 6-|
7 ----------------- 7 |
8 --------| 8-|
|
|-------- 20
Z88 PC DB9
--- ------
2 ----------------- 2
3 ----------------- 3
4 -| |- 7
5 -| |- 8
7 ----------------- 5
8 ----------------- 4
9 ----------------- 6
Another way to do it is to use the DB25 cable and a 25 pin to 9 pin adapter (on the PC end). These adapters are easy to find at most computer stores.
Z88 Modem --- ----- 2 ----------------- 2 3 ----------------- 3 7 ----------------- 7 5 ----------------- 20 8 ----------------- 20 9 ----------------- 20
Here is an alternative modem onnection.
Z88 Modem --- ----- 2 ----------------- 2 3 ----------------- 3 4 -| 5 -| 7 ----------------- 7 8 -| 9 -|
To be continued