Z88 VDU codes
As the Z88 uses BBC Basic it doesn't take long to become familiar with the language in new surroundings, but what can be done on the Z88 that can't be done on the BBC? The Z88 manual gives few hints. In this article I am going to look at two types of facilities provided by the Z88 VDU drivers. These facilities are windows and what are called hardware attributes, in other words effects that can be applied to the display, like bold lettering.
The short demonstration program on this page, which will only run on the Z88, illustrates many of these facilities. Many of the Z88's VDU codes toggle effects, in other words the same code turns the effect both on and off. You can se this by typing the name of an effect twice. Also the effects are cumulative so BOLD followed by FLASH will produce bold flashing text.
So how does it work? Codes are sent to the VDU drivers either using the VDU command (where the parameters are one byte integers) or PRINT where the parameters are ASCI characters. The demonstration illustrates both methods. All of the codes explained here are VDU1 codes, that is they start with a "1" being sent to the drivers to signify that an effect is wanted.
Line 60 is a good starting point, that sets up the left hand window. To go through the parameters in turn: "1" signifies an effect, "7" is the number of parameters (sent in ASCI), "#" (in ASCI) is the code to set up a window with "1" as the window number. The Z88 has 5 windows available to programmers. The remaining numbers give the placing and size of the window in the form: top left corner x co-ordinate, top left corner y co-ordinate, width, depth. The display is 94 characters by 8 and the origin is at the top left of the display, 32 has to be added to all these parameters. So this window starts at (0,0), has a width of 32 (64-32) and a depth of 8 (40-32). The final parameter specifies the type of border for the window. The right hand window, numbered 2, is set up by line 70.
Line 90 uses PRINT to tell the Z88 that output should be to window 1. In turn the parameters are: "A$", the equivalent to VDU1, "2" is the number of parameters to follow, "C" selects a window and "1" gives the window number. Windows can also be selected using "H" or "I", as can be seen in line 170.
Line 190 moves the cursor to position (0,1) in the current selected window, in this case window 2. Again 32 has to be added to all co-ordinates.
The demonstration hardware effects are selected by lines 200 to 250. These effects only apply to any text output after they have been selected, they do not apply to the whole window.
It is possible to make a whole window grey, even when it already has text in it. This is shown in line 110 and reversed in line 120.
These are the most useful codes if you are using windows. The parameters are shown as ASCI codes unless they are bracketed. e.g. (1) would be sent as VDU1 or PRINT CHR$(1) while C would be sent as VDUASC("C") or PRINT "C".
To set up a window:
The type can be one of the following values:
128 no lines 129 vertical bars 130 shelf brackets at top for a banner 131 bars and bracketsTo select a window: (1),2,H,window number
To select a window and clear: (1),2,C,window number
To select a window and clear if first selection: (1),2,I,window number
To position the cursor at (x,y): (1),3,@,(32+x),(32+y)
To position the cursor at column x: (1),2,X,(32+x)
To position the cursor at row y: (1),2,Y,(32+y)
To 'grey' a window: (1),2,G,+
To 'ungrey' a window: (1),2,G,-
All of these can be toggled on and off:
Bold text (1),B Cursor (1),C Flashing text (1),F Grey text (1),G Upper Case Lock (1),L Reverse text (1),R Vertical Scrolling (1),S Tiny text (1),T Underlined text (1),U Horizontal Scrolling (1),WWhen vertical scrolling is enabled text will roll off the top of the display as new text is written at the bottom. Setting horizontal scrolling on will stop lines wrapping round on the next line.