cancel
Showing results for 
Search instead for 
Did you mean: 

Z80 emulation on a Cortex M3/M4 ?

frankmeyer9
Associate II
Posted on May 15, 2012 at 14:39

Has somebody tried to port a Z80 emulator to a Cortex M3/M4 device ?

I'm experimenting with the emulator core as found there:

http://

My preferred host is this:

http://

I'm quite sure that M3 devices with sufficient controller performance are available.

A full CP/M simulation is out of scope at the moment (mostly because of time...).

The target(s) I have in mind feature 4...20kB ROM and  16..32k RAM, and have a smaller, ROM based ''OS'', actually more a simple program loader than an OS.

A CP/M emulation (64k RAM) would hardly be possible with a M3 without external RAM.

The host (stm32-lcd) has a display and mass storage, and at least the possibility to add external RAM to emulate the full 64k address range of the Z80.
11 REPLIES 11
bjfree
Associate II
Posted on May 16, 2012 at 02:32

Been using the z series since the 70's.

did a emulator for the 68000 (mac) decades ago.

here is the problem with emulators. They take a lot of space, since their data path is larger than 8bits an the addressable memory is base on their architecture. So like the stm32f103, your addressing 32bits at a time to read 8bit code.

 I chose, over the years, to use a form of cross compilier. based on the GCC code.

I also use a realtime multiple threading CPM which i have the C code to.

I last used it on the PowerPC

frankmeyer9
Associate II
Posted on May 16, 2012 at 13:08

I'm currently evaluating the possibilities, and have not yet done much with emulators.

But considering the ressources of the given board or M3 controllers in general, I do not intend to emulate the whole hardware.

I'm fully aware that this drastically limits the target SW compatibility. My primary target is relatively simple, it has 2k monitor ROM, 16k RAM, 1k display RAM and one Z80 PIO. My idea is to catch the monitor subroutine entries, display RAM writes and IO/PIO accesses to redirect it to host routines, and just emulate the CPU otherwise.

Doing a full CP/M system emulation is clearly out of my time horizon at the moment, as this is no commercial project.

bjfree
Associate II
Posted on May 16, 2012 at 17:48

Ah you meaning a In Circuit emulator (ICE), where you have pins going to the z80 and can step through code and watch the z80 chips actions.

Yes, the F1 will do what you need, the F4 will give you more pins an a larger Trace buffer.

You can take the code for the debugger for the chip and modify it to use the pins and trace the Z80.

frankmeyer9
Associate II
Posted on May 18, 2012 at 10:15

Actually, I more thought about running some application for this old, Z80 based home computer on a Cortex M3/M4 based board. As mentioned in my first post, I did not yet mess much with emulators. I have been investigating other emulators of this class, and became a little discouraged. To get the CPU emulation running is not the problem (it does already, using the mentioned source package on the STM32 board). Much more effort is required to differ between simple memory operations and I/O related operations on the target to proper emulate the system behavior. The more one deviates from a full emulation, the less software will actually run without problems. I have a rather early version of this Z80 computer at home, and a lot of 'improvements' were implemented in later versions - most of the software I intended to run relies on that. Other emulators grew over years, and still fail sometimes on subtle details.

Thus, with reasonable effort, I can probably only run very few simple apps that recall that hapless feeling when first trying to get these box to work, and the joy when it first did something useful.

Considering the available time to put into this kind of project, I think of switching to an easier alternative - porting an existing emulator to a Cortex A8 based board running a full-fledged linux

http://www.beagleboard.org

.

Anyway, thank you for the helpful input !

bjfree
Associate II
Posted on May 18, 2012 at 11:09

why not use a zilog equivalent.

http://search.digikey.com/us/en/products/EZ80F915050MODG/269-3861-ND/956824

http://www.zilog.com/docs/ez80acclaim/ps0192.pdf

you probably have seen this page.

http://www.z80.info/z80emu.htm

I still have  my s100 dual ported ram, 2 mhz z80 I wire wrapped in 1976

and the Exidy products.

frankmeyer9
Associate II
Posted on May 18, 2012 at 11:46

Judging the Z80 system I mean after todays standards, it is a PITA. (

http://en.wikipedia.org/wiki/Robotron_Z1013

).

The keyboard was/is painfull, and the audio casette interface was far from reliable, mostly because of the extremely-low-quality cassettes available to me at this time.

A useful emulation of this system should re-route this to a normal keyboard or serial terminal, and some reliable file system, either SD/MMC card based or fully based on the host system.

Most of the software availabe for it is based on 'improved' hardware. It would be quite time-consuming to collect all the information required to implement an emulation.

A full-blown emulator for this and similiar systems

http://kcemu.sourceforge.net/

(site not in english), which also includes CP/M. I hesitate to try that on a M4...

a_rocchegiani
Associate II
Posted on December 26, 2013 at 16:27

Hi, 

Have you found the Cortex M  Z80 emulator ?

frankmeyer9
Associate II
Posted on January 04, 2014 at 16:53

Have you found the Cortex M  Z80 emulator ?

 

Probably not in the sense you mean.

An emulator for another CPU is pretty useless as such, except possibly for academical purposes, or pure curiosity.

Usually one wants to emulate a whole system, like an Amstrad CPC, ZX Spectrum, or KC85, including all the hardware.

Emulating the CPU firmware, be it a small monitor program or a fullblown OS like CP/M, does not yield anything by itself. You need to touch all IO routines of the emulated system, to map the functionality to those of your host system. And this does not only require a deep understanding of the emulated system (source code, documentation available ?), it will also consume a great amount of time.

The idea had been born mostly of nostalgical reasons, and since I don't have the time to finish such a project, I dropped it in favour of others.

Another counter-argument is the limited value of such an emulator, if you don't have much useful software for the emulated system.

An easier, more promising approach is to use one of the countless Cortex A7/8/9 SBC's a host, and porting one of the existing emulators for Linux.

That might be as simple as typing ''apt-get install <your_prefered_emulator>''.

eprice
Associate
Posted on August 25, 2015 at 23:28

If you are still interested. I may have what you are looking for.   A few years ago I created a z80 (Altos ACS8000) emulator on an ARM7 evaluation board.  I have recently ported it to a Keil board that has an STM32F103.  It uses USART1 for the CP/M console and an SD card for disk.