The Space Invaders (Midway 8080) platform described here is really easy to emulate; it's just a 1-bit frame buffer hooked up to a CPU. Subtracting the CPU emulator, my implementation on <a href="http://8bitworkshop.com/" rel="nofollow">http://8bitworkshop.com/</a> takes less than 200 lines of code. One of the easiest with which to get started.
A long time ago, I wrote a 68000 emulator in C to replace MAME's x86 assembler core. After months and months of poring through my old Amiga programming books and the Motorola manual, I still remember clearly that moment where I fired up the emulator, and actually SAW the title screen of Rastan Saga come up after the game booted from my core. Truly a magical experience...<p>After that, I doubled down and wrote a g65816 emulator for it (that's the CPU the SNES and Apple IIgs used). Emulator writing is almost a zen-like experience.
>> Want to really learn how a CPU works? Writing an emulator is the best way to learn about it.<p>The best way to learn how a CPU works would be to write a CPU! I.e., write HDL code for it and test in a hardware simulator.<p>I have designed a miniature application-specific processor, a compiler* and IDE for it, a disassembler, and an emulator too.<p>* To be more precise, I hacked a compiler for it using C# .net compiler.
Implementing an emulator is similar to writing an interpreter and imo more rewarding in certain cases.<p>Start with CHIP-8, it's the gateway drug to others.
I wanted to learn SNES assembly once, but I found the actual limitations of the SNES frustrating, do I made my own 24-bit virtual machine and basic assembly language. I was getting confused with how to implement interrupts so I took a look at an open source gameboy emulator....turns out without really knowing what I was doing I had written an emulator.<p>That was really awesome to work on though. I probably learned more working on that than anything else. It was the first time I really felt like I understood entirely how a computer actually works.
I want to learn how to write an emulator that is not an interpreter and still keep it timing accurate (even if not completely cycle accurate). I haven't dug, but some of the ones for modern machines seem to compile instead of interpret yet I don't know how they handle timing.
If you're interested in processor emulation, here's a really cool one done in HDL for the pdp 11/70:
<a href="https://wfjm.github.io/home/w11/" rel="nofollow">https://wfjm.github.io/home/w11/</a>
This is pretty much about writing a cpu emulator. A system emulator is much more complex even as far back as a gameboy or Sega genesis. I think there is still great value in writing your own cpu emulator as described in the article.
If you like writing small emulators, try the Synacor challenge and/or ICFP 2006. Extremely challenging puzzles, and both start with writing a simple emulator.
<a href="http://www.emulator101.com/logical-operations.html" rel="nofollow">http://www.emulator101.com/logical-operations.html</a><p><pre><code> /* Example 2: turn on one LED on the control panel */
char * LED_pointer = (char *) 0x2089;
char led = *LED_pointer;
led = led | 0x40; //set LED controlled by bit 6
*LED_pointer = led;
</code></pre>
Really?