Source: geocities.com/svenqhj

Z88 Source Book Addendum #1
     By Timothy Swenson


INTRODUCTION

The Z88 Source Book Addendum is additional material for the Z88 Source
Book.  Instead of adding it to the Source Book to make a 4th edition,
thus requiring owners of the 3rd edition to purchase another edition
(which was done by owners of the 1st & 2nd editions when the 3rd
edition came out), I felt it would be wiser to create a new document
that could be combined with the Source Book in one binder.

As with the Z88 Source Book, the intent of the Addendum is to collect
a bunch of information about the Z88 and publish it for Z88 users.
This is the first Addendum.  More will follow as additional
information is found.  This document, along with the Z88 Source Book
can be found on my web page at:

      http://www.geocities.com/SiliconValley/Pines/5865/


BOOK REVIEWS

Some Z88 books are still available from the various Z88 dealers.
Others can be found in various places, including used book stores,
garage sales, and other Z88 users.  The Z88 Source Book listed only
those books which were known at time.  This section outlines the
contents of the books that I have since come across.

Z88 Real Power Computing
  By Frank R. Flaig

The first thing that you notice about this book is its amaturish look.
The book has been printed out on a Near-Letter Quality dot-matrix
printer, reproduced using a photocopier, and bound with a plastic
binding.  It could have easily been written and printed directly from
the Z88, which would demonstrate that the Z88 can do more than just
short letters.

The reason behind the book is similar to that of this book, the
author, after playing with the Z88 for a while, figured that other Z88
users might like to read what he has done with the Z88.  The book is
written as if you were sitting down with the author and he is chatting
with you about what he has been doing.  It is a very flowing
discussion-like style of writing.  I'm used to a more technical
get-to-the-point style of writing, but for some people this discussion
style may be more appealing.

Although the author does give an introduction to the Z88 and how to
use some of the applications, the core part of the book is the
sections on using the applications to accomplish tasks.  The sections
are as follows;  Merger - two different ways to merge a database and a
document to produce the same letters to different persons.  Labels -
printing out labels, such as address and product labels.  Screen
Display - how to better display a PipeDream database.  Language -
Using PipeDream to construct a document that helps translate between
two languages using lookup functions.  Currency Convertor - Using
PipeDream to convert between different currencies.  Trip Computer -
Using PipeDream to figure out how long a journey will take and track
fuel usage.  Diet Calculator - Using PipeDream to work out food
rations in terms of calories and cost.  Invoicing - Using PipeDream to
generate invoices or quotations.  Graphic Bar Chart - Using PipeDream
to create bar charts of data.

The book is fairly project centered and details what the author has
done to use the Z88 to accomplish the tasks that he needed done.  The
tasks may not be exactly what you need to do, but the details can be
changed to fit your needs.

This is not a very technical book full of more detail about the Z88.
It is more of a "How I Use" the Z88 book.  If there are tasks that you
want to use the Z88 for but do not know how to get the Z88 to do them,
this book might be just for you.  Once you see how the author has
accomplished his tasks, it might shed some light on how you could use
the same tricks to get your tasks done.


Using Your Z88
  By Patrick Hall

This book starts off pretty much as every other Z88 book by covering
the main applications built-in to the Z88.  The coverage of the
applications is fairly thin compared to some other books.  The book
then makes a turn for the better starts talking about programming in
BBS Basic.  Over two thirds of the book is dedicated in covering BBC
Basic starting with the idea that the reader is new to programming.
The book does a fairly good job of teach BASIC by covering the
essentials like Output & Display, Structured Programming, and Data
Structures.

The chapters walk a reading through the process of learning BASIC.  It
starts off with simple concepts and works from there.  It's fairly
verbose and explains what you want to do and how it is accomplished,
along with example code mixed in with the text.  This is not a
reference book for BBC Basic programming and I would not reccomend it
to anyone that already knows BASIC, but for those new to programming,
this book is a good starting place.


Z88 Computing
  By Ian Sinclair

This book approaches the Z88 a little differently than the other Z88
books I've seen.  It's approach is purely learn by doing.  It does not
spend much time discussing the various applications and how one might
user them in general.  Instead it starts off by covering a few key
points about the Z88 and its keys.  It then walks you through the
Pop-Ups and Applications step by step.  Each section has a short
paragraph covering the topic (such as Calendar or Clock) and then goes
into steps (like 1,2,3) that show a point by having you do something
on the Z88 or covering a single action (such as marking a block of
text).  
It has almost taken the task of learning the Z88 and broken it up into
small managable chunks.  With big bold numbers in the sections, you
can read the book in shorts bursts and not worry about loosing you
place.  This is also a book that requires having a Z88 nearby.  It
re-enforces its points by having you perform actions on the Z88.

