John Allen's Z88 pages   Z88

Answers to common questions about the Z88

1. Will all BBC micro Basic program run on the Z88 provided there's no graphics in them?

No. There are three other main areas of difference: firstly VDU codes. With the exception of the ASCI characters the vdu drivers on the Z88 use totally different codes to the ones on the BBC, for example VDU2 does not turn the printer on. Secondly most OSCLI or '*' commands will be different this means, in particular, that *FX commands cannot be used on the Z88. The third area is a little more subtle. Basic on the BBC micro uses different stacks for the return addresses of different types of loops, making it tolerant to poor program structures. On the Z88 there is just one stack so there are programs which will run on the BBC but not on the Z88, consider this one:

  10 PROCtest
  20 PRINT "Main Program"
  30 END
  40 DEFPROCtest
  50 FOR I = 1 TO 10
  70 NEXT

Here the FOR loop inside the procedure never completes (in other words the value of I never reaches 10) so its end address is left on the Basic stack. The BBC micro will however correctly return from the procedure to the main program and execute line 20. The Z88 gives the error message:

  No PROC at line 60
because ENDPROC is executed it is the FOR return address not that for the procedure which is pulled off the stack.

2. Why does the 'BAT LOW' sign come on when you plug in the mains adaptor?

That's because the Z88 has to have power all the time to retain the content of the memory. In order to ensure that it is powered when the mains adaptor is plugged in but not switched on there's a diode inside which allows the supply to revert to the batteries when it's not getting power from the mains adaptor. This diode has a voltage drop of nearly 1 volt. As you plug the mains adaptor is plugged into the Z88 the first thing that happens is that the direct battery power supply is cut so, until the plug is fully in, the machine gets its power via the diode and, due to the voltage drop it is generally below 4.5 volts (the voltage when the 'BAT LOW' indicator comes on). Although the mains adaptor supplies 6 volts when the plug is fully inserted the indicator remains set. Turning the machine off and the on again will, however, clear the indicator.

3. Your article on using the printer in the April 1988 Micro User showed how to print from Basic but how do I get effects such as bold in the output?

You can send the codes to control your printer directly using VDU, PRINT# or BPUT# (depending on the way in which you're sending it the output), however, the easiest way is to use the Z88's printer driver which is already programmed with the codes for your printer. This only works if the printer is set up as a file by using:

  X% = OPENOUT":PRT.0"
and then sending it text using BPUT#X% and PRINT#X%.

The printer driver is operated by the ENQ character (ASCI code 5) followed by a character to say what should be done. The most useful of these are:

  ENQ,[  turn printer driver on
  ENQ,]  turn printer driver off
  ENQ,U  toggle Highlight 1 (Underline)
  ENQ,B  toggle Highlight 2 (Bold)
  ENQ,X  toggle Highlight 3 (Extended Sequence)
  ENQ,I  toggle Highlight 4 (Italics)
  ENQ,L  toggle Highlight 5 (Subscript)
  ENQ,R  toggle Highlight 6 (Superscript)
  ENQ,A  toggle Highlight 7 (Alternate Font)
  ENQ,E  toggle Highlight 8 (User Defined)
You need to bear in mind that the printer driver will probably have most of these effects set to turn off at a carriage return and that one is sent at the end of each PRINT# statement.

To use an effect the printer driver first has to be turned on by:

  BPUT#X%,5 : BPUT#X%,ASC"["
Effects can be sent either by using BPUT# in a similar way or by incorporating the characters into the PRINT# line, for example:
  10 ENQ$ = CHR$(5)
  20 PRINT#X%,"Normal "+ENQ$+"B"+"Bold "
will print "Normal" in normal type followed by "Bold" in bold type, all on the same line.

4. How does the Z88 use its ram?

Unlike the BBC micro the Z88 can have both applications and files operating in 'fragmented ram' this is where a file, of 1000 bytes for example, does not necessarily occupy 1000 consecutive bytes. However, except in :RAM.-, files do reside in a particular ram device and will not be split between devices. In the case of :RAM.- this is treated the same as an activity and may be placed anywhere in any part of memory. The ram is actually 'paged' into the Z80 processor's 64k memory map in 16k chunks so machine code programmers have to ensure that things like stacks don't disappear when the operating system pages a chunk of memory out.

The exception to all of this is BBC Basic, this was written before the Z88 was designed and requires continuous memory. When you call Basic the operating system will find 40k (on a machine with a 128k ram pack) or 8k (otherwise) of continuous memory for it. If necessary other activities will be moved to a different part of memory. When you leave Basic everything is restored to its previous position and the Basic activity is collapsed down into the space it actually occupies plus about 2k for a copy of the screen.

© John Allen 2014