Appendix C: AltairZ80 Setup

AltairZ80 Simulator with CP/M 2.2, and BDS C

Our setup includes the AltairZ80 simulator with binaries for Linux, MacOS and Windows, together with the configuration script to boot with four virtual floppy drive images and two virtual hard disk images.

The first two floopy disk images have been preloaded with files for running CP/M and BDS C, together with a collection of other CP/M programs.

Setup

Download CPM_AltairZ80_env.tgz. Extract the contents from the file by running:

$ tar xzvf CPM_AltairZ80_env.tgz

creating a AltairZ80 directory with the floppy and hard disk images, and the configuration script, cpm2.

Next download AltairZ80simWinMacLin.tgz, and extract the three versions of the simulator with:

$ tar xzvf AltairZ80simWinMacLin.tgz

Select the version of the simulator that matches your operating system, and move it into the AltairZ80 directory, renaming it to altairZ80. The linux version of this would be done with the command:

$ mv altairZ80linux AltairZ80/altairZ80

To prevent permissions issues on student macbooks, you may need to remove the apple quarantine on downloaded files.

$ xattr -d com.apple.quarantine altairZ80 cpm2

Finally, confirm that your setup works by changing your working directory to AltairZ80 and running:

$ ./altairZ80 cpm2

which should give you something like this:

Altair 8800 (Z80) simulator V4.0-0 Current        git commit id:     2887

64K CP/M Version 2.2 (SIMH ALTAIR 8800, BIOS V1.27, 2 HD, 02-May-2009)

A>

What You Get

Run the command dir at the command prompt, and you should see this:

A>dir
A: ASM      COM : BDOS     MAC : SYSCPM2  SUB : BOOT     MAC
A: SYSCPM2Z SUB : CBIOSX   MAC : CCP      MAC : CCPZ     MAC
A: CCPZ     TXT : CFGCCP   LIB : CFGCCPZ  LIB : COPY     COM
A: CPU      COM : CPU      MAC : CREF80   COM : DDT      COM
A: DDTZ     COM : MOVER    MAC : DO       COM : DSKBOOT  MAC
A: DUMP     COM : ED       COM : ELIZA    BAS : EX       MAC
A: EX       SUB : EX8080   COM : EXZ80ALL COM : EXZ80DOC COM
A: FORMAT   COM : GO       COM : HALT     COM : WORM     COM
A: HDSKBOOT MAC : L80      COM : LIB80    COM : LOAD     COM
A: LS       COM : LU       COM : M80      COM : MBASIC   COM
A: MC       SUB : MCC      SUB : MCCL     SUB : OTHELLO  COM
A: PIP      COM : EC8080   LIB : ECZ80ALL LIB : RSETSIMH COM
A: RSETSIMH MAC : SID      COM : W        COM : STAT     COM
A: SUBMIT   COM : SURVEY   COM : SURVEY   MAC : HDIR     COM
A: R        COM : SHOWSEC  COM : TIMER    COM : TIMER    MAC
A: UNCR     COM : UNERA    COM : UNERA    MAC : USQ      COM
A: SPEED    COM : WM       COM : WM       HLP : URL      COM
A: XSUB     COM : ZSID     COM : ZTRAN4   COM : BOOT     COM
A: BOOTGEN  COM : DIF      COM : SYSCOPY  COM
A>

The following table provides a brief description of the purpose of each of these files. With the exception of HDIR.COM, URL.COM, EC8080.LIB, and ECZ80ALL.LIB, all files documented here can also be found in this document.

Disk A

Filename

Purpose

ASM.COM

Assembly language compiler.

M80.COM

The Microsoft Macro-80 relocating assembler (outputs .REL files).

L80.COM

Links .REL files created by M80.COM to generate a .COM file.

MBASIC.COM

Microsoft BASIC-80 interpreter.

MC.SUB

A submit script that compiles assembler programs.

MCC.SUB

A submit script that reads and compiles a .MAC assembler program.

MCCL.SUB

LOAD.COM

A submit script that reads and compiles a .MAC assembler program, and writes the outputted .PRN file to the user’s host directory. Converts .HEX files to .COM files.

