项目作者: ivanizag

项目描述 :
Portable CP/M emulation to run CP/M 2.2 binaries for Z80
高级语言: Rust
项目地址: git://github.com/ivanizag/iz-cpm.git
创建时间: 2020-04-19T12:37:05Z
项目社区:https://github.com/ivanizag/iz-cpm

开源协议:

下载


iz-cpm — CP/M 2.2 environment

What is this?

This is a CP/M 2.2 execution environment. It provides everything needed to run a standard CP/M for Z80 or 8080 binary.

Uses my iz80 library for Zilog Z80 and Intel 8080 emulation.

Made with Rust

Note that iz-cpm is a very basic implementation, mostly for educational purposes. I recommend MockbaTheBorg’s RunCPM or Udo Munk’s Z80pack for a much more complete CP/M emulation.

Installation

Extract the latest zip for Linux, MacOS or Windows. Optionally run download.sh or download.bat to download the CP/M 2.2 system disk, Microsoft Basic, Turbo Pascal, Lisp and some games.

Build from source

To build from source, install the latest Rust compiler, clone the repo and run cargo build --release. To cross compile to Windows, install the target with rustup and run cargo build --release --target x86_64-pc-windows-gnu.

Usage examples

Execute iz-cpm to open the CP/M command prompt (the CCP) on the current directory:

  1. casa@servidor:~/software/cpm22$ ls
  2. ASM.COM CCSINIT.COM DISKDEF.LIB iz-cpm STAT.COM
  3. CBIOS.ASM CCSYSGEN.COM DUMP.ASM LOAD.COM STDBIOS.ASM
  4. CCBIOS.ASM CPM24CCS.COM DUMP.COM MOVCPM.COM SUBMIT.COM
  5. CCBOOT.ASM DDT.COM ED.COM PIP.COM SYSGEN.COM
  6. -CCSCPM.251 DEBLOCK.ASM GENMOD.COM RLOCBIOS.COM
  7. casa@servidor:~/software/cpm22$ ../../iz-cpm
  8. iz-cpm https://github.com/ivanizag/iz-cpm
  9. CP/M 2.2 Copyright (c) 1979 by Digital Research
  10. Press ctrl-c ctrl-c to return to host
  11. A>dir
  12. A: CCSINIT COM : MOVCPM COM : CPM24CCS COM : STAT COM
  13. A: SYSGEN COM : STDBIOS ASM : IZ-CPM : LOAD COM
  14. A: DISKDEF LIB : ASM COM : RLOCBIOS COM : DUMP COM
  15. A: -CCSCPM 251 : CCBIOS ASM : DUMP ASM : CCSYSGEN COM
  16. A: DEBLOCK ASM : ED COM : SUBMIT COM : DDT COM
  17. A: PIP COM : CBIOS ASM : CCBOOT ASM : GENMOD COM
  18. A>

Execute iz-cpm with a file to execute a CP/M binary directly, bypassing the CPP:

  1. casa@servidor:~$ ./iz-cpm software/OBASIC.COM
  2. 44531 Bytes free
  3. BASIC Rev. 4.51
  4. [CP/M Version]
  5. Copyright 1977 (C) by Microsoft
  6. Ok
  7. print "hello"
  8. hello
  9. Ok

Map up to 16 directories as CP/M drives:

  1. casa@servidor:~$ ./iz-cpm --disk-a software/cpm22 --disk-b software/zork --disk-e .
  2. iz-cpm https://github.com/ivanizag/iz-cpm
  3. CP/M 2.2 Copyright (c) 1979 by Digital Research
  4. Press ctrl-c ctrl-c to return to host
  5. A>b:
  6. B>dir
  7. B: ZORK2 DAT : ZORK1 COM : ZORK3 DAT : ZORK3 COM
  8. B: FILE_ID DIZ : ZORK1 DAT : ZORK1 SAV : ZORK2 COM
  9. B>zork1
  10. ZORK I: The Great Underground Empire
  11. Copyright (c) 1981, 1982, 1983 Infocom, Inc. All rights
  12. reserved.
  13. ZORK is a registered trademark of Infocom, Inc.
  14. Revision 88 / Serial number 840726
  15. West of House
  16. You are standing in an open field west of a white house, with
  17. a boarded front door.
  18. There is a small mailbox here.
  19. >