If you don't have the time to really read the Z88 manual or other Z88
books, this one may be for you.  It will not teach you everything you
need to know about the Z88, but it does give you a quick start and
sets you on your way.


Z88 WORLD WIDE WEB LINKS

Z88 Forever
   http://www.netforward.com/deathsdoor/?Dharking

This is one of the key Z88 web pages and has a little bit of
everything.  The key sections are "About the Z88", "Using the Z88",
"Hardware & Software", and "Other Z88 Resources."  For Z88 users the
section "About the Z88" covers what they already know.  "Using the
Z88" has subsections on Z88 Emulators, the Z88 User Group Library,
Hints & Tips, etc.  The "Hardware & Software" sections covers some
items that are in this Addendum, such as the Internal Memory
Expansion.  The "Other Z88 Resources" lists the other key Z88 pages,
including the links to both the 2nd and 3rd edition of the Z88
Developers' Notes.


Dennis Gronings's Z88 Page
   http://www.algonet.se/~dennisgr/z88.htm

This page has a description of a number of Z88 utilities that Dennis
has written for Windows95.  These utilities are available for
downloading from the page.  These utilties will be discussed in a
later chapter covering new software/utilties.  One item about the
page, it has a nice picture of Sir Clive Sinclair holding up a Z88.


John Allen's Z88 Bits
   http://www.bramber.demon.co.uk/z88/index.html

This page has the following sections, "General Z88 Articles", "Z88 ->
BBC Articles and Software", "Z88 -> Risc OS Articles and Software",
and "Z88 Book".  As you can tell, John has spent some time working the
BBC Micro and the Acorn Risc OS computers.  The section "Z88 Book"
covers a few details about John's book "Z88 PipeDream: A Dabhand
Guide."  The Z88 to BBC Micro utilities are covered in a later
section.


John Allen's Software Showcase


This pages covers some of the software programs that John Allen has
written for Risc OS computers, which includes Z88Link and ZLink, which
both link the Z88 to Risc OS computers.  Both Z88Link and ZLink have
been downloaded and included in the Addendum Companion.


Really Good Software Company
  http://www.tcp.co.uk/~tonyr/rgsc/

This page covers the commercial software for Risc OS software from
this company.  For the Z88 they sell ZLink II (Z88 to Risc OS), a
follow on to Zlink (see previous item above).  It is available for
29.95 pounds.


Z88 Developers' Notes
   http://www.cl.cam.ac.uk/users/jrh/devnotes/index.html

This page covers the 2nd edition of the Z88 Developers' Notes written
by John Harrison and Matthew Elton.  The entire Notes have been
converted to HTML and are readable from this page.  If you want to
write Assembly programs for the Z88, this is the book to read.  It
covers all of the system calls and how to write applications.

Rakewell Ltd
   http://homepages.nildram.co.uk/~rakewell

Rakewell carries a lot of stuff for the Z88, a number of items that I
believe that only they carry.  Their newest product is a flash EPROM
that lets you delete files without needing an EPROM eraser.

Club 100 / Web 100
   http://dillernet.com/m100/index.html

This web site is dedicated to the Tandy Model 100/102/200.  This page
applies to the Z88 because there is lots of information about the
Tandy Portable Disk Drives (PDD), which are usable with the Z88.
There is software that lets the PC read the PDD disks.

My Z88 Page
   http://www.xnet.com/~stuart/z88.shtml

This small page has a couple good shots of the Z88 both inside and
out.


NEW Z88 RELATED SOFTWARE

These Utilities are available off of the Web links listed above.


Z88 PipeDream Viewer   (PIPEVIEW.ZIP)

This MS Windows program loads native Z88 PipeDream documents and
displays them.  Spreadsheet formulas are displayed but are not
calculated.  Columns are properly spaced.  Underline, bold, italics,
subscript, and superscript highlights are supported.  Allows you to
save PipeDream documents into Microsoft Rich Text Format (.RTF) to be
exported to Word for Windows.  This program is written by Dennis
Groning and written in Visual Basic.


