A simple Snake/LightCycle game for x86_64
Linux implemented in
assembly and C99 with no linked libraries (no libc) and no preprocessor
directives (no #ifdef
, #define
, #include
, etc).
Images are drawn to the screen using the "dumb buffer" API provided by the
Direct Rendering Manager (DRM) subsystem of Linux. Keyboard input is read
directly from a keyboard device file. DumbCycle should run on any x86_64
Linux system with DRM support, a video card, and a keyboard1.
DumbCycle can be compiled with any C compiler that supports C99 and ATT
syntax x86_64
assembly. The primary motivation for eschewing the C
preprocessor is to allow the project to compile using only
cproc-qbe, QBE, and GNU binutils (for as
and ld
).
Passing the game code through cproc and QBE results just over 2000
lines of simple and readable x86_64
assembly.
Run the game by executing make run
(or make run_cproc
) with the required
permissions1. You can also run make
and ./dumb_cycle
, but make run
also executes clear
to automatically restore terminal when the game exits.
Steer with WASD and avoid the walls. Press ESC to exit.