----- Z 8 0 D O S ----- CP/M Compatible Z-80 Disk Operating System Featuring Enhanced Integral File Date and Time Stamping Version 1.0 October 1, 1987 by Carson Wilson The author assumes no responsibility for losses resulting from the use or inability to use Z80DOS10.LBR. The parts of Z80DOS10.LBR created by Carson Wilson are hereby released to the public. CONTENTS 1. What is Z80DOS? 2. What is your purpose in releasing Z80DOS? 3. What are the differences between Z80DOS and CP/M? - CP/M function calls. - Modifications affecting several functions. - Additional function calls. 4. How does Z80DOS compare with some of the other BDOS replacements currently available? - Comparison of replacement disk operating systems for CP/M 5. How do I install Z80DOS on my system? - Installing DOS segment - Installing BIOS segment (optional) 6. What do the programs in Z80DOS.LBR do? 7. Acknowledgements 1. What is Z80DOS? Z80DOS is a replacement for CP/M's Basic Disk Operating System, or BDOS, for computers having a Zilog Z80 microprocessor. The BDOS is the module of CP/M which allows for standardization of CP/M programs by supplying "system calls" which are the same across the many different CP/M hardware configurations. It acts as an interpreter between application programs and your system's Basic Input Output System, or BIOS. Z80DOS supports all of the standard CP/M 2.2 BDOS functions, and adds several new functions and enhancements. All programs designed to run under standard CP/M will also work under Z80DOS. Programs designed to run under Z80DOS can take advantage of enhancements to the BDOS to perform functions not available under standard CP/M. Z80DOS fits in the same area of memory used by CP/M's BDOS. This makes it simple to install Z80DOS in any working CP/M system. By coding the BDOS in Z80 assembler, it is possible to fit more functions within the standard 3.5 kilobytes of memory allowed by CP/M. 2. What is your purpose in releasing Z80DOS? Z80 Replacement Disk Operating System, or ZRDOS (tm), by Echelon, Inc., has become a standard among many Z80 computer users. ZRDOS offers many important advantages over standard CP/M's BDOS, and I applaud the new standard ZRDOS has created. ZRDOS is lacking in one crucial area, though: it does not implement date and time stamping of files. ZRDOS users must rely on DateStamper (tm) by PluPerfect Systems, a separate program which requires additional memory and files and considerable programming overhead to use. Z80DOS solves these problems by making date and time stamping an integral part of the operating system (as do several of the other BDOS replacements below), and by implementing two new BDOS functions exclusive to Z80DOS which allow programs that modify or copy files to maintain file stamps with very little program overhead (as does no other current BDOS replacement). Z80DOS is a fully operational replacement BDOS for CP/M, and is the only BDOS I use on my own system. However, Z80DOS does lack some of the advanced features of ZRDOS (see table below). My purpose in releasing Z80DOS is not to supplant ZRDOS, but simply to generate interest in the ideas it contains. If you find the ideas used in Z80DOS worthwhile, please help by introducing others to Z80DOS.LBR. If widely accepted, the time stamping protocols of Z80DOS could form the basis for a file-stamping standard for Z80 computer users. 3. What are the differences between Z80DOS and CP/M? 3.1. CP/M function calls. Z80DOS makes the following modifications to the CP/M standard functions: - CP/M Function - --------------- Z80DOS Modification(s) ----------------- No. --- Name --- 2 Console out After 256 characters output, console status is checked. This makes it possible to exit a program by typing control-s followed by control-c. This feature is normally on, and may be turned off by setting bit 0 of address Z80DOS+19 to zero. 10 Read console Delete key is same as backspace. Control-u, control-r, and control-e are simply echoed to the screen. 15 Open file File access date and time are changed to reflect the current DOS date and time. If the f2 attribute bit is set, the file is available from all user areas on a drive (this is also the case with Search First and Search Next). 16 Close file If the file was written to, its update date and time are changed to the current DOS date and time, and its archive attribute (t3) is reset to zero. 19 Delete file To prevent accidental erasure, public files (see below) and system files can only be erased from their home user area by using unambiguous file names. 22 Create file File create date, modified date and time, and access date and time are set to current DOS date and time. 3.2. Modifications affecting several functions. When Z80DOS detects a changed disk, it resets the disk system rather than aborting with a read-only error message as CP/M does. Files may be made "public" (available from all user areas on a disk) by setting the high bit of the second character of their filename (f2 bit). Public files cannot be referenced by wildcards. This feature is normally on, and may be turned off by setting bit 1 of address Z80DOS+19 to zero. Disks of up to one gigabyte and files of up to 32 megabytes are possible under Z80DOS. Z80DOS provides the user with more information when an error occurs. The type of error, the function call which produced the error, the drive letter, and the filename (if any) associated with the function call are all displayed. 3.3 Additional function calls. Z80DOS adds the following non-standard functions to CP/M: --- Function ---- -------------------- Description ----------------------- No. --- Name --- 54 Get stamp Following a successful Open File, Search First, or Search Next call, retain the file's full 10 byte date and time stamp for future use, and return a pointer to the stamp in HL. If no stamps are present, store zeroes. 55 Use Stamp Use creation date and last modified date and time stored by Get Stamp instead of real time for the next Write, Make File or Close File call. 104 Set time Set the system time to the values pointed to by DE (BIOS dependent; see Z80DTIME.Z80 for format). 105 Get time Fill the five bytes pointed to by DE with the current date and time. 4. How does Z80DOS compare with some of the other BDOS replacements currently available? 4.1. Comparison of replacement disk operating systems for CP/M: Name | CP/M ZRDOS+ Z80DOS P2DOS21 DOS+25 SUPERDOS -------+------------------------------------------------------------------- Author | Digital Echelon, Carson H.A.J. C.B. Benjamin | Research, Inc. Wilson Ten Falconer Ho | Inc. Brugge | Deriv- | Unknown Unknown P2DOS, Unknown P2DOS P2DOS ation | SUPERDOS | Time | No No (*)C,U,A C,U C,U,A C,U stamps | | Disks | No Yes Yes No No Yes auto- | login | | Archive| No Yes Yes Yes Yes No | Public | No Public F2 F2 System F2 files | user attribute attribute files attribute | areas at A0: | Get/Use| No No Yes No No No stamps | | Get/Set| No No Yes Yes Yes Yes time | | Error | Cryptic Clear Legible, Legible, Legible, Legible, messgs.| give give give give | function function function function | & file & file & file & file | Return | No Yes No No Yes No current| DMA | | Wheel- | No Yes No No No No protect| files | | Set/res| No Yes No No No No warm | boot | | Source | No No Yes Yes $50 Yes code | | Approx.| $20 $60 free free free free price +----------------------------------------------------------------- (*) C = Create, U = Update, A = Last Access 5. How do I install Z80DOS on my system? 5.1. Installing BDOS segment To install Z80DOS in your CP/M system, you will need: 1. A Z80 assembler 2. Digital Research's MOVCPM.COM, SYSGEN.COM, and DDT.COM or the equivalents You must first set the options and addresses in Z80DHDR.LIB to match your particular system and tastes. See instructions in Z80DHDR.LIB. Then you will need to assemble Z80DOS to a hex file. Finally, you will use SYSGEN.COM to overwrite the sections of the system tracks on your system diskettes which presently contain CP/M's BDOS with Z80DOS. If you are familiar with the process of patching your operating system with hex files, the file Z80DOS.BLD should give you enough information to install Z80DOS. If you have never before altered your operating system, you may want to consult one or more of the following references for more information before proceeding: Conn, Richard. Z3INSTAL.LBR. 132 kilobyte public domain library file describing Conn's Z80 Command Processor Replacement (ZCPR). Available on Z-Nodes worldwide. Conn, Richard. ZCPR3: The Manual. (New York: New York Zoetrope, Inc., 1985). Johnson-Laird, Andy. The Programmer's CP/M Handbook. (Berkeley: Osborne/McGraw-Hill, 1983). Miller, Alan R. Mastering CP/M. (Berkeley: SYBEX, Inc., 1983) Waite, Mitchell, and Robert Lafore. Soul of CP/M (How to Use the Hidden Power of Your CP/M System). (Indianapolis: Howard W. Sams & Co., 1983). 5.2. Installing BIOS segment (optional) To implement time stamping under Z80DOS, you will need in addition: 1. Source code for your BIOS 2. A real-time clock or four bytes of reserved RAM memory To implement time stamping, you will need to modify and reassemble your BIOS and overwrite your system tracks with the new BIOS using the techniques described in Z80DOS.BLD and in the above references. The offset at which to load the hex image of your BIOS is the same number used to load the hex image of Z80DOS in Z80DOS.BLD. You needn't have a real-time clock in your computer to implement date stamping, just an area of memory to hold the current date and time. BIOS.TIM includes an example BIOS time inserts which use memory to hold the time. Finally, before Z80DOS will do date and time stamping, you must run INITDIR.COM (included) on your disks. This sets aside extra space in your disk directories for time/date stamps (See Z80DPROG.NOT). 6. What do the programs in Z80DOS.LBR do? INITDIR.COM initializes directories for time stamping by clearing the fourth entry in each directory sector and flagging its user area byte with 21 hex. This tells Z80DOS that this entry is to be used for holding the time and date stamps of the other three directory entries in the sector. See Z80DPROG.NOT for a complete description of the format used. For help using INITDIR.COM, type INITDIR. PPIP.COM is a public domain file copy utility which I have adapted for use with Z80DOS by enabling it to copy file date and time stamps along with files. PPIP has many useful options such as file archiving. For help with PPIP.COM, type PPIP or see PPIP.DOC, which is available in PPIPnn.LBR on many bulletin boards. SAVESTMP.COM is my own program which copies the creation date from one file to another. SAVESTMP is designed to bridge the gap between an advanced operating system which implements creation date file stamps and programs such as word processors which do not recognize time stamps. NewWord, for example, always erases the source file when modifications are performed, and in so doing loses the file's date of creation. To compensate for this, SAVESTMP can be used to save the original creation date by copying it to a zero-length file before editing and then restoring the creation date from the zero-length file after editing. This is best done using aliases under ZCPR, but could also be implemented with CP/M's SUBMIT.COM. Here is a simple sample ZCPR alias named MODIFY which implements this idea: MOD.IFY savestmp ROOT:DATEHOLD=$1;vde $1;savestmp $1=ROOT:DATEHOLD To edit a file, the user would type "MODIFY MYFILE". MYFILE's creation date would be copied to DATEHOLD (or any other file) prior to editing, then after editing, the creation date would be copied back to MYFILE. This ZCPR alias could be elaborated on with file existence checks, etc. Although I have tested SAVESTMP fully on my own system, it does make BIOS calls and writes directly to directory tracks, so please test SAVESTMP.COM on a dispensable diskette before using it extensively. My thanks to Rick Charnes, whose concern about lost creation dates inspired SAVESTMP.COM. For a brief help message, type SAVESTMP. TDIR.COM or "TIMEDIR.COM" is a directory utility which displays Z80DOS creation, modification, and last access stamps along with individual and total file size, number of files matched, and kilobytes free. TDIR will also display file attributes (such as read-only) using video display features when patched for your terminal. To patch TDIR, look for the ASCII labels "[VIDON>" and "[VIDOFF>" near the beginning of the file. After VIDON, you may patch in a string to turn a video attribute on (I use dim and reverse video on my system). A string to turn the attribute back off goes after VIDOFF. The strings may be up to 6 bytes long, but MUST be terminated with a dollar sign. TDIR is derived from DDIR, by H.A.J. Ten Brugge. For help with TDIR.COM, type "TDIR /". TELL.COM is a public domain utility which tells you information about your operating system. It is included for use in installing Z80DOS.COM. To use, just type TELL. TIME.COM sets or displays the date and time from the real-time clock or section of memory devoted to time storage on Z80DOS system. TIME.COM will only function once the proper BIOS routine has been installed. If you lack a real-time clock, you may wish to run TIME once each time you start your system, by using AUTO.COM on a CP/M system, or installing the TIME command in the STARTUP alias of a ZCPR system. For help, type TIME. TIME.COM was adapted from a program of the same name by C. B. Falconer. ZF10GD5.COM is for use on ZCPR systems only. This is the popular ZFILER program, modified by adding 31 bytes of code to copy Z80DOS date and time stamps when copying, moving, archiving, or unsqueezing files. 7. Acknowledgements The main body of Z80DOS is my adaptation of P2DOS, version 2.1, by H.A.J. Ten Brugge, Molenstraat 33, NL-7491 BD Delden, The Netherlands, all rights reserved. The date stamping format of Z80DOS and the programs TIME and INITDIR were adapted from DOS+, version 2.5, by C. B. Falconer, 680 Hartford Tpk, Hamden, CT 06517, all rights reserved. The method Z80DOS uses to automatically log in changed disks is an adaptation of the scheme presented by Benjamin Ho of Evanston, IL in his SUPERDOS.LBR. Please let me know what you think of Z80DOS. I will be happy to explain the goals and techniques of Z80DOS to programmers and developers or to assist anyone in adapting programs to Z80DOS. I can be reached thru messages to Carson Wilson at: Lillipute Z-Nodes, Chicago 312-664-1730 and 312-649-1730 8-1-No Parity 24 hours Best Wishes!