Posts tagged "x86"
Sun 03 December 2017
Show Your Working is a brand new segment where I write up things I have attempted to fix in open source software. Sometimes it's interesting to debug a problem yourself from first principles, even if the codebase is huge and you don't know anything going in. I will try and explain my thought process as I venture out into the weeds armed only with a butter knife.
If you haven't heard of it, MAME is an emulation project with the aim of supporting basically every arcade machine ever made. To do this, thousands of circuit boards and custom chips have been probed, analysed, decapped with acid, and ultimately written out as code. By adding board ROMs (whole dumps of the memory chips containing the copyrighted program data), MAME can emulate a system by connecting together drivers for all of the chipsets as per the layout of the original board. Recently, the sister project MESS has been merged back into the MAME main codebase, adding ~2200 consoles home computer systems to the lineup. It is an incredible feat of volunteer-driven engineering.
Unlike other emulators, MAME places accuracy and preservation above all else. All CPU code is interpreted (none of this JIT nonsense!) and runs time-shared in a single thread. Instead of tightly coupling hardware code with the framework for performance, MAME has an infinitely-rewirable generic module architecture to encourage reuse of chip drivers across platforms. If a slightly better dump of a ROM set is released, MAME won't hesistate in ditching compatibility with the old set. Performance hacks? Not welcome.
Also I was not exaggerating when I said every arcade machine ever made. The MAME source tree has slightly north of 6900 .cpp files, and a princely 2.9 million lines of code (4 million if you count headers!). This is a Big Codebase.