CP/M Implementation on the MZ-80K
written by Andrew J. Cornish BSc. / Crystal Electronics
Source: Mike Brinson, SHARPSOFT-magazine November 1982, Volume 6, p. 20 - 25
|MZ-80 CP/M Notes ( by SHARPSOFT )|
| An Implementation of CP/M on the SHARP MZ-80K
by A.J. Cornish BSc. ( Crystal Electronics Ltd. )
Scanned keyboard with all keys software-definable. VDU 40x25 characters, memory-mapped. Cassette - Normal audio type, with numeric indicator, speed approx. 1200 baud, software controlled.
External to the main machine, we have: Floppy discs ( two, expandable to four ), double-sided, single-density, 140K per disc, 70 tracks, 16 sectors per track, 128 bytes per sector, 5 1/4 disks.
Floppy disc controller - TOSHIBA T3444M.
Having already developed our Xtal BASIC on the MZ-80K ( see LSG No.5 ), we decided to attempt an implementation of the CP/M Disc Operating System, in order to allow the MZ-80K to use the wide variety of languages and software available to other machines already running under CP/M. Apart from that very important advantage, CP/M also offers a system which is itself totally independent of any one high-level language, whereas the operating system normally offered with the MZ-80K is almost entirely centred around SHARP DISC BASIC.
We decided to set ourselves the following goals in our implementation:
1) The implementation should be as near to standard as possible, while hopefully including some of the features peculiar to the MZ-80K. At the same time, it must be possible to run all the existing facilities and software of the MZ-80K.
ii) The disk operations should be speeded up if at all possible. It had already been noted that, although the SHARP DISC BASIC booted impressively quickly, file accesses for loading of programs and data were exceedingly slow.
iii) All of the SHARP MZ-80 peripherals should be supported ( cassette recorder, printer, etc. )
iv) It should be reasonably easy to transfer software from another
machine already running CP/M onto the MZ-80K. This is important for
software houses, dealers and programmers with other computers
running software which they might consider offering on the MZ-80K.
Just as despair was beginning to set in, my colleague, Trevor Brownen ( sometimes referred to in our establishment as The Boss! ), had an inspiration, and the problem was solved within a few days. Briefly, the solution adopted makes use of the very flexible address decoding of the MZ-80K, so that the 4K blocks of memory 0000 - 0FFH and C000 - CFFFH ( the top 4K of RAM space ) could be interchanged by addressing one of the unused memory-mapped ports. The Monitor ROM and the RAM can be restored to their normal positions by addressing another port. Hence the machine can be operated with all SHARP BASIC software etc., as if no modification had been made. Of course, all of this means that the CBIOS ( Customised Basic I/I System, the part of the CP/M system which must be written by the implementor ) must also contain the necessary monitor routines for scanning the keyboard, driving the VDU, etc. This means that we actually have a 46K CP/M system, even though we have 48K RAM.
The hardware modification involves the removal of an IC on the main
board of the MZ-80K replacing it with a socket, and then plugging in
a PCB holding three IC's ( size about 3 inches by 2 ).
The author talks about IC47. Finally, two wires must be soldered to
complete the task. ( SHARP ( UK ) Ltd. have kindly allowed this modification
to be done without invalidating the guarantee so long as it is performed
by a SHARP dealer ( but any user who is in doubt should contact his
or her dealer ).
|KEYBOARD AND CHARACTER SET|
While doing all of this, we decided to take the opportunity to redefine the keyboard and VDU functions. In particular, the MZ-80K does not have a control key, whereas nearly all terminals do, and CP/M requires it. After a little thought, we redefined the BREAK key as CTRL. The SML/CAP key has been changed to allow a toggle effect ( i.e., hit once to go to lower case, and again to go back to upper case ). Normally, we have to hit shift-SML/CAP to go to lower case, but this combination is now redefined as an ESCAPE ( another key used frequently in CP/M software ). Apart from these changes, the keyboard behaves exactly as shown on the keytops, and the graphics characters may be used in programs, if desired.
A full list of control-characters is shown at Table 1, together with their effects if printed from within programs. These are in addition to those used in the CP/M line editor ( e.g. CTRL-P turns the printer on and off when typed at the keyboard ). Note the convention of using "^"an abbreviation for CTRL.
|DISC ACCESS SPEED|
An appreciable increase in speed is achieved by means of INTERLACING, so that, for example, sector 2 of a track actually appears 5 sectors after sector 1. Although this is still not as fast as it COULD be, it is three times faster than it was, and this is roughly the improvement offered by Xtal CP/M over SHARP DISC BASIC.
Since each sector has an indentification mark for the controller, it
is a simple matter to achieve interlacing by means of the FORMAT utility
program. This program writes the sector identifications as the first
stage of initialisation and we can define the order in which the sectors
appear on the disc by means of a table within the program. In fact,
we format the discs with 1 to 1 interlacing for the first five tracks
( those containing the operating system ), and 5 to 1 interlacing for
the directory track and file tracks, thus getting both fast booting
and reasonably fast file transfer.
The cassette recorder may be operated by means of a progran on the
CP/M disc called TAPE.COM. This allows us to load or save programs between
disc and tape.
|PROGRAMS ON DISC|
In addition, the following programs are supplied on the disc:
These two programs are included to illustrate the use of the extra BIOS routines for driving the clock and tone GENERATOR.
Software transfer is best effected by means of the Serial Card since it is unlikely that the discs will load or dump discettes from a machine other than another MZ-80K. A few software houses in this country have already shown interest in moving their programs onto the MZ-80K, and we should welcome enquiries from anyone who has developed CP/M software.
For our own part, we shall soon be producing a CP/M version of the now highly popular Xtal BASIC 2.2 - primarily for the MZ-80K, but also for Z80 CP/M Systems in general. We already have the well-known CBASIC compiler adapted for the MZ-80K, and are obtaining licences for many other languages, including ALGOL, FORTRAN, PASCAL, C, and COBOL.
We feel that the exercise of putting CP/M onto the MZ-80K has been
well worthwhile, and opens up the machine to many other uses.