THE MZ80K DISK SYSTEM EXPLAINED
Written by Phil Clark / SUC/UK
Source: SUC-magazine July 1982, Volume 2, Number 2, pp. 24 – 27
As there have been several requests sent to the Club for an article on the MZ80K Disk System, I have written this piece in the hope of explaining the workings of the full configuration to owners who have never used it and are perhaps thinking of splashing out to equip themselves with the benefits of disks. The MZ80B and MZ80A systems are primarily the same, so owners of these two machines will find this article of interest as well as the ‘K owners.
Starting with the physical properties of the disks. The usual unit to buy is the dual disk drive MZ80FD, although a single drive MZ80FSD was recently introduced. This latter machine retails at an overpriced £400 odd, while the FD is around £587 + VAT. This obviously offers much better value. All the Sharp disk drives are double sided, the ‘K drives being single density with the ‘B and ‘A drives recording at double density. “Single density“ is simply a way of describing the amount of data that can be packed onto one disk. Double density packs data at twice the compression of single density, thus a disk will hold two times that of a single density disk. The actual media are no different – the density is determined by the particular formatting program in use. It is controlled by the drive interface, and not the machine itself: this means that a ‘K drive can be run on an MZ80B fitted with its double density board. The MZ80FD ( short for the K ) offers 143K storage per disk, with a total of 286K available on each dual drive. Two dual units can be fitted to all the MZ80 computers, with the second unit daisy-chained from the “OUT“ socket on the back of one of the drives. Thus only one interface card is needed.
The MZ80FD comes with an interface card ( MZ80FI/O), Master Disk ( MZ80FMD ) and Disk Basic manual. It is a very nicely produced hardback book containing explanations of the new disk commands, plus several involved demonstration programs such as a Stock Control and an item entitled “Let‘s Computerize Your Amateur Radio Log“ – perhaps everybody who owns an MZ80K is assumed to have a radio transceiver as well? The manual style isn‘t far removed from that of the tape Basic; cartoons still explain the commands with some rather odd translations. ( These all add to the interest of the book – what does “You have caused a trouble“ mean? ). The Master Disk contains Disk Basic SP-6015, which uses up 21K of RAM leaving you with 27188 BYTES on a 48K machine. There are also some disk programs, namely initialization, copy and transfer from CMT ( cassette ) to FD. And Sharp kindly give you the good old Applications just in case you have a strange urge to see Ellice‘s Fashion Show again. To start the system up, all that is necessary to do is to type FD from Monitor. Assuming the interface unit is connected and switched on, with the floppy card inside, control is then shifted to F000H ( 61440D ), where a routine is stored in ROM on the aforementioned card. This routine is called a Bootstrap Loader, and its job is to start the drives, pull in Disk Basic and load it into memory. This is all done in around six seconds, and when you consider the system has 21K of program to deal with it isn‘t doing badly! As the system doesn‘t know which drive contains the Master Disk, it prompts BOOT DRIVE ? to which the user either presses ‘CR‘, meaning drive 1, or types a number from 1 – 4. If the specified drive contains a master, the system whirrs away quite happily, stopping the drives and beeping when the computer is ready to use. If, however, the drive does not contain a master, the error ER: CANT BOOT appears and the computer returns to wait state. This also happens if the drives are switched off. It‘s apparently a fairly unusual occurrence, as I was told that an Apple will continue to and try to boot the system even if a Master Disk is not in place. Hmmm.
It is not possible to put a blank disk in a drive and expect to record on it straight away, so all systems provide some sort of initialization or formatting program. This sets up a new disk according to the system‘s requirements – in the K’s case it divides each disk into 70 tracks – 1 to 34 on side one and 35 – 69 on side 2. Each of these tracks is composed of 16 sectors, so there are 1100 sectors an a new disk. 64 are used by the system for its directory needs ( whereabouts everything is stored on the disk ), leaving 1056 sectors for the user. A sector holds 128 bytes of memory space. Programs can be put onto a disk until all its space is used up, or until the 97 item limit is reached. When either of these conditions arises, an error is created and writing to the disk is not permitted.
One of the greatest advantages of disks is that the contents of a disk can be viewed instantly by typing DIRx ( short for DIRECTORY ). Assuming that x is a valid drive number, the contents of the disk in x is read from the system tracks and displayed on the CRT screen. This stops when scrolling reaches the bottom of the VDU, and can be continued with a press of CR. A typical program would be displayed as follows:
BTX* “Test Data“
If the global switch ‘/P‘ is used, i.e. DIRx/P, a hard copy of the directory #x is produced on the printer. ( If connected ).. This not only displays the mode, status and name, but shows the number of sectors used by each item. Each disk is given a volume number, from 1 – 127, which is always shown at the top of any directory, alongside the number of free sectors. e.g.
indicates volume 4 has been directoried, and has 14 sectors left. “BTX“ denotes a Basic program and the star ( * ) means the file is LOCKed and cannot be deleted without first being UNLOCKed. ( A useful security measure ). The other program modes available through SP-6015 are OBJ ( machine code ), BSD ( Basic Sequential Data ), BRD ( Basic Random Data ) and the dummy symbol ? which is used by the system to designate a file of unknown properties. Machine code programs are recorded on disk by using Sharp‘s utility “FILING – CMT”, which will also transfer BTX and BSD items. The latter is handled rather cleverly, with the tape drive reading a block of data, stopping the tape, transferring it to disk, reading another and continuing. Three options on each program are open to the user: Transfer to FD, Convert or Skip. Convert changes OBJ code onto a BSD file which can be read and altered if desired. Skip simply ignores the program and restarts the tape to read on to the next item. When each program header is read, the program displays data according to filename, mode ( 1 – 3 ), start and execution addresses and the bytesize. If a CMT program has no filename, the user must assign one as it is impossible to record unnamed files on disks. Also each file must be named differently, for the simple reason that two items with the same name cause confusion – which does the system load?
Disk Basic contains several new commands. A program can be loaded from disk by producing a directory, moving the cursor up to the required name and typing LOAD over the file mode. Alternatively, it is possible to type LOADFDx“filename“, which performs exactly the same function. Typing RUN instead of LOAD loads the program and runs it as well. This is the only way to execute OBJ mode programs – they cannot be loaded and not run for obvious reasons. If a user tries to muck up the system by running a data file, the Sharp will produce one of its numerous errors. Errors in Disk Basic, because of their quantity, are signified by a number, e.g. *ER 40 indicates a described file is not present on the accessed disk. To help one‘s memory, Sharp kindly supply a blue card containing all the error numbers and their meanings. The system is fairly idiot-proof; it is not possible to do nasty things by putting disks in upside down, or accessing an empty drive, for example.
Because of the limit on program size, 27188 bytes, long programs written in tape Basic will not load or run on the disk system. So the interpreter is supplied with a command CHAIN, which keeps any variables created in the first program and loads in a specified second one. Thus it is possible to run very large items as a series of small blocks. SWAP is a similar command, except that it loads back the original program when an END or RETURN is encountered in program #2. So a subroutine can be called up from disk using SWAP, with control returning to the mother program at the end of the routine execution.
Other new commands in Disk Basic include Delete, which erases all references to a specified file on a certain disk. The actual program tracks are not erased, but overwritten when a new item is recorded. Rename allows you to change a program‘s present name to another of your own choice. Again, the program is left untouched.
Data files in Disk BASIC can be of two types. Of course, normal serial or sequential files are supported ( sequential files work on the same principle as serial, but the records are stored in an ordered fashion ) but disks also allow the user to create random files. These have all the records arranged in odd places over the disk surface. Their advantage is that unlike serial files, any record can be accessed without reading the previous ones. For example, if you wanted to read item #100, a serial file would necessitate reading of items #1 – #99 before #100 could be reached. A random file would permit #100 to be input at once, thus improving search speed. The disadvantage of random files is that they are more difficult to use. The disk file access speed is obviously much better than that of tape – a file that might take 15 minutes to load from the CMT can be read in a mere 30 odd seconds from a disk, and that is slow.
Another feature of Disk BASIC is its error trapping routines. Apart from the usual system variables of SIZE and TI$, two others are provided in the shape of ERN and ERL. The first is the number of the error created ( remember all errors with the disks are numbered ), whilst ERL is the line at which it occurred. If the statement ON ERROR GOTO is incorporated into a program, control will be shifted to the specified line when an error occurs. With some appropriate coding to check the ERN and ERL numbers, the situation can be diagnosed, and the RESUME statement allows continuation of program execution.
Finally, there are a few other items in the Disk interpreter that do not appear in tape versions. CURSOR positions the cursor at a certain point on the screen. CURSOR 20,12 put it 12 lines down and 20 lines across. This eliminates the tiresome POKEing of addresses 4465 and 4466 to obtain a neat output on the CRT. Actually, tape BASICs from SP-5030 onwards do include CURSOR, but since we Europeans are not supposed to have these items I shan‘t dwell on them.
SP-6015 allows POKEing and USR calls to Hex addresses, e.g. USR ($F000) starts the bootstrap routine, whilst POKE $D000, $CF puts a face at position 53248 decimal. The INP# and OUT# commands in tape BASIC are changed to INP@ and OUT@ for no apparent reason when running disks. And, for those of us with brains the size of a planet, there is the “Logical Open USR Function”, which, according to the 6015 manual, allows “the data access with the logical-open USR function to be accomplished in the same statement composition as applied to sequential file.”. I still haven’t figured it out.
Up till now this article has concentrated on the 6015 Disk BASIC. Since its introduction, the FD has had two other operating systems made available. One is a double precision version of BASIC, dubbed SP-6115. Although it purports to be a scientifically based language, the absence of all the scientific functions ( SIN, COS etc. ) make it of little use. The other system is the Sharp FDOS. This is a completely different concept as it is only an operating system through which several useful routines can be called. I have been using my copy of FDOS for compiling BASIC programs into machine code. The Basic Compiler ( SP-7715 ) has to be bought separately from FDOS, and will not run without it. The compiled programs run under the operating system, as they use its various routines. So it is not possible to write that amazing new arcade game in BASIC, compile it under FDOS and then transfer it to tape to be loaded from Monitor and run. It simply won‘t work, although a friend of mine is at present working on a way of saving the FDOS run-time package to tape along with the actual OBJ code. Watch this space…
FDOS also allows you to assemble mnemonic code without any of the drudgery associated with the tape system programs. If you wish, you can control paper tape punchers, plotters, EPROM programmers and the like. There are sections of the FDOS manuals ( some ten of them arrive all packaged in a smart ring binder ) devoted to these peripherals, plus a mind-numbing amount of information on the inner workings of the MZ80K. Sharp‘s programmers have certainly gone to town on this piece of software. ( Makes a change ).
The FDOS disk handling capabilities are quite a lot faster than the rather slow BASIC routines. Each disk has a name ( Sign ) as well as a volume number; this prevents unscrupulous people from “accidentally” reformatting your disks as the format program demands to know the old sign as well as the new when reusing an old disk. Protection of single items is handled similarly. If you apply “Attribute P” to an ASCII file ( source code for example ), no-one can examine it unless they know the sign. The only disadvantage is that you have to remember it, as ways of discovering the sign are not highlighted in the FDOS documentation. There are many other new functions available with the system, but to go into them would need another article in itself. ( What a good idea ).
That is a brief account of what disks offer the MZ80K user. My opinion of the system is that it is very reliable, well made and quite flexible, although some improvements on the software side could be made. But that‘s nothing that can’t be altered by a few late nights. Since the dual unit arrived, I have become so used to it that now I would be lost were it to break down. The disks are well worth investing in, and, when coupled with the P3 printer ( and a colour unit? ), create a powerful system that becomes the envy of all lesser computer users.