Z88 BBC Basic Viewer  (Z88BASV.EXE)

This MS Windows program loads native Z88 BBC Basic programs and
displays them.  Menu commands support Save as Text, Cut, Copy, Paste,
Delete, Find, Find Next, and Add CLI Header.  This program is written
by Dennis Groning and written in Visual Basic.


Z88 Import-Export File Transfer (Z88-Xport)  (Z88XPORT.EXE)

This MS Windows program transfers files from Windows-based PC's and
the Z88 using the standard Imp-Exp popup on the Z88.  It supports the
backup of your entire Z88 by using the ":*//*" wildcard.  Z88-Xport
will create all directories needed during reception of the Z88 files.
It also supports selecting multiple files from multiple directories on
multiple drives and sending them to the Z88 in one batch.  This
program is written by Dennis Groning and written in Visual Basic.


CONVERT-BASIC  (BASIC.ZIP)

This is a BBC Micro program that converts BBC BASIC programs from the
Z88 and the BBC Micro.  The utility sends and recieves files from the
Z88 and converts the BASIC programs as they are transfered.  When
converting from the BBC Micro to the Z88, BASIC commands that are not
supported on the Z88 are converted into REM statements.  The MODE
command is replaced with CLS and a beep (VDU 7) is substituted forSOUND.  When the transfer is finished a report is displayed on the BBC
Micro screen that shows what conversions were made.  When transfering
from the Z88 to the BBC Micro, the utility does a straightforward
transfer, changing the file format, but not checking the BASIC
program.  This program is written by John Allen.


ARCHIVE    (ARCHIV.ZIP)

This utility takes all of your files on the Z88 and transfers them to
an archive file stored on the BBC Micro disk drive.  The utility is
then used to selectively reload the files back onto the Z88.

The utility runs on the BBC Micro, using either the DFS or ADFS filing
systems and links up to the Import/Export utility on the Z88.  The BBC
Micro does nothing more than send the data coming from the Z88
directly to disk.  No conversion is done.  This program is written by
John Allen.


CONVERT   (CONV.ZIP)

This utility converts simple PipeDream document files for use in
Wordwise, Wordwise Plus, and Mini Office on the BBC Micro.  Using a
few pointers in creating your PipeDream documents, these files can be
easily converted for use in BBC Micro word processors.  This program
is written by John Allen.


Z88 Printer SERVER  (PRINT.ZIP)

The utility will allow the BBC Micro to act as a printer server for
the Z88.  With the Z88 linked to the BBC Micro via the serial port,
when the Z88 prints to the serial port, the BBC Micro takes that data
and sends it to its parallel port and the printer attached there.
This program is written by John Allen.


Z88LINK  (TRANS.ZIP)

This utility simply transfers files from the Z88 to/from the BBC Micro
using the Z88's Imp-Exp utility.  BASIC program line number are
translated between the different forms.  This program is written by
John Allen.


Z88Link  (Z88LINK.ZIP)

This Risc OS utility transfers single files between the Z88 and any
Risc OS computer using the Imp-Exp utility on the Z88.  A version 2 is
available from the author (John Allen) for 5 pounds.


ZLink   (ZLINK.ZIP)

This Risc OS utility transfers files between the Z88 and any Risc OS
computer.  It requires the PC Link II ROM to be installed in the Z88.
This program is writtn by John Allen.


UNDER DEVELOPMENT

Here are some items that are reported to be under development.

Multiple Diaries

This will allow you to keep more than one diary on the Z88.  You can
keep your work and home diaries separate.  This is being worked on by
Interlogic.

PC Link Client

This is a command line PC client to connect to the Z88 program, PC
Link and PC Link II.  This allows files to transfer in both directions
and using wild cards.  It will even handle subdirectories, allowing
transer of an entire device (RAM.1:) with a single command.

WhatNow?

This application will allow the Z88 to use adventure files from the
Spectrum game creator, "Graphic Adventure Creator (GAC)."  Snapshots
of adventure games can be downloaded off the Internet, transfered to
the Z88, and then played.  


VERSION 4 ROM

The V4 ROM contains the following fixes:

Lost Handles
  In V3, handles could be lost by pre-empting the Filer during a
catalogue, resulting in a "File in Use" error which requires a soft
reset to clear.

ROM Cards
  It is no longer possible to insert and remove cards while the Z88 is
