Z80 CPU emulator [with JIT compilation?], in rpython.

deesix 37ccf9701e Merge branch 'zexdoc' 7 년 전
LICENSE 2b173ea9b3 Readme and license 7 년 전
Makefile 29904d7162 Makefile targets for compiling (rpython) zextests.py 7 년 전
README.md c0acfb5151 readme: zexdoc tests pass; zexall needs no new opcodes 7 년 전
memory.py 6234553c63 Subset of Jason's py_z80 repo, to build upon. Thanks, Jason! 7 년 전
z80da.py 6234553c63 Subset of Jason's py_z80 repo, to build upon. Thanks, Jason! 7 년 전
z80gen.py 94c779ff30 remove debug helpers 7 년 전
z80th.py 94c779ff30 remove debug helpers 7 년 전
zextests.py 94c779ff30 remove debug helpers 7 년 전

README.md

z80jit

(experimental, work-in-progress, maybe not a good idea anyway)

Z80 CPU emulator [with JIT compilation?], in rpython.

Based on the GPLv3 python implementation by Jason Harris jth@mibot.com at https://github.com/deadsy/py_z80/commit/43ca1f309dff

Thanks, Jason!

Roadmap:

  • [DONE] Cherry pick files from Jason's (no ROMs, no machines, no utils, etc.)
  • [DONE] Put copyright and license headers in files.
  • [DONE] Port to rpython. (tested with -O0 --gc=none)
  • [DONE] Fix/Add opcodes to pass zexdoc tests.
  • Instrument for JIT... or fail.

Bonus:

  • Fix opcodes to pass zexall tests.
  • Will see...

Any idea?

https://notabug.org/deesix/z80jit

deesix@tuta.io

Dependencies

The RPython compiler, that lives in the source tree of PyPy. It needs a C toolchain to compile rpython programs.

We use a little Makefile, so make is expected. Python 2 is used to generate the z80.py file and to run rpython (the compiler).

Please, check our Makefile. You may want to edit some paths in a bit.

For Debian 9 (Stretch) you can get it all by...

As root:

apt-get install --no-install-recommends build-essential devscripts debian-keyring python

As regular user from now on:

Copy the URL of the dsc listed in the Source Package section of:

https://packages.debian.org/stretch/pypy

Download and prepare the PyPy source tree (notice it's not wget):

dget http://http.debian.net/debian/pool/main/p/pypy/pypy_5.6.0+dfsg-4.dsc

Move it to ~/opt/pypy (where our Makefile expects it to be):

mkdir -p ~/opt
mv pypy-5.6.0+dfsg ~/opt/pypy

Build

Edit our Makefile if your PyPy source tree is not at ~/opt/pypy.

For faster building (slower binary):

make zex0

This will create the zextests-c binary. You may want to rename it before making a different zex target.

See Makefile for different optimization levels.

Getting "zexlax.z80" exerciser sets (zexdoc.com and zexall.com)

See yaze 1.10 by Frank D. Cringle:

ftp://ftp.ping.de/pub/misc/emulators/

Mirror (see test directory):

https://github.com/lipro/yaze/tree/2a6161b5bcf866da442868cfa09bc47e79966951

The files are also available at, for example:

https://github.com/anotherlin/z80emu/tree/master/testfiles

To check if we're using the same files:

md5sum zexdoc.com zexall.com
be3691b6b910d2c2e05e194cd529e45c  zexdoc.com
4a32f2a6691b3da5213d7688dda59822  zexall.com

Run zexdoc.com with our Z80

Copy zexdoc.com alongside our new binary and:

time ./zextests-c