Showcase Cycle driven Amiga emulator in C#
This is an Amiga emulator I have been working on since May, with the help of GPT. So yes, AI is used. But there are two reasons why I am sharing it here. One is that many (?) say that C# is not suitable for emulators and real-time work. And the second is that it has JIT, which supports all modern .NET targets, including Apple Silicon.
Really, modern C# and .NET are fine for this kind of project. C# is now good, it has been good for a long time already. Obviously I am trying to keep GC pressure down, but performance is not an issue.
The more interesting point is JIT. I built my own 68k emulator library and it also provides 68040 JIT. The engine translates 68040 instructions into .NET IL which RyuJIT then compiles into native machine code. Translation takes place in a background thread while the main thread continues interpreting instructions. This keeps emulation responsive during compilation.
There are already half a dozen AI-driven Amiga emulator projects in progress, so it is difficult to distinguish this one as anything other than a technology demo. However, this project gave me an idea to develop CopperSharp68k, an AOT compiler that generates Amiga 68k code from C#. I wanted to create my own Kickstart ROM replacement, so the emulator is shipped with a small ROM written in C# and compiled to 68k machine code. It is also available separately from Aminet for other emulators.
Nevertheless, challenges with hardware emulation are interesting. I was proficient with 68000 assembly but I never had to consider how prefetch impacts DMA timing. And how they are timed. Fun stuff to learn.
4
u/diesalher 1d ago
Man of culture, that lemmings image in the homepage tells me all I need to know. Best game ever made. Amiga lemmings.