switched off.  Doing this might cause the Z88 to get confused, since
the Z88 now wakes up when the flap is opened.

PrinterEd
   When updating the PrinterEd settings user V3, it is common to
encounter a "FAIL" condition.  This has been fixed.  Additionally, the
"Allow line feeds" option now works correctly.

RAM.- Device
   The system no longer gets confused if files are present in this
useful device when the Z88 is reset.

Expanded Machines
   The Z88 will now behave as an expanded machine (giving a full map
in PipeDream, and 40K workspace in BASIC) if there is at 128K RAM
anywhere in the system, and not just in Slot 1 as with V3.

Filer Display
   In V3, a problem sometimes occurs with Filer when marking a file
after scrolling the cursor.  This causes the first letter of the
filename to disappear.  This is now fixed.


INTERNAL MEMORY EXPANSION

Don Walterman has re-discovered a way of upgrading the internal memory
of the Z88.  In browsing through some old Z88 magazines Don noticed
ads for internal memory expansion kits.  He decided to figure out how
this was done.

Don started with the Z88 Service Manual, which explains that the
internal memory is pseudo-static.  This type of memory is not common,
but Don did manage to find a company that carries these types of
memory chips.  It is Microprocessors Unlimited (918) 267-4961.  They
stock the memory chips that the Z88 can use (512K and 128K in either
100ns or 80ns).  The parts are:

            128K pseudo-static RAM: Hitachi HM658128ALP     $9.95
            512K pseudo-static RAM: Hitachi HM658512LP     $27-30

The Service Manual explains that the memory socket is pinned for the
128K memory chip.  Every board that Don has seen has the memory chip
soldered in, making for a more difficult project.  Carefully unsolder
the old memory chip and install a low-profile socket.  Make sure to
use a 32-pin socket.  You will need to clean out the extra four holes
above the 32K RAM, which only uses 28 pins.  NOTE: A solder sucker or
desoldering iron will come in handy here.

Don tried the 128K chip first and it worked right away.  The Z88
recognised it without doing anything special.  When Don installed the
512K chip only the first 128K was recognised.  Don had to head back to
the service manual.

The Service Manual explains that the Z88 is designed to access four
blocks of one megabyte each.  To access the full one megabyte, you
need to use all the memory address lines.  Memory address lines 17 and
18 don't go to the internal RAM socket.  They do go to each of the
card slots.  It happens that there are three pads by each connector.
Use the two pads next to each other that go to the second and the
third pin from the end of the connector.  These pads are memory
address lines 17 and 18.  They are perfect for this project.  Solder a
wire to each pad on the foil side of the board.  Make sure the wire
does not go through the pad too far.  There is a metal bar that a long
wire could short against.

There are a number of feed-through holes on each side of the internal
RAM chip.  Don prefers the feed-through hole by pins 3 and 18 of the
memory chip.  This allows you to run the wire right to the pins you
want.  Don't solder the wire to the feed-through holes, just run the
insulated wire through it.  Feed one of the wires through each feed
hole.  Don't use too much wire - you want to make sure mone of the
wires interferes with the option slots.  Don left pins 1 and 30 bent
out of the socket so that it would be easy to solder the extra memory
lines to it.

After attaching the two memory lines, the Z88 woke up with 512K.  It
recognised all of it with no problems - despite reports that a V4 ROM
is required for 512K internal memory.

One last detail - the clearance under the keyboard is tight.  When Don
put the Z88 back together, he noticed the keyboard bend a litle.  He
looked at the bottom of the keyboard and say that there was a clear
space above the Z88 ROM.  Use a sharp pair of wire cutters to trim the
area on the bottom of the keyboard above the RAM just like it is over
the ROM.  Now the keyboard fits well.  This is why it's better to use
a low-profile socket if you have one.

Make sure to completely backup your Z88 before starting this project.
You will probably need to do a hard reset to get the Z88 to check to
see how much memory is installed.  Don't be surprised if the Z88 makes
a strange noise the first time you turn it on.  Just perform a hard
reset and it will be fine after that.


Z88-TO-MAC TRANSFERS

Some people have been having problems transfering files from the Z88
to a Macintosh running Systems 7.5 and 7.5.3.  The problem has been
tracked down to the Mac starting with Extensions Turned On.  To get
the transfer to work you need to start up the Mac with Extensions Off.
To do this, hold down the shift key while starting until the message
"Extensions Off" appears.  It has not been determined which extension
is causing the problem.  This has been tested on a PowerMac with MacOS
7.5.3 and a Mac IIci running MacOS 7.5.


