Emulating CP/M under Linux

6

2

I need to be able to run a very old piece of software -- the HI-TECH z80 C Compiler for CP/M. It has been released as freeware by HI-TECH. Alas, it only runs on CP/M.

After a lot of Googling, I found a page of utilities for UZIX. One of those utilities is a script to abstract away the emulation of a CP/M machine, thus allowing you to use the compiler as you would any other UNIX program. The problem with this script is that it depends on their own CP/M emulator, which unfortunately will not compile on a modern (x64) system.

My question: is there a usable CP/M emulator for Linux that could be used in a similar fashion? Specifically, I need to be able to somehow have it access files from the host system, a la DOSBox. I'm willing to rewrite a script (I don't have to re-use the UZIX one); I just need an emulator. Thanks for any help!

thirtythreeforty

Posted 2012-12-09T02:30:40.653

Reputation: 946

Darn! I knew I shouldn't have gotten rid of my Osborne! – fixer1234 – 2014-11-18T21:48:55.113

Why do you need to use that z80 C compiler? There are others...

– Dan D. – 2012-12-09T04:16:31.040

1@DanD. The codebase I have was built for that compiler. Also, HI-TECH's produces higher quality code. – thirtythreeforty – 2012-12-09T04:19:55.957

Answers

8

I think z80pack would work well for you. I use it under 64-bit Linux and there are tools available to move files easily between the emulated and host file systems. I wrote a couple of articles a while ago that you may find useful:

Setting up z80pack to create an emulated CP/M sytem

Installing the HI-TECH Z80 C Compiler for CP/M

Lawrence Woodman

Posted 2012-12-09T02:30:40.653

Reputation: 196

Wonderful; exactly what I was looking for. I should point out that the link to the HI-TECH compiler in your second article is broken, though. – thirtythreeforty – 2012-12-10T23:40:07.130

@gh403 Glad you found it useful. Thanks for letting me know about the links, I have updated the article with new ones. – Lawrence Woodman – 2012-12-11T07:06:00.033

3

I know this is an old question, but the one I use is this:

https://github.com/jhallen/cpm

It's big advantage over z80pack is that it can emulate the BDOS as well, with the Unix CWD mapped as CP/M drive A:. So you don't need to fiddle around with disk images. You can also wrap scripts around it, for running stuff like Hitech C from Unix. There's even a built-in debugger (which you break into with ^C, which is a little confusing).

David Given

Posted 2012-12-09T02:30:40.653

Reputation: 593

My answer still stands, but I had to give up on it due to unknown provenance and licensing, sadly. (It borrows code from all over the place and doesn't attribute it properly.) I ended up writing my own; it's not as full featured as the one linked above, but is good enough for running compiler tests (and has a built-in debugger). https://github.com/davidgiven/cowgol/tree/master/emu/cpm

– David Given – 2018-04-04T23:02:02.193

3

The dosbox program, in spite of its name, is actually a old-style PC emulator that can boot other OS as well.

Check this out:

http://compgroups.net/comp.os.cpm/using-dosbox-to-run-cp-m-86-on-modern-hardware/297836

But I haven't tried it myself.

For Z-80 emulation you might try the TRS-80 emulators, which used a Z-80 chip. I believe you can run CP/M on this also.

http://www.trs-80.com/wordpress/cpm/

Keith

Posted 2012-12-09T02:30:40.653

Reputation: 7 263

CP/M-86 and CP/M-80 are for different architectures. – Thorbjørn Ravn Andersen – 2018-04-26T07:21:27.480

Interesting... however, I think the HI-TECH compiler was compiled for z80, and DOSBox only emulates the x86 architecture. Unless I'm totally misunderstanding this? – thirtythreeforty – 2012-12-09T03:20:27.553

Oh, sorry, missed that part. – Keith – 2012-12-09T03:23:23.607

Good idea. Although the TRS-80 page you linked to doesn't even mention Linux. – thirtythreeforty – 2012-12-11T01:03:26.603

@gh403 But I have tried that and I know it runs on Linux. I once had 100 TRS-80s running on my one Linux box. :-o – Keith – 2012-12-11T01:05:03.133

1

ZXCC was written specifically to run Hi-Tech C within UNIX -- it emulates at BDOS level, so directories on the host system are transparently presented as CP/M drives. It also includes wrappers for the Hi-Tech C compiler and linker.

john_e

Posted 2012-12-09T02:30:40.653

Reputation: 646

0

Would this one written in java help??:

http://www.viara.eu/en/j80/J80doc.html

Blisk

Posted 2012-12-09T02:30:40.653

Reputation: 754

Maybe. How would I access the host OS's filesystem? – thirtythreeforty – 2012-12-09T04:20:54.553

I don't think I can help out on this one. Sorry.

I could suggest maybe installing a virtual machine of a 32bit linux OS and seeing if that helps compiling of it? It might be just that it doesn't like your 64 bit OS as is dependent on some libraries in the 32 bit and isn't inherent incompatible with compiling on x86 architecture? My best guess for help on this one. – Blisk – 2012-12-09T04:28:40.610

Hm. That's a possibility, I suppose. However, I'm going for the minimum number of emulation layers here ;) – thirtythreeforty – 2012-12-09T05:02:31.530