Short: Source code for Speccylator Author: Richard Carlsson Uploader: jrj aapt net au (James Jacobs) Type: misc/emu Version: 1.0 Architecture: generic This is the source code for the Speccylator emulator (Aminet:misc/emu/Speccylator.lha). --- I wrote my Z80 emulator in MC68000 assembler, since I wanted the fastest possible emulation on my Amiga 500. I only got an '030 processor quite late in the project, so there is little or no optimization that actually takes into consideration the properties of more modern CPU architectures such as caching, large memories, or even the fact that a 68030 can move 32 bits from memory in one bus cycle, while the 68000 could only move 16 bits at a time. Hence, it is very hard to beat the Speccylator on a 68000 CPU (unless possibly if you do dynamic compilation instead of interpretation, which I never got around to trying), but eg. the Spanish ZXAM was quite a lot faster on a 68030. I did also pride myself on having a very exact emulation, and last I looked, I did not have a single bug in the Z80 emulation that I knew of. I've toyed with the idea of rewriting the whole thing in C, to see how fast I could make it while still keeping it portable. It would be fun, but I have absolutely no time for it, what with all my other projects. The emulation core uses 64K 16-bit words of threaded code as a "translation cache", mirroring the 64K bytes of the normal address space. (I never had time to try to implement banked memory.) Each word is an offset from a base pointer in code memory to the particular assembler routine to be executed. There are several special "trap" routines that do not correspond to any Z80 instruction; in particular, a zero word points to the actual routine which decodes an instruction and replaces the zero with the offset to the proper routine. There is relatively little use of tables, eg. for BCD arithmetic, since memory access is pretty slow on a 68000. But I probably made too many assumptions about speed, rather than actually measuring, so there may be many cases where I should have kept a value (eg. a Z80 register) in memory instead of sacrificing a 68000 register. The design could probably have been a bit cleaner without losing any speed (or even get a slight speedup).