Reverse Engineering Nintendo E-Reader's Drawing API: A Stack-Based Secret

2025-02-02
Reverse Engineering Nintendo E-Reader's Drawing API: A Stack-Based Secret

A developer, while creating a Minesweeper game for the Nintendo E-Reader, stumbled upon a hidden feature in the `DrawLine` function of its drawing API. Initially, a loop drawing a minimap rectangle using `DrawLine` revealed lines drawing progressively faster. The developer discovered the draw time was determined by a value pushed onto the stack, a combination of the loop counter and another register. By pushing 0 onto the stack, the issue was resolved, revealing a quirky API detail. This showcases the intrigue of reverse engineering and the peculiarities of older processor architectures.