Usage

  1. iz-cpm https://github.com/ivanizag/iz-cpm
  2. CP/M 2.2 Copyright (c) 1979 by Digital Research
  3. Press ctrl-c ctrl-c to return to host
  4. USAGE:
  5. iz-cpm [FLAGS] [OPTIONS] [ARGS]
  6. FLAGS:
  7. -t, --call-trace Traces BDOS calls excluding screen I/O
  8. -T, --call-trace-all Traces BDOS and BIOS calls
  9. -z, --cpu-trace Traces Z80 instructions execution
  10. -h, --help Prints help information
  11. -s, --slow Runs slower
  12. -V, --version Prints version information
  13. OPTIONS:
  14. --cpu <model> cpu model z80 or 8080 [default: z80]
  15. -a, --disk-a <path> directory to map disk A: [default: .]
  16. -b, --disk-b <path> directory to map disk B:
  17. -c, --disk-c <path> directory to map disk C:
  18. -d, --disk-d <path> directory to map disk D:
  19. --disk-e <path> directory to map disk E:
  20. --disk-f <path> directory to map disk F:
  21. --disk-g <path> directory to map disk G:
  22. --disk-h <path> directory to map disk H:
  23. --disk-i <path> directory to map disk I:
  24. --disk-j <path> directory to map disk J:
  25. --disk-k <path> directory to map disk K:
  26. --disk-l <path> directory to map disk L:
  27. --disk-m <path> directory to map disk M:
  28. --disk-n <path> directory to map disk N:
  29. --disk-o <path> directory to map disk O:
  30. --disk-p <path> directory to map disk P:
  31. --terminal <terminal> Terminal emulation ADM-3A or ANSI [default: adm3a]
  32. ARGS:
  33. <CMD> The binay image to run,
  34. <ARGS> Parameters for the given command

Features

  • Execution of 8080 and Z80 binaries on top of CP/M
  • Direct usage of the host computer filesystem
  • Terminal emulation of ADM-3A as used in the KAYPRO computers
  • Z80 emulation validated with ZEXALL
  • CPU execution tracing
  • BDOS and BIOS tracing
  • Portable, runs in Linux, MacOS and Windows. Mmm, not in CP/M.

How does it work

CP/M was designed to be portable to a variety of devices using Intel 8080, Intel 8085 or Zilog Z80 processors thanks to a tiered architecture. The main parts of CP/M are:

  • The BIOS: Basic Input/Output system. Interface with the hardware. CP/M defines a very small interface: 16 entrypoints to manage I/O and access to disk sectors. The hardware vendors provided the BIOS for their device based on source code available on the CP/M distribution.
  • The BDOS: Basic Disk Operating System. Main component of CP/M. Provided by Digital Research and common to all systems. Provides the high level entrypoints to be used by application developpers.
  • The CCP: Console Command Processor. The CP/M Command prompt.

To emulate this environment using the host filesystem, we have to provide a replacement BDOS translating as we don’t want to relay on the physical disk sectors abstraction of the BIOS. The main components are:

  • Z80 emulator. It uses iz80
  • BIOS emulator. Only the I/O entrypoints. In theory, it shouldn’t be necessary, but some programs use it directly, bypassing BDOS.
  • BDOS emulator. Traps the calls and executes code on the host.
  • CPP. Runs natively, no emulation needed. We use ZCPR1 an open source alternative. See cpmish for other open source alternatives to the CP/M binaries. The CPP binary from CP/M 2.2 can be used optionally.
  • Terminal emulator. CP/M does not define how the terminal should work. Applications needed to be aware and usually could be configured for several leading options, like ADM-3a, VT-52, Hazeltine 1500 and Osborne. This emulator supports ADM-3a used also on the very popular Kaypro computers.

TODO

  • Proper documentation
  • File level read-only option (I won’t do that, the host can control that)
  • BIOS support for punch cards (Nope)
  • BIOS support for track/sector access to disks (Not needed)