ZTRAN4.COM

Translates assembly language source code written with Intel mnemonics (e.g. 8080, 8085) into Zilog mnemonics (Z80).

CREF80.COM

Cross reference utility.

SUBMIT.COM

Runs .SUB files (essentially CP/M shell scripts).

XSUB.COM

Executes a submit script (.SUB file) just like SUBMIT.COM does, except XSUB.COM will not wait for interactive programs to finish execution before writing in the next line of the script.

DO.COM

Allows you to run a sequence of commands, but unlike SUBMIT.COM, these commands can be passed in on the command line rather than having to be placed in a .SUB file.

GO.COM

Runs whatever program is loaded at address 100H.

BDOS.MAC

Assembly source code for the Basic Disk Operating System (BDOS).

CBIOSX.MAC

Assembly source code for CP/M 2 BIOS.

LIB80.COM

A library manager that can can be used to create, modify, and view the contents of relocatable library files (.REL files).

LU.COM

Allows users to group (not compress) multiple files into a single library (.LBR) file. Also allows the user to maintain and pull data from .LBR files.

UNCR.COM

Un-crunches (decompresses) files that were compressed with a crunching alogorithm (usually .CQM or .CZM files).

USQ.COM

Unsqueezes (decompresses) a squeezed file.

UNERA.COM

Recovers files that were erased with ERA.

UNERA.MAC

Assembly source code for UNERA.COM.

COPY.COM

Duplicates an entire disk.

SYSCOPY.COM

Makes disk media bootable by writing the operating system tracks onto the disk tracks of another drive.

MOVER.MAC

Reusable assembly code that efficiently moves blocks of data from one memory location to another.

PIP.COM

Copies files.

LS.COM

Lists all the files on the current disk, as well as the size of those files and the amount of space remaining on the disk.

HDIR.COM

Lists the files in your host directory.

R.COM

Reads in files from the current SIMH directory.

W.COM

Writes files from CP/M into the user’s working directory (opposite of R.COM).

ED.COM

Text editor.

WM.COM

Visual text editor (“WM” stands for WordMaster).

WM.HLP

Documentation for WM.COM (WordMaster).

URL.COM

Writes a URL into a file. This is normally not possible to do without opening the file since lowercase characters aren’t usable in CP/M.

DUMP.COM

Displays the raw contents of a file in both hexadecimal and ASCII formats.

DIF.COM

Determines the differences between two files.

DDT.COM

Debugger for the 8080.

SID.COM

Debugger for the 8080.

DDTZ.COM

Debugger for Z80.

ZSID.COM

Debugger for Z80.

RSETSIMH.COM

Resets the SIMH interface (i.e., re-initializes communication between SIMH and the host computer).

RSETSIMH.MAC

Assembly source code for RSETSIMH.COM.

HALT.COM

Immediately halts CPU’s execution.

CPU.COM

Sets the CPU speed.

CPU.MAC

Assembly source code for CPU.COM.

SPEED.COM

Tests your CPU speed.

TIMER.COM

Creates a “stopwatch” that can be monitered (run TIMER.COM with no arguments to see usage).

TIMER.MAC

Assembly source code for TIMER.COM.

SURVEY.COM

Performs a system survery, displaying information such as the memory map, available IO ports, etc.

SURVEY.MAC

Assembly source code for SURVEY.COM.

STAT.COM

Allows the user to display and modify system information.

SHOWSEC.COM

Shows the sectors on a disk.

ELIZA.BAS

Basic source code for the therapist chatbot “Eliza”.

WORM.COM

A clone of the video game “Snake”.

OTHELLO.COM

The classic board game “Othello”.

FORMAT.COM

Formats disks to be usable in CP/M.

BOOT.COM

The boot loader that loads CP/M.

BOOT.MAC

The assembly source code for BOOT.COM.

BOOTGEN.COM

Creates a bootable media on a disk drive using the running version of CP/M.

DSKBOOT.MAC

Assembly source code for a modified cold boot routine to be put into ROM.

HDSKBOOT.MAC

Source code for a program that boots a hard disk.

EX.SUB

