Graphics and the Z88

See all articles from CATS v6 n6
Author(s): Peter van Dijk
Publication: CATS Newsletter
Pub Details: CATS v6 n6 (Volume 6, Issue 6)
Date: September 1988
Pages: 5

The Z88 has no facilities to show graphics on its screen. But in combination with a QL it is possible to get graphic output from a Basic program, run on the Z88! What you need is a cable from the Z88 to the SER port on the QL and the TURBO compiler to compile a little program on the QL.

The Superbasic program for the QL is shown below:

100  DIM A$(1),B$(256)
110 OPEN#3,SER2:B$=' '
120 COMMAND_LINE
130 TYPE_IN"INK#0,0:"&CHR$(10)
140 REPeat loop
150 A$=INKEY$(#3)
160 IF A$=CHR$(13)
170 A$=INKEY$(#3)
180 TYPE_IN B$&CHR$(10):B$=A$
190 IF A$=CHR$(163): EXITloop: END IF
200 ELSE
210 B$=B$&A$
220 END IF
230 END REPeat loop
240 TYPE_IN"WINDOW#0,512,5[illegible],0,206"&CHR$(10)
250 TYPE_IN "INK#0,7"&CHR$(10)
260 CLOSE#3

This program monitors SER2 and redirects every string it receives to Superbasic channel#0 as if it was typed in on the QL keyboard. This is done with the TURBO commands TYPE_IN and COMMAND_LINE which are included in the Runtime Extensions of TURBO. In order to make the command lines invisible INK#0,0 is used at the start of the program and INK#0,7 at the and to make input visible again. Line 150 and 170 read incoming characters. Line 160 checks for the end of a string and line 190 detects the end of the program on the Z88 (Char 163 is used for this purpose).

When preparing for compiling the Superbasic windows and ink colours have to be set as they are copied into the compiled program. I used the following:

WINDOW 512,256,0,0:INK 7:PAPER 0:CLS
INK#0,0:CHARGE

In the TURBO Panel the number of windows is set to 2 (#0 and #1),and the compiled file is called GRAF_EX

The following Boot Program can be used to start the compiled program:

100  A=RESPR(5534):LBYTES FLP1_RUNTIME_EXTS,A
110 CALL A
120 WINDOW 512,256,0,0:PAPER 0:INK 7
130 WINDOW#0,6,10,0,246:PAPER#0,0:INK#0,[illegible]
140 CLS:CLS#0
150 EX FLP1_GRAF_EX

Lines 120 to 140 are used to tidy up the windows and line 150 executes the program. The comand EX must be used so that it can multitask with Superbasic. If more than one run is made use RUN 120

An example of a program on the Z88 is shown below:

100  C=OPENOUT(":COM.0")
110 PROCt("CLS:SCALE2000,-1600,-1000")
120 FOR L=0 TO 2*PI STEP PI/25
130 X$=STR$(INT(400*COS(L)))
140 Y$=STR$(INT(400*SIN(L)))
150 PROCcir(X$,Y$,"500")
160 NEXT L
170 PROCt(CHR$(163))
180 CLOSE#C:END
190 DEFPROCt(A$):PRINT#C,A$:ENDPROC
200 DEF PROCcir(X$,Y$,R$)
210 PRINT#C,"CIRCLE"+X$+","+Y$+","+R$
220 ENDPROC

Line 100 opens a channel to the serial port and 180 closes it again. Command strings for the QL are processed with the procedures t and cir. The calculations are done by the Z88 in lines 120 to 160. Line 170 indicates the end of the program (char 162 is “`” in the QZ88). As can be seen in this program any command can be given to the QL and with the use of procedures it is not complicated.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.