Z88 AND WORLDPORT MODEM

The WorldPort modem is a small, portable, and fairly popular battery
powered modem.  This section provides some details on configuring the
modem to work with the Z88.

Setting on the Z88: Xmit Baud 9600, Rcv Baud 9600, no parity, and
xon/xoff set to Yes.
Setting on the Z88: Xmit Baud 9600, Rcv Baud 9600, no parity, and
xon/xoff set to Yes.

Settings on the WorldPort (from the ATI4 command)
   B0  C1  E1  F1  M1  Q0  V1  X7  Y0
   &A3 &B1 &C1 &D4 &G0 &H1 &I0 &K1 &L0
   &M4 &N0 &P0 &R2 &S0 &T5 &X0 &Y1


RAKEWELL

(This section is include primarily because Rakewell does not advertise
in Sinclair circles and this information is not known to a number of
Z88 users. )

Rakewell Ltd. carries a wide variety of Z88 items, plus is about the
only dealer doing development.  They also seem to have picked up the
software sold previously by Ranger.

Books:
   Printer Drivers for the Z88                    7.00
   Z88 Developer Notes                           40.00

PipeDream for MS-DOS (w/ spellcheck)   50.00

Cables:
   Z88 to Mac/Archimedes                         15.00
   Parallel Printer                              34.00
   Serial Printer                       7.95

EPROM Eraser                                     21.27
Flash EPROM Pack                       50.21
SwitZch Box (4 way w/ lead)            29.95
zPower System                                    35.00
zPower Pack Regcharg. Batt.            17.95

Links:
   Amiga Link                                    25.00
   Achimedes Link                      24.95
   Archimedes Link PipeDream           34.00
   BBC Link                                       8.95
   Mac Link                                      32.95
   PC Link II                                    29.79
   PC Link II/EazyLink                           51.06
   PC Link II to EasyLink Upgrade                29.79
   PC Link II ROM only                           20.00
   PCW Import/Export                             29.95
   QL Link                                       25.00
   zTerm Software                      43.47


Z88 DISK DRIVE

A number of disk drives have been made available for the Z88.  Two of
the systems, XOB and ZN-DOS, use the Tandy Portable Disk Drive 2
(PDD2) that was designed for the Tandy Model 100/102/200 laptop
computers.  Tandy created the PDD1 and PDD2, but only the PDD2 is
currently used on the Z88.  The Tandy Model 100/102/200 and the Z88
are ver similar in function and that they both do not have a disk
drive controller built into them.  The Tandy designers solved this
problem by putting the drive controller on the disk drive and had all
communications between the computer and the disk drive go across a
serial line.  All worries about the formating of the data on the disk
is handled by the disk drive.

The computer communicates with the disk drive by sending commands or
requests over the serial line.  The disk drive then responds to these
requests and returns the requested data to the computer.  Given a
knowledge of the drive commands and a proper serial connection, any
computer can interface with the PDD1 or PDD2.  Although ZN-DOS and XOB
only use the PDD2, it would not be a difficult task to write software
to utilize the PDD1.  The primary different between the two drives is
that the PDD2 has two "banks" of files where as the PDD1 only has one
"bank".  Each "bank" stores 100K of information.  For more technical
differences, see below.

Exchanging Files Between XOB and ZN-DOS

This has not been tested, but since the two systems use the same disk
drive, they should be able to exchange files easily.  A XOB user has
read the directory of a ZN-DOS disk, but has not tried to read any of
the files.

Reading PDD Files on other Computers

Using the proper serial connections, it is possible to get any
computer to communicate with the PDD disk drives.  Two freeware
programs are available for MS-DOS computers that let them read and
save files to the PDD.  This would allow Z88 users to transfer their
files off of the PDD disks to an MS-DOS computer.  These are available
off of the Club 100 web page.

Z88 to Portable Disk Drive Cable

The ZN-DOS cable goes to the PDD2.  The interface on the PDD2 is a
special square 8 pin connector.  The layout of the pins is below:

       ----------------
       !  1  2  3  4  !
       ----------------
            !----!        <-- Plastic Nub on connector

The XOB cable is reported to be a 9-pin to 25-Pin D connector (I have
not seen it).  I don't know if the drive is a PDD2 or PDD1, but most
likely a PDD1.

 Cable from ZN-DOS             Cable from XOB

  Z88         PDD2              Z88       PDD?