A submit script that executes (and tracks the execution times of) EX8080.COM, EXZ80DOC.COM, and EXZ80ALL.COM.

EX.MAC

Assembly source code for EX8080.COM, EXZ80DOC.COM, and EXZ80ALL.COM.

EX8080.COM

Exercises (tests) the 8080 instruction set.

EXZ80DOC.COM

Exercises (tests) the Z80 instruction set, not accounting for undefined status bits.

EXZ80ALL.COM

Exercises (tests) the Z80 instruction set, accounting for undefined status bits.

EC8080.LIB

Defines EX8080.COM as the instruction set exerciser to be built.

ECZ80ALL.LIB

Defines EXZ80ALL.COM as the instruction set exerciser to be built.

ECZ80ALL.LIB

Defines EXZ80ALL.COM as the instruction set exerciser to

CCP.MAC

Assembly source code for Console Command Processor (CCP).

CCPZ.MAC

Assembly source code for the Z80 version of the Console Command Processor (CCP).

CFGCCP.LIB

Configuration file for CCP.

CFGCCPZ.LIB

Configuration file for CCPZ.

CCPZ.TXT

Documentation on CCPZ, A Z80 Version of the CP/M CCP.

SYSCPM2.SUB

A submit script that creates a bootable image on disk A of CP/M with CCP.

SYSCPM2Z.SUB

A submit script that creates a bootable image on disk A of CP/M with CCPZ.

Now type B: at the command prompt followed by dir again. You will see this:

A>B:
B>dir
B: ACKER    COM : ACKER    SPL : BOOTGEN  COM : BOOTGEN  SPL
B: C        SUB : CALC     PRO : CR       SUB : DIF      COM
B: DIF      SPL : FAC      COM : FAC      SPL : FAMILY   PRO
B: FORMEL   COM : FORMEL   SPL : COPYC    SUB : CC       COM
B: INTEGER  PRO : KNAKE    PRO : LINKMT   COM : MTERRS   TXT
B: MTPLUS   000 : MTPLUS   001 : MTPLUS   002 : MTPLUS   003
B: MTPLUS   004 : MTPLUS   005 : MTPLUS   006 : MTPLUS   COM
B: PASCFORM COM : PASCFORM PAS : PASCFORM SUB : PASLIB   ERL
B: PINST    COM : PINST    SPL : PRIM     COM : PRIM     SPL
B: PROLOGZ  COM : PROLOGZ  SPL : PROLOGZ  TXT : PROLOGZU MAC
B: QUEEN    PRO : READ     COM : READ     SPL : RELDUMP  COM
B: RELDUMP  SPL : SHOWSEC  COM : SHOWSEC  SPL : SIEVE    COM
B: SIEVE    SPL : SPEED    SPL : SPL      COM : SPL      TXT
B: SPLERROR DAT : SYSCOPY  SPL : SYSCOPY  COM : WC       SPL
B: WC       COM : XFORMAT  SPL : WRITE    COM : WRITE    SPL
B: XFORMAT  COM : URL      SPL : SPLRTLB  REL : CC2      COM
B: CLINK    COM : C        CCC : DEFF     CRL : DEFF2    CRL
B: STDIO    H   : WM       COM : WM       HLP : CCONFIG  COM
B>

The following table describes the files on Disk B.

Disk B

Filename

Purpose

CC.COM

BDS C Compiler.

CLINK.COM

BDS C Linker.

CC2.COM

Second part of the BDS C Compiler. CC2.COM is responsible for finishing the compilation started in CC.COM, as well as generating the output .CRL file.

C.CCC

Run time initializer and sub-routine module.

DEFF.CRL

Default (standard) C function library used by CLINK.COM during the linking process.

DEFF2.CRL

More default C functions used by CLINK.COM during the linking process.

STDIO.H

Standard input and output C header file.

CCONFIG.COM

A utility program to customize the behavior of CC.COM and CLINK.COM (e.g., setting the default drive to compile/link files in, enabling/disabling console interrupts, etc.).

COPYC.SUB

Submit script that copies 7 files needed for BDS C to target drive.

READ.COM

Copies a file from the host directory into CP/M.

