Reverse engineering of 72 000 lines of assembly, an experiment converting Iraq’s first Amiga game to Godot with generative models
Listen to this article
Read by Anchor
In 1993, amid economic siege and power outages in Baghdad, Iraqi engineering student Rabeh Shihab, together with artist Murtada Salman and composer Maher Al-Salman, developed the game "Babylonian Twins" for the Amiga 500 with memory not exceeding 512 KB. The game was written entirely in assembly language for Motorola 68000 processors by directly handling graphics and sound hardware without relying on the operating system, becoming the first commercial game produced in Iraq before its commercial run stopped due to Commodore's collapse and sanctions, until it was rediscovered in 2008 and manually ported to iPhone phones in 2010 via an engine written in C++ that exceeded 34 000 lines of code.
The developer recently conducted a new experiment to test modern generative models' ability to deconstruct undocumented legacy code, using the "Cloud Code" environment to convert the game to the Godot 4 engine. The experiment comprised three progressive stages: it began with porting the 2010 engine written in C++, then moved to the harder challenge of reading 72,758 lines of assembly language spread across 26 files without documentation, and finally merged the original version to run at 50 Hz within the modern version that runs at 60 Hz.
The model succeeded in converting the modern engine into a playable project within 21 minutes, but the most notable achievement lay in its ability to handle the old assembly code. The model built an initial processing layer that bridged the differences between the ASM-One assembler used in the 1990s and the modern vasm assembler, and it addressed manual memory addressing issues and corrupted file names, so that the resulting binary files matched the original 1993-saved version byte for byte.
Extracting the Hidden Structure of Stage MapsThe deepest technical hurdle in the experiment was this. Without any documentation, the model analyzed 1,652 lines of assembly code dedicated to loading stages and discovered how cell properties were stored in 16-bit numeric words, with the high bits defining game physics such as collisions, damage, doors and climbing, and the low bits defining the appearance of graphic tiles. The model then reconstructed the complete stage maps and compared them with reference screenshots pixel by pixel, achieving a perfect 100 % match.
The model's work did not stop at literal code translation; it also created self-testing tools via the command line that included frame-by-frame simulation of player movements and button presses and screenshot capture to automatically verify gameplay logic, while preserving the manually written kinematic equations inside Node2D nodes instead of relying on Godot's built-in physics engine, to avoid any discrepancy in the feel of jumping and friction.
A Radical Shift in the Economics of Updating Legacy SystemsThis test presents engineering teams and tech companies in the Gulf, Egypt and the Arab region with a new practical reality. Banking institutions, government agencies and regional telecom companies hold massive software assets written in legacy languages that lack documentation and whose original programmers are unavailable, and their migration projects have cost millions of dollars and taken years of manual work fraught with downtime risk. The experiment demonstrates that intelligent models can read low-level processing logic, extract precise business rules and verify byte-level matching, reducing the cost of replicating complex software infrastructure to a few days.
These capabilities compel technology leaders in the region to rethink system-update strategies, shifting focus from arduous manual migration to designing precise verification and testing pipelines in which a human engineer oversees the outcome while the model untangles the code and builds the corresponding architecture on modern engines and platforms.