- Notifications
You must be signed in to change notification settings - Fork9
John Elliott's CP/M 2/3 emulator for crosscompiling and running CP/M tools under MS Windows (command-line and Cygwin) as well as Linux/Unix/macOS
License
GPL-2.0, GPL-2.0 licenses found
Licenses found
agn453/ZXCC
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is John Elliott's CP/M 2/3 emulator for cross-compiling andrunning CP/M tools under Microsoft Windows and Linux/Unix/macOS.The ability to run under MS-DOS/DR-DOS is no longer supported.
This repository has been initially extracted from John Elliott'sStable version 0.5.7 source-code at
http://www.seasip.info/Unix/Zxcc/zxcc-0.5.7.tar.gz
I have some updates that will be applied soon to remedy someissues that I found when using the latest version of theHI-TECH Z80 C compiler v3.09-x - obtainable from the repositoryat
https://github.com/agn453/HI-TECH-Z80-C
I welcome bug reports/fixes and additional commentry and discussion.
You can raise an issue here on GitHub or contact me directly via e-mailatagn453@gmail.com.
An apparent error in the source of the CP/M BDOS function 10 (readconsole buffer) emulation - courtesy of @tsupplis from his repositoryathttps://github.com/tsupplis/zxccp
The C compiler (zxc) front-end was not accepting HI-TECH C-stylecommand options that require filenames. It now accepts the following
-efile.com CP/M executable file name -ffile.sym Symbol-table for debugger or overlay creation -idirectory Include directory (in native format) -mfile.map Linker map file -crfile.crf Cross-reference listing
The linker (zxlink) should use the renamed HI-TECH linker(now linq.com).
Fix compilation warnings
Emulation of CP/M BDOS function 60 (call resident system extension)should be disabled and return 0xFF in both the A and L registers.
Change cpm_bdos_10() to return an unsigned result to avoid buffersize being interpreted as negative.
Fix the emulation of Z80 opcodes for IN (HL),(C) and OUT (C),(HL) -opcodes 0xED,0x70 and 0xED,0x71 respectively. Thisis noted in Fred Weigel's AM9511 arithmetic processing unitemulation fromhttps://github.com/ratboy666/am9511 in the howto.txtdescription. NB: I have not included Fred's am9511 support atthis time into ZXCC.
Russell Marks contributed a fix to the emulation of the Z80 DAA(decimal adjust) instruction - based on code from the yaze 1.10emulator. The original code in ZXCC was based on incorrect documentationof the DAA instruction in the Zilog and Mostek programming manuals (andeven in Rodney Zaks "Programming the Z80" book). The most recentdocumentation from Zilog has the correct description1. With thisfix in-place ZXCC is able to run the Z80 instruction emulatortest suite ZEXDOC from yaze-ag2. You can download a copy of theCP/M binary for ZEXDOC fromhttps://raw.githubusercontent.com/agn453/ZEXALL/main/zexdoc.com
Mark Ogden (@ogdenpm) has supplied some modifications to allowstdin redirection from a file, as well as a fix to the BDOS function 10bdos_rdline() routine to process new-line '\n' and '\r\n' correctlyfrom file input.
Further tweaks from Mark Ogden for Console Line input. A NULL charactercan now be read, and long-lines are truncated (as they would be on a realCP/M computer). Control characters are also echoed using the ^ prefix.For example, Ctrl-Z echoes as ^Z (and is read by the emulated programas on real CP/M).
More updates from Mark Ogden - this time to keep track of openfiles. CP/M does not care if you don't close a file open for input -whereas under ZXCC the operating system keeps a file handle foreach open file. This can have an effect when files are deleted orrenamed. There's a symbol FILETRACKER that's been added to theconfiguration file
winbuild/config-win.h
for the Windows build.Undefine this if you wish to restore the previous behaviour.Michal Tomek has added environment variables for BINDIR80,INCDIR80 and LIBDIR80 to allow overriding the compiled-in defaults.Also, the
bios.bin
file can be in the same directory as theZXCC executable or with the CP/M .COM files.More from Michal Tomek - Fix compilation under Cygwin on Windows andcorrect BDOS function 40 (Write with Zero-fill).
Mark Ogden has added the capability to build the ZXCC command-lineprograms under Microsoft Windows (using Visual Studio). You'll findbuild instructions in thewinbuild/README.mdfile. Further details concerning the changes are inchanges.md.
A fix was made so that any reference to the P: drive is now redirectedto the local default directory. Also, filenames under Windows can use eithera forward slash
/
or back-slash\
in the directory path.Mark Ogden has cleaned up a number of warnings for the Windows buildusing Visual Studio and fixed some issues with the install script whenit encountered spaces in a Windows directory pathname and the CPMDIR80environment variable determining the search paths for the CP/M binaries,libraries and include files.
Modified the compiler front-end (zxc) to support environment variablesfor INCDIR80 or CPMDIR80 and more changes to build with Cygwin on Windowsfrom Mark Ogden.
Finally fixed by Mark Ogden (much appreciated) is an issue that affectedthe processing of the
$$exec.$$$
file by HI-TECH C's batch processing.This changes the way ZXCC implements "exact file size" handling to match thatof Jon Saxton's and HI-TECH C (see theREADME.mdfile for details). Also, user area specifications on CP/M filenames havebeen removed - since they're not implemented by ZXCC.Fix parsing of spaces in the FCBs - resolving issue #39.
Look for CP/M COM file in current directory (emulated drive P:) beforethe binaries (in BINDIR80 emulated as drive A:).
The search for
bios.bin
on macOS should not use Linux-style/proc path.Add some hints on where to find some extra files. In addition to theprevious locations for
.COM
binaries,.LIB
libraries andobject files.OBJ
(in the bin80 and lib80 locations), ZXCC nowsearches for.HLP
,.MSG
and.OVR
files in bin80,.REL
in lib80 and.H
header files in include80. The Microsoft BASIC-80compiler run-timeBCLOAD.
can be in the lib80, and HI-TECH C optionshelpOPTIONS
in the bin80 locations.The exact file size changes have been reverted to behave like theoriginal John Elliott version - and now use the DOS Plus convention.The HI-TECH Z80 C behaviour has been altered too as at v3.09-13 tosupport this. Please see the HI TECH Z80 C repository athttps://github.com/agn453/HI-TECH-Z80-C for details and to updateto the latest version.
Jim Burlingame provided updates to the autotools build system toallow building under recent versions of Linux/Unix/macOS usingthe
./configure ; make ; make install
method. This has beentested and verified to work with Debian Bookworm (and variants)and macOS Sonoma (x86 and arm).Further updates to the autotools build system to permit buildingon systems with updated versions of the autotools scripts. I'veincluded the script file mentioned by Martin in the comments for issue #47to accomplish this if needed. You'll need to have the
automake
package(and prerequisites) installed to run the./update-configure.sh
script. On Linux usesudo apt install automake
or similar, andunder macOS with brew usebrew install automake
to install them.Martin contributed an update to add support to run the
OBJTOHEX.COM
tool with a newzxobjtohex
wrapper.I added some extra hints to support the Digital Research PL/I-80 V1.3compiler (
*.OVL
overlays in the BINDIR80 folder and the PL/IlibraryPLILIB.IRL
in the LIBDIR80 folder). Also fixed some missingprototypes to silence compiler warnings under macOS (using clang).Only the Windows build was using the FILETRACKER option to keep trackof the number of CP/M open files. To enable it under Linux/Unix/macOSyou need to manually enable it when running
./configure
usingthe--with-filetracker
option.To download, build and install this repository under Linux/Unix/macOSproceed as follows -
cd srcgit clone https://github.com/agn453/ZXCC.gitcd ZXCC./update-configure.sh./configure --prefix=$HOME --with-filetrackermakemake install
This will put the executable programs in your local
~/bin
directory;the documentation into~/share/zxcc/zxcc.doc
; complied objectlibraries forlibcpmio.a
andlibcpmredir.a
into~/lib
; and create the default CP/M heirarchy under~/lib/cpm/bin80
(where you place CP/M .COM files etc),~/lib/cpm/lib80
(for your CP/Mlibraries) and~/lib/cpm/include80
(for your CP/M programming includefiles like the system headers for HI-TECH-C). If you'd rather the files wereinstalled in the/usr/local
heirarchy, then omit the--prefix=$HOME
from the above./configure
command.I've refreshed the Windows Build files in
winbuild
and includedthe missing project build files for thezxobjtohex.exe
target.In addition, I backported the Visual Studiowinbuild/wzxcc.sln
solutionfile to support older versions back to at least Visual Studio 2015 whichcan produce Windows binaries (both x86 and x86_64).Fixed Linux/Unix/macOS build autotools configuration when bothFILETRACKER and debugging is enabled.
--
Tony Nicholson, Friday 20-Jun-2025
Footnotes
The most recent Zilog Z80 Family CPU User Manual (UM008001-1000)can be found athttp://www.zilog.com/docs/z80/z80cpu_um.pdf↩
You'll find the final version of yaze-ag 2.51.3 (as curated byAndreas Gerlich) athttps://agl.yaze-ag.de/↩
About
John Elliott's CP/M 2/3 emulator for crosscompiling and running CP/M tools under MS Windows (command-line and Cygwin) as well as Linux/Unix/macOS
Topics
Resources
License
GPL-2.0, GPL-2.0 licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.