Edu Garcia

Multi System Debugger

May 13, 2014 | 2 Minute Read

I've decided to take a look at some of my existing and unfinished projects (basically everything, but that's procrastination for you)

The first one I'm going to talk about is my Multi System Debugger/Emulator, AnouckGGMS, something like MESS but obviously way simpler and incomplete :).

Basically, I wanted to give emulation a try, and I decided to make my code extensible, so the common infrastructure can be used for multiple systems (what I call a system is a combination of CPU+GPU+peripherals). I started by implementing the CPU part of the systems, and implemented a Z80 and MOS6502 cores useful for different ones like the GameBoy or NES. Then I implemented the memory/IO structure of the different systems, so we have a way of reading our ROM and writing to RAM and to memory mapped peripherals.

Finally, to wire everything, I created both a "CPU debugger" and a "system debugger". This just means that besides doing normal things like stepping through instructions (an action that differs based on the CPU type, as we can have fixed length instructions like ARM, or variable length like x86), the system debugger knows that some regions on memory are called X or Y (as an example, on the C64 the 0xFD02 address is used to check the cartridge), so the debugger has some comments specifying the known regions on memory. An idea that was not implemented (among another million ideas) was that besides specific regions in memory, a group of instructions can be identified and commented on as well (for example, a group of instructions in a particular order with a particular data or addresses might be used to check the status of the game controllers)

As you can see, the debugger has a memory viewer (bottom left) with the different regions depending on the selected system, a simple console (top left) to enter commands, a breakpoint list (right) that right now doesn't do much except listing the breakpoints and going to them when double clicking, and the debugger window itself (center). This last one has the disassembly of the loaded ROM, registers at the bottom and a graphical representation of the memory รก la IDA Pro at the top (the colors represent data, code or unknown). I know the scrollbars look a bit odd, but I never finished customizing the look and feel I created for the app :).

And that's mostly it. Right now is very incomplete, but you can debug some of the simplest provided ROMs (like the NES test), although the timings are not right yet. I also started to implement one of the GPUs (TMS9918 as it had the best docs IMHO and the part I implemented was very simple to do) and created a test for it.

One last thing: Related to this, I started revamping some old technical documents and uploaded them to another repo (TechDocsRevamp). Maybe in the future I'll add more of those.

If you find this interesting, drop me a line here or on Twitter :).

Tags: emulation projects