Skip to content

CP/M for the Z80 Playground that runs on the FAT disk format

License

Notifications You must be signed in to change notification settings

skx/z80-playground-cpm-fat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This repository contains a distribution of CP/M 2.2, which can run upon the "Z80 Playground" board. The Z80 Playground single-board computer uses an external FAT-filesystem stored upon a USB-Stick to provide storage, giving it very easy interoperability with an external computer.

For more details of the board please see the official homepage:

Contents

This repository contains two things:

  • The assembly language source-files which will build CP/M.
  • A set of binaries, organized into distinct drives, which can be copied to your USB-stick to produce a useful system.
    • Some of the binaries are generated from the sources beneath utils/, others are were obtained from historical release archives.

Source Code

The source code available here is made of a couple of different files:

You can compile these via the pasmo compiler, or look at the latest versions upon our releases page. If you have make and pasmo installed you can generate the compiled versions via:

 $ make

(The system will rebuild intelligently if you edit any included files.)

Regardless of whether you build from source, or download the prebuilt versions, you should place them upon your USB-stick beneath the top-level /CPM directory.

Bootloader

To get the system started there is a boot loader compiled and stored within the EEPROM. If you have a EEPROM programmer you should upload the contents of CPM.HEX to it, which is compiled from cpm.asm.

The bootloader runs a simple monitor and allows CP/M to be launched. Launching CP/M involves reading /CPM/cpm.cfg which contains the list objects to read into RAM, along with the addresses to which each should be loaded. Once the files are loaded the system jumps into the monitor, from which you can launch CP/M, TinyBASIC, & etc.

CP/M Distribution Overview

The full content of the USB stick supplied with the kit can be found beneath the dist/ directory.

CP/M doesn't have the concept of sub-directories, so all files are arranged at the top-level, however for organization different "drives" are used. To help keep things organize I've shuffled some of the contents around such that the binaries are grouped into a set of logical collections:

Drive Contents Notes
A: All general-purpose utilities.
B: BASIC Code and interpreter. Type SYSTEM to exit :)
C: AzTec C Compiler Simple overview
D:
E: Editor - WordStar
F: FORTH - DxForth
G: Games - all types
H:
I:
J:
K:
L:
M:
N:
O:
P: Turbo Pascal 3.00A Getting started with Turbo Pascal.

To look at the list of games, for example, you'll run something like this:

A> G:
G> DIR
..

Or:

A> DIR G:*.COM

CP/M System Changes

In terms of changing the system-core I have patched the CCP (command-processor) component of CP/M to change a couple of things:

CLS

There is a new built-in command CLS which will clear your screen.

Search Path

I've added a naive "search path", which allows commands to be executed from a different drive if not found in the present one. By default the system is configured to search for binaries which were not found within the A: drive:

 A>srch
 Search drive set to A

If you wish to disable this run SRCH 0, otherwise you can change the drive:

 B>srch a
 Search drive set to A
 B>srch b
 Search drive set to B

Input Handling

I've updated the input-handler ("Read Console Buffer" / BIOS function 1) such that:

  • The backspace key deletes the most recently entered character.
    • (This is in addition to the keystroke C-h continuing to work in that same way.)
  • Ctrl-c cancels input.
    • (It returns an empty input-buffer, so it allows easy discarding.)

Now these two keystrokes work in a natural fashion at the CP/M prompt.

Removals

I've removed the undocumented (imp)ort and (exp)ort commands, to cut down on space, and avoid confusion.

This meant I could remove a little code from the CCP source, includeing:

  • debug:
  • ADD32: / SUBTRACT32:
  • display_hl32: and show_c_in_hex:

If required those could be replaced by the existing code in message.asm - just add an include and use them as-is.

TODO?

Possible future changes might involve:

  • Optimize for size.
  • Look at message.asm
    • Which is a bit of a messy piece of code.

CP/M Binaries

  • I've added a copy of DX Forth beneath F:.
  • I've added a copy of the Turbo Pascal compiler beneath P:.
  • I've added Zork 1, 2, & 3 beneath G:.
    • I've designated the G: drive as the game-drive, and moved other games there too.
  • I added vi.com to A:.
  • I added ql.com ("quick list")
  • I added a couple of simple utilities to A:, with source beneath utils/:
    • locate.com
      • Find files matching a given pattern on all drives:
        • LOCATE *.COM.
      • or show all user-numbers which contain matches upon a single drive:
        • LOCATE A:*.COM USER.
        • Note that user-numbers seem to be slightly broken in this distribution.
    • monitor.asm
      • Jump back to the monitor, from within the CP/M environment.
      • Essentially page in the ROM, then reboot.
  • I removed duplicate file-contents from various drives.
  • The copy of ls.com located upon the A: drive has been updated.

Bootloader Changes

  • I've patched TinyBASIC such that the EXIT keyword will restart the system.
    • Otherwise there was no way back to the BIOS/menu short of hitting the reset-switch.

Useful Links

This repository contains a copy of Turbo Pascal, along with a guide to using it, you can find a couple of simple games online here:

Future plans?

  • Optimize some of the assembly for size.
    • Obvious easy-win is replacing instructions such as ld b,0 with xor b.
  • Make a couple of minor changes to ccp:
    • Would be nice to have command-history, accessible via M-n/M-p, or the arrow-keys.
    • I added cls.com, it might make more sense to build that into the CCP-shell.

About

CP/M for the Z80 Playground that runs on the FAT disk format

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Assembly 99.4%
  • Other 0.6%