-------------------           -----------------

    1                            1  ------  13
    2  -------  5                2  ------  12
    3  -------  2                3  ------  11
    4  -------  4                4  ------  10
    5  -------  3                5  ------  9
    6                            6  ------  25
    7  -------  8                7  ------  24
    8  -------  7                8  ------  19 - 22 - 23
    9  -------  6                9  ------  19 - 22 - 23


Tandy Portable Disk Drive (PDD1 & PDD2) Command Reference

This command reference is provided so that if a Z88 users gets a hold
of a PDD1 or PDD2 without any Z88 drive software, they have the
information necessary to communicate with the drive.  It is also
usefull is a Z88 user finds the existing drive software lacking in
anyway and wishes to write their own.

General Reference

   Disks are single side 3.5 inch standard disks (DSDD will work).
   PDD1 - 40 tracks, 2 sectors, 1280 bytes/sector, 100K/disk.
   PDD2 - 80 tracks, 2 sectors, 1280 bytes/sector, 200K/disk.
     Treated as two banks of 100K each.
   Maximum file size = 64K
   Maximum number of directory entries (files) is 40 for PDD1 and 80
for PDD2.
   File names are maximum 24 characters (padded with trailing blanks)
although Tandy always used 6 for filename and 2 for filetype, with
period speperator (i.e. XXXXXX.TT).
   All communications with drive are at 19,200 bps.  Both drives have
dip switches so this can drop to 9600, 4800, and 1200 bps.  (ZN-DOS
uses 9600 bps as this is the fastest the Z88 can go.)

Command Format

All commands are in a request/return format (half-duplex).

General Request format:

     preamble  type  length  data  checksum

General Return format:

     type  length  data  checksum

Command Type

     Command          Request         Return

     Directory ref      00h            11h 12h
     Open File          01h            12h
     Close File         02h            12h
     Read File          03h            10h 12h
     Write File         04h            12h
     Delete File        05h            12h
     Format Disk        06h*           12h
     Drive Status       07h*           12h
     Drive Condition    0Ch*           15h
     Rename File        0Dh            12h

Request Command Details

Directory Reference  --  00h

   2   1  1   24            1        1           1       Bytes
+----+--+--+--------------+---------+-----------+------+
|5A5A|00|1A| filename     |attribute|search form|chksum|
+----+--+--+--------------+---------+-----------+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 00 hex 
   Length       - 1A hex
   Filename     - padded with blanks
   Attribute    - specify 'F' (not used normally)
   Search Form  -
           00h  - reference file for open or delete
           01h  - request first directory block
           02h  - request next directory block
           03h  - request previous directory block
           04h  - end directory reference
   Checksum     - (see below)


Open File  -- 01h

   2   1  1   1     1       Bytes
+----+--+--+------+------+
|5A5A|01|01| mode |chksum|
+----+--+--+------+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 01 hex 
   Length       - 01 hex
   Mode         - 
            01h - open new file for WRITE
            02h - open existing file for APPEND
            03h - open existing file for READ
   Checksum     - (see below)


Close File  --  02h

   2   1  1    1       Bytes
+----+--+--+------+
|5A5A|02|00|chksum|
+----+--+--+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 02 hex 
   Length       - 01 hex
   Checksum     - (see below)


Read File   --  03h

   2   1  1    1       Bytes
+----+--+--+------+
|5A5A|03|00|chksum|
+----+--+--+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 03 hex 
   Length       - 00 hex
   Checksum     - (see below)

Write File   --  04h

   2   1  1     1 - 128     1       Bytes
+----+--+-----+----------+------+
|5A5A|04|01-80|   data   |chksum|
+----+--+-----+----------+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 04 hex 
   Length       - 01 - 80  hex (actual length of data)
   Data         - Actual data
   Checksum     - (see below)


Delete File   -- 05h

   2   1  1   1       Bytes
+----+--+--+------+
|5A5A|05|00|chksum|
+----+--+--+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 05 hex 
   Length       - 00 hex
   Checksum     - (see below)

Format Disk    -- 06h

   2   1  1   1       Bytes
+----+--+--+------+
|5A5A|06|00|chksum|
+----+--+--+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 06 hex 
   Length       - 00 hex
   Checksum     - (see below)

Drive Status   -- 07h

   2   1  1    1       Bytes