READ.SPL

Simple Programming Language source code for READ.COM.

WRITE.COM

Copies a file from CP/M into the host directory.

WRITE.SPL

Simple Programming Language source code for WRITE.COM.

WM.COM

WordMaster screen editor.

WM.HLP

WordMaster documentation.

RELDUMP.COM

Dumps the contents of a .REL file to the console.

RELDUMP.SPL

Simple Programming Language source code for RELDUMP.COM.

WC.COM

Word count summarizes word counts from an input file.

WC.SPL

Simple Programming Language source code for WC.COM.

DIF.COM

Finds and lists the differences between the contents of two files.

DIF.SPL

Simple Programming Language source code for DIF.COM.

FORMEL.COM

Command line integer calculator.

FORMEL.SPL

Simple Programming Language source code for FORMEL.COM.

FAC.COM

Calculates the factorial of a whole number.

FAC.SPL

Simple Programming Language source code for FAC.COM.

ACKER.COM

Calculates the Ackermann function.

ACKER.SPL

Simple Programming Language source code for ACKER.COM.

PRIM.COM

Prints out all prime numbers less than 1000.

PRIM.SPL SIEVE.COM

Simple Programming Language source code for PRIM.COM. Prints out prime numbers with a sieve.

SIEVE.SPL

Simple Programming Language source code for SIEVE.COM.

SPEED.SPL

Simple Programming Language source code for SPEED.COM.

URL.SPL

Simple Programming Language source code for URL.COM.

MTPLUS.COM

Pascal compiler.

MTPLUS.000

Pascal compiler file.

MTPLUS.001

Pascal compiler file.

MTPLUS.002

Pascal compiler file.

MTPLUS.003

Pascal compiler file.

MTPLUS.004

Pascal compiler file.

MTPLUS.005

Pascal compiler file.

MTPLUS.006

Pascal compiler file.

LINKMT.COM

Pascal linker.

PASLIB.ERL

Pascal run time library.

MTERRS.TXT

Pascal error messages.

PASCFORM.COM

Pascal formatter.

PASCFORM.PAS

Source code for PASCFORM.COM.

PASCFORM.SUB

A submit script that builds PASCFORM.COM.

PROLOGZ.COM

PROLOGZ interpreter and screen editor.

PROLOGZ.SPL

Simple Programming Language source code for PROLOGZ.COM.

PROLOGZ.TXT

Documentation for PROLOGZ.COM (in German).

PROLOGZU.MAC

Assembly source code for helper functions in PROLOGZ.

PINST.COM

Terminal installation program for PROLOGZ.

PINST.SPL

Simple Programming Language source code for PINST.COM.

FAMILY.PRO

Prolog family relations demo program.

CALC.PRO

Prolog calculator demo program.

QUEEN.PRO

Prolog N-queens problem demo program.

INTEGER.PRO

Prolog integer calculation demo program.

KNAKE.PRO

Prolog logic puzzle demo program.

SPL.COM

Compiles .SPL files into .REL files.

SPL.TXT

Documentation for SPL.COM.

SPLERROR.DAT

Error messages for the SPL compiler.

SPLRTLB.REL

SPL runtime library.

C.SUB

A submit script that compiles an Simple Programming Language (SPL) program.

CR.SUB

A submit script that reads and compiles an SPL program (same as C.SUB except it reads in the file from the host directory before compiling).

SYSCOPY.COM

Makes disk media bootable by writing the operating system tracks onto the disk tracks of another drive.

SYSCOPY.SPL

Simple Programming Language source code for SYSCOPY.COM.

SHOWSEC.COM

Shows the sectors on a disk.

SHOWSEC.SPL

Simple Programming Language source code for SHOWSEC.COM.

BOOTGEN.COM

Creates a bootable media on a disk drive using the running version of CP/M.

BOOTGEN.SPL

Simple Programming Language source code for BOOTGEN.COM.

XFORMAT.COM

Formats a disk (works with regular and hard disks).

XFORMAT.SPL

Simple Programming Language source code for XFORMAT.COM.

More information on the BDS C can be found at The BD Software C Compiler.