# ZSOS

## Overview

ZSOS (Z80 SBC OS) is a CP/M 3 distribution for the S100Computers.com Z80 Single Board Computer. John Monahan of the S100Computers.com website designed this board as a “starter board” for new users to “bootstrap” an S-100 system from scratch. The S-100 Z80 SBC contains a Z80 CPU, ROM, RAM, an interface for an IDE drive or IDE→CF adapter, and a USB-based serial connection. Typically in the past, these functions would have required a set of 4 S-100 boards - the Z80 CPU (w ROM socket), a RAM card, a CF/IDE storage card, and a Serial I/O card.

For a complete description of the board including build instructions visit the S100Computers.com Z80 SBC Page.

## Credits

These images are based on John Monahan's original CP/M 3 BIOS for the S100Computers Z80 CPU & IDE boards, with the addition of contributions by David Fry for the LBA addressing code & CF compatibility improvements, Dave Mehaffy (aka yoda) for details of image creation, and testing by the members of the S100Computers Google Group.

### ZSOS Distribution

#### Latest/Current Version

• Choice of 2 images files:
• Non-banked CP/M 3 w/43K Transient Program Area
• Banked CP/M 3 w/53K Transient Program Area
• Includes support for a single drive on the CF card (A:)
• User Area 0: CP/M 3 Base Files
• User Area 1: XMODEM + Kermit + MBASIC 5.29
• User Area 2: SuperSoft Utilities
• User Area 3: DDTZ Debugger (will need to be built from source)
• User Area 4: BDS Tiny C
• User Area 5: Games
• User Area 6: Turbo Pascal 3.0
• User Area 7: Development Utilities
• User Area 8: <Available for additional user files>
• User Area 9: <Available for additional user files>
• Latest Windows cpmtools included in the .zip, along with Windows batch file and linux script to load User Areas 8 & 9
• Improved CF card compatibiliy. Thanks to David Fry for the debugging work to make this happen.
• CP/M I/O devices respect the IOBYTE switches on the Z80 SBC at boot, and can be remapped on the fly after boot.
• Added SWEEP.EXE to User Area 0
• Removed some files from User Area 0 that only worked under SIMH
• Latest Windows cpmtools included in the .zip, along with batch files and linux script to load User Areas 8 & 9

### Source Code & Development Environment

The ZSOS .zip file includes copies of all files that were modified from John M's original CP/M 3 files. For a description of the tools used to create these image files (without even having access to the Z80 SBC hardware!) see the ZSOS Development Environment page (Under Construction)

## Setting Up ZSOS on the S100Computers Z80 SBC

### Overview

This writeup covers the installation initial bring-up of the ZSOS CP/M 3 distribution on the S100Computers.com Z80 SBC. Please read through this carefully, many common questions/pitfalls are addressed.

The instructions below assume the following:

• The builder has completed the steps outlined on the board build page.
• The board booting and is operating properly with the SBC Monitor input/output working on the console device that the builder intends to use prior to trying to run ZSOS.
• The builder plans to operate SBC using the onboard RAM and ROM chips (configuration of jumpers for other RAM/ROM boards is outside the scope of this document).
• The only boards in the S-100 bus are the Z80 SBC and optionally the Propeller Console Board

It is recommended that the user start with the 'nonbanked' ZSOS image which is somewhat simpler in internal operation than the 'banked' image. The jumper configuration shown below is valid for either image.

### SBCMON Monitor ROM Version

For use with ZSOS v0.30 and higher, the Z80 SBC should be configured with the SBCMON Monitor ROM version 2.3 or higher. Updates were made in SBCMON 2.3 to allow the banked version of ZSOS to boot reliably and to improve CF card compatibility. SBCMON can be found on the S100Computers Z80 SBC page.

The recommended CompactFlash (CF) → IDE adapter is the SYBA IDE to CF Adapter, Direct Insertion, part number SD-CF-IDE-DI. It can be purchased from Amazon, eBay, and other sellers.

Jumper JP3 on the adapter should be set to the '2-3' position to allow the adapter to be powered from Pin 20 of the IDE connector, as shown in the photo below.

### Compact Flash Card Selection & Write Testing

Updates included in the most recent versions of the SBC Monitor ROM & ZSOS have greatly improved CF card read compatibility with the Z80 SBC. However some CF cards may still have problems with writes. Following a successful boot of ZSOS, the following command can be run at the CP/M A> prompt to verify writes are working:
PIP A:[VG10]=A:*.*[G1]
The expected output should be a list of files copied, and then a return to the A> prompt with no errors. The copied files can then be deleted using the following commands:
USER 10
ERASE *.*
USER 0

### Board Configuration

Click on the image below for an ultra-high resolution photo of the board. White jumpers have been installed to make the jumper configurations across the board clearly visible.

#### IDE Pin 20 Power

If using the recommended SYBA SD-CF-IDE-DI adapter, Jumper P104 can be installed on the Z80 SBC to send power to the adapter via IDE Pin 20. See photo below.

If using a different CF→IDE adapter than the recommended part, the user must confirm that the adapter can accept power over IDE Pin 20 and pass it to the CF card prior to installing this jumper. Accidental connection of this optional power signal to ground through an adapter that grounded IDE Pin 20 could result in damage to the user's S-100 hardware!

There are various speeds of Z80 CPU and 8255 parallel port interface chip available. The following table shows recommended I/O wait state configurations for maximum CF card compatibility. While developing ZSOS 0.30, 1 wait state was needed to achieve stable operation with an 8 MHz Z80 and a 5 MHz 8255.

The data in the table below is based on an extensive set of tests conducted with 3 different CF cards, 4 MHz and 8 MHz CPU oscillators, and 5 MHz and 8 MHz 8255 chips. However, chip to chip and system-to-system verification may still impact timings and these numbers should only be considered as a starting point.
Z80 Clock Speed (U46)8255 Rated Speed# of I/O Wait StatesTested?
4 MHz 5 MHz 0 Yes
4 MHz 8 MHz 0 Yes
8 MHz 5 MHz 1 Yes
8 MHz 8 MHz 0 Yes

Note: Operation of the Z80 SBC at 10 MHz was not successful during ZSOS development - the ROM Monitor would not come up, even with multiple combinations of RAM, I/O, and ROM wait states tested. This is consistent with John M's comments in the 'Running the Board at 8MHz' section of his write-up at S100Computers.com that 10 MHz operation is unreliable.

Jumper configuration for 0 I/O wait states:

Jumper configuration for 1 I/O wait state:

#### IOBYTE DIP Switchs

The configuration of the IOBYTE DIP switches is often a point of confusion for users of this board. The bits which are controlled by the DIP switches are attached to 'pull-up' resistor, and the switches connect to ground. So an open/off switch produces a '1' bit in the IOBYTE, and a closed/on switch produces a '0' bit in the IOBYTE.

The short explanation is:

• Bits are numbered from the right side (0) to the left (7). The left 2 DIP switches are not connected to anything, those bits are used instead as the status bits for the DLP USB→Serial adapter.
• Only bits 5, 1, and 0 are currently in use by SBC Monitor (2.3) and ZSOS (0.30).
• The default configuration set by the pull-up resistors (all DIP switches open/off/'1') uses the Propeller Console Board as the console.
• Setting Bit 5 to closed/on/'0' 'enables' Bit 1 and Bit 0
• Setting Bit 0 to closed/on/'0' re-directs console to the DLP USB→Serial adapter
• Setting Bit 1 to closed/on/'0' re-directs console to the DLP USB→Serial adapter

The photos below illustrate the switch numbering and some possible combinations.

The operation of the DIP switches is different between the SBC Monitor ROM and ZSOS. The SBC Monitor always respects the DIP switch positions. ZSOS reads the DIP switches during boot and sets an initial mapping of BIOS routines for the separate physical USBSER: and PRPCON: devices to the logical CON: CP/M 3 console. The CP/M 3 DEVICE utility can be used to remap the console input and output between devices from the CP/M 3 prompt - for example it is possible to boot with the SBC Monitor and initial ZSOS prompt on the DLP USB→Serial device, then run DEVICE and re-map to the Propeller Console board on the fly without rebooting. This is an example of the flexibility of CP/M 3 which allows for many physical character I/O devices to be defined and re-mapped to the logical devices by the user from the command prompt. Note that any remapping done with the DEVICE utility is lost on the next reboot.

### CompactFlash Card Preparation

Click on the thumbnails below to see screenshots of this process.

1. Download the latest ZSOS image from the main ZSOS wiki page.
2. Unzip the zip file.
3. Insert CF card into a USB card reader and attach to modern computer's USB port
4. Download the 'Etcher' software from https://etcher.io/. This is a cross-platform software for writing images to flash media such as CF, SD, etc. It limits the devices that it will flash to to removable devices to avoid accidentally overwriting operating system drives, etc.
5. Run the Etcher software (note - Etcher often takes a few seconds to load and appear even on fast PCs.)
1. Select the image to be written, either the 'banked' or 'unbanked' .img file.
2. An error message will appear that this does not appear to be a bootable image. Etcher does not know about the format of this CP/M image, so click 'Continue'.
3. 'Change'/select the drive to be written to with green check marks
4. Click the 'Flash!' button
5. After the flash is completed, a screen will be displayed showing that it was successful.
6. After flashing is complete, close 'Etcher' software
6. Eject/unmount USB drive and remove CF card

### First Boot

At this point, make sure your S100 system is turned off, insert the CF card in the CF→IDE adapter, and boot it up. When the SBC Monitor prompt has loaded, the 'P' command should boot into ZSOS. Click the thumbnail below to see a screenshot of a successful boot.

### CP/M 3 Manuals

The following CP/M 3 manual are available. Recommended for new users:

These manuals are also included in the ZSOS .zip distribution.

Additional files can be added to the image in User Area 8 and/or 9 by following the procedure below. For the purposes of this procedure, the 'version string' of the image is in the form zsos-x.yy, where x.yy is the version number of the image. For ZSOS v0.30, the version string would be zsos-0.30.

• Windows
• Copy the files to be added to the CF card image to the folders '8' and/or '9' within the unzipped ZSOS distribution folder.
• Open the Windows Command Prompt
• Change directories to the unzipped ZSOS distribution folder
• Run 'addusersfiles.bat' with the 'version string' as a parameter. For example, for ZSOS v0.30, the command to run would be adduserfiles zsos-0.30
• Linux
• Ensure you have the cpmtools package installed.
• Add the text in the diskdef-s100ide file to the top of the file /etc/cpmtools/diskdefs.
• Copy the files to be added to CF card image to the directories '8' and/or '9' within the unzipped ZSOS distribution directory.
• Open a bash terminal
• Change directories to the uzipped ZSOS distribution directory.
• Run 'adduserfiles.sh' with the 'version string' as a parameter. For example, for ZSOS v0.30, the command to run would be ./adduserfiles.sh zsos-0.30

New files named 'zsos-x.yy-banked-extended.img' and zsos-x.yy-nonbanked-extended' will be created. Select either the nonbanked or banked image and proceed with the instructions above for writing to a CF card.

## Where to get additional CP/M Software

There is a huge archive of CP/M software at http://www.classiccmp.org/cpmarchives/