+----+--+--+------+
|5A5A|07|00|chksum|
+----+--+--+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 07 hex 
   Length       - 00 hex
   Checksum     - (see below)

Drive Condition   -- 0Ch

   2   1  1    1       Bytes
+----+--+--+------+
|5A5A|0C|00|chksum|
+----+--+--+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 0C hex 
   Length       - 00 hex
   Checksum     - (see below)

Rename File   --  0Dh

   2   1  1   24            1         1       Bytes
+----+--+--+------------+---------+------+
|5A5A|0D|19| new name   |attribute|chksum|
+----+--+--+------------+---------+------+

   Preamble     - 5A5A hex  (always 'ZZ')
   Request      - 0D hex 
   Length       - 19 hex
   New Name     - new name for the file
   Attribute    - specify 'F' (not used normally)
   Checksum     - (see below)

Return Command Details

Read File Return   --  10h

  1  1    1    0 - 128        1       Bytes
+--+-----+--+--------------+------+
|10|00-80|1A| file data    |chksum|
+--+-----+--+--------------+------+

   Return       - 10 hex
   Length       - 00 - 80 hex (length of data)
      If length is equal to 80h, there may be more data -
         you must issue another read command.
      If length is less than 80h then this is the last block.
   File Data    - data read from file
   Checksum     - (see below)

Directory Reference Return  --  11h

  1  1   24               1      2    1     1       Bytes
+--+--+--------------+---------+----+----+------+
|11|1C| filename     |attribute|size|free|chksum|
+--+--+--------------+---------+----+----+------+

   Return       - 11 hex 
   Length       - 1C hex (length of data)
   Filename     - padded with blanks
   Attribute    - specify 'F' (not used normally)
   Size         - size of file
   Free         - numbers of free sectors ( multiply by 1280 for
bytes)
   Checksum     - (see below)

Normal Return   --  12h

  1  1   1         1       Bytes
+--+--+---------+------+
|12|01| error   |chksum|
+--+--+---------+------+

   Return       - 12 hex 
   Length       - 01 hex
   Error Code   -
     00h - normal                10h - file does not exist
     11h - file exists           30h - no filename
     31h - dir search error      35h - bank error
     36h - parameter error       37h - open format mismatch
     3Fh - end of file           40h - no start mark
     41h - CRC error in ID       42h - sector length error
     44h - format verify error   46h - format interruption
     47h - erase offset error    49h - CRC error in data
     4Ah - sector number error   4Bh - read data timeout
     4Dh - sector number error   50h - disk write error
     5Eh - un-initilized disk    60h - directory full
     61h - disk full             6Eh - file too long
     70h - no disk               71h - disk change error
   Checksum     - (see below)


Drive Condition Return  -- 15h

  1  1   1           1       Bytes
+--+--+-----------+------+
|15|01| condition |chksum|
+--+--+-----------+------+

   Return       - 00 hex 
   Length       - 01 hex
   Condition    - bit values

       7 6 5 4 3 2 1 0   bit
      +-+-+-+-+-+-+-+-+
      |0|0|0|0|x|x|x|x| 
      +-+-+-+-+-+-+-+-+
               | | | |
               | | | +-- power (0=normal, 1=low)
               | | +---- write protect (0=not prot, 1=prot)
               | +------ disk out (0=disk in, 1=disk out)
               +-------- disk change status (0=not changed, 1=changed)

   Checksum     - (See below)


Sequence of Events

Get Directory    - req 00 search form 01
                 - req 00 search form 02 (repeat as needed)

Write File       - req 00 search form 00
                 - req 01 mode 01 or 02
                 - req 04 (repeat as needed)
                 - req 02

Read File        - req 00 search form 00
                 - req 01 mode 03
                 - req 03 (repeat as needed)
                 - req 02

Rename File      - req 00 search form 00
                 - req 0D

Delete File      - req 00 search form 00
                 - req 05

Calculating Checksum

The checksum is "the one's compliment fo the least significant byte of
the number of bytes from the block format through the data block."  To
make matters simple, below is the formula for the checksum:

      checksum = (bytes MOD 256) XOR 255

where bytes equals the number of bytes including the Request Type,
Length, and all Data fields (but not including the preamble).


close$="ZZ"+CHR$(2)+CHR$(0)+CHR$(253)
dir1$="ZZ"+CHR$(0)+CHR$(26)+