Basic programming on the Z88
Both the BBC micro and the Z88 use the same language, BBC Basic, so owners of both machine will want to transfer Basic programs back and forth between the two machines. One way of sending programs from the BBC micro to the Z88 was described in the February 1988 issue of The Micro User, here we've a utility which works in both directions, is easier to use and more thorough.
Our previous method involves sending the file in ASCI text form from the BBC micro, using Pipedream and the Z88 Filer to load it into Z88 Basic. The way I'm going to describe takes a saved Basic file on either micro and transfers the file to become a saved file on the other. Sending Basic files is not as simple as sending text ones because, although the language is virtually identical, the files are stored differently. This utility deals with all that.
First download the file, dearchive it and save the program. To use it you'll need a serial connecting cable also described in the February issue, and you should make sure that the panel on the Z88 (select with 'square' S) has these settings:
Transmit baud rate 9600 Receive baud rate 9600 Parity None Xon/Xoff NoCHAIN our utility on the BBC micro and select Import/Export on the Z88 ('square' X). Then set one machine to send a file and the other to receive. To give greater flexibility our utility allows you to use '*' commands to, for example, change directory or list files.
On the Z88 some of the BBC Basic commands are missing, these are the ones relating to graphics, sound and analogue to digital conversion. The utility checks for these commands when sending files and does the best that it can. Generally its best is just to flag the problem by preceding the statement with "REM|*****|". However, MODE is replaced by CLS and the appropriate WIDTH selected, and a beep (VDU7) is substituted for SOUND.
At the end of the transfer you're given the option of a report of what has been changed - answering "Y" will put the report on the screen, if you've a printer, "P" will also print it. The report lists line numbers of any lines where none-implemented commands were found, any lines which went over the maximum length of 255 characters and also any lines which contained commands which are present in both Basics but unlikely to mean the same thing. The commands with different meanings are CALL, OSCLI, VDU and '*' commands - these are not changed since the program being transferred may be one that is only intended to work on the Z88.
If your program contains multiple statement lines, you'll need to check that there are no commands that have been 'REMed out' before the last of the statements on the line, as the REM stops the Basic interpreter looking any further on that line. If this has happened you'll need to modify the line before the program will run.
In the reverse direction, from the Z88 to the BBC micro, the utility does a straightforward transfer, changing the file format, but not checking the Basic program.
Commands not implemented on the Z88
If you use any of these BBC Basic commands on the Z88 the interpreter gives a 'not implemented' error:
CLG, COLOUR, DRAW, GCOL, MOVE PLOT
Sound: ENVELOPE, SOUND
Storage of BBC Basic files
All BBC Basic files are stored in tokenised form (in other words keywords, like PRINT, are stored as a single byte which makes them easy for the interpreter to find). In addition each line has three bytes at its start, two of which give the line number and the other the length of line. The line finishes with a carriage return. (The length is the total length including the three bytes at the start and the carriage return at the end).
On the BBC micro the three leading bytes are in the order: [high byte of line number],[low byte of line number],[length of line]. The Z88 has these three bytes in reverse order.
Also a BBC micro file starts with a carriage return but only has &FF after the last line, whereas Z88 files start straight away with the length of the first line but have &00, &FF and &FF as the last three bytes.