MAME 0.128u4, structural changes and a new emulated lasergame
The development cycle for the MAME 0.129 release isn’t finished yet, but the last intermediate version delivered by the mamedevs brings such important changes and novelties that it’s worth to look closely at them. The structural design of the emulator of emulators has undergone the nth shift while the list of emulated games includes now Firefox, the second laserdisc videogame to be added to MAME after Cube Quest.
With version 0.128u4, states the whatsnew attached to the source code, MAME faces “the first part of a monumental internal change within MAME in the way CPU cores are managed and how memory is addressed“. That the change is huge is demonstrated by the amount of performed work quoted in the above said whatsnew, that’s much more solid than usual and in which the news about the proper Firefox laserdisc emulation - as much important, at least from a playing user standpoint - goes almost unnoticed.
Aaron Giles has written a post on his blog to explain in detail what is currently happening to the MAME internal design: with the ultimate goal to make the code much more object-oriented and take care of that the program do “less work when it switches frequently between different CPUs” while emulating multi-processor systems, all the structural references to the so-called Context Switching between the CPU cores must be removed.
Giles explains that context switching was inserted in MAME to allow multi-CPU systems emulation, a feature initially unavailable and that had soon become essential. By using Z80 (the first emulated CPU in MAME) as a reference, in an ideal multi-processor system containing more than one Z80, the MAME project coordinator says that “with context switching, when MAME needs to stop executing one of the Z80’s and begin executing one of the others, it asks the first Z80 to copy all of its relevant global variables to some temporary memory, and then copy the second Z80’s state from temporary memory back into the global variables. At this point, the global variables contain the state of the second Z80, and it can be executed normally“.
The exposition basically highlights how context switching has been useful until now to make easy the emulation of more than one processor in a multi-CPU system, being good for its purpose with no huge impact on the overall performances. The problem, as already anticipated by David “Haze” Haywood in his post on the MESS doomed emulator and as Giles is confirming, rises when you try to accurately emulate any single instruction of a particular CPU. “In this situation - Giles writes - it turns out that we spend far more time context switching than we do executing“.
The solution to the issue highlighted by Haze is just the removal of context switching, a hard and lengthy work considering that all the CPU cores must be modified, the memory subsystem must be radically changed too and that the notion of “active” CPU, deeply rooted within the design MAME used until now, must be removed. A good part of the fundamental work has already been completed with the intermediate release 0.128u4, but there’s still other to do to finish the upgrade.
From a user’s standpoint, Giles continues, those changes should be transparent at first: all the games should continue to run as usual and even faster in some cases, “especially in situations where there is aggressive context switching today“. On the long term, conversely, it is foreseen that the already not-so-exciting MAME speed would get even worse, because “to achieve the most accurate behavior, we ideally should execute each CPU one instruction at a time, alternating back and forth very quickly” during the several CPUs emulation. Giles hopes that the CPUs single-stepping will be bearable, from a performance standpoint, “at least for many of the 8-bit systems“.
There are then strong doubts on the fact that all of this code stirring would be at least useful in those cases in which, as highlighted by Haze, a perfect-sync between CPUs is needed: Haze himself, on the MAME World board, states that “as for 32X, well, yes, it helps a bit, but the cost of running the CPUs in perfect-sync is still prohibitive even if performance is doubled, and there are other additional issues“.
Among so much doubts and uncertainties for the future of MAME / MESS the thing that is currently sure if the emulation of Firefox, finally become playable thanks to the proper implementation of the laserdisc part in the drive (already present in MAME since) made by Giles and smf. The game, a shooter inspired by the movie with the same name directed and starred by Clint Eastwood, is the only lasergame ever manufactured by Atari in 1983 and tells the story of the theft of a soviet super-plane by Eastwood’s character.
Who would like to try Firefox will have to be prepared to the nth monstre-download, considering that the laserdisc dump is perfectly aligned to the nearly 11 Gigabytes of Cube Quest taking up “only” one Gigabyte more. Waiting to write about this topic within an all-comprehensive guide, the instructions to download the Cube Quest CHD can be useful for Firefox too especially when talking about stuff like BitTorrent and Pleasuredome. Who is satisfied to only see the game in action instead, The Dragon’s Lair Project site offers some images and short video clips taken from the original arcade, while in this news there should be some screenshots from the game emulated in MAME. The complete collection is available on the MAME World forums within this thread.
- DICE 0.8, the CPU-less arcade games emulator
- 3dfx Voodoo graphic cards emulation coming to DOSBox
- MESS emulates Philips CD-i. For free
- KEEP, a universal emulator or a complete waste of time?
- MAME 0.129(u1), the new year among lasergames and emulated multiplayer
- MESS, a doomed emulator?
- Where to download the Cube Quest CHD?
- Finally MAME emulates its first laserdisc videogame
- Emulation, updates round-up for MAME, MESS and Raine