The GEOS operating system managed to clone the Macintosh GUI on the Commodore 64, a computer with an 8 bit CPU and 64 KB of RAM. Based on Maciej Witkowiak's work, I created a reverse-engineered source version of the C64 GEOS 2.0 KERNAL for the cc65 compiler suite:

https://github.com/mist64/geos

The source compiles into the exact same binary as shipped with GEOS 2.0.

The source is well-structured and split up into 31 source files.

Machine-specific code is marked up.

Copy protection/trap mechanisms can be disabled.

The build system makes sure binary layout requirements are met.

This makes the source a great starting point for

adding (optional) optimized code paths or features

integrating existing patches from various sources

integrating versions for other computers

porting it to different 6502-based computers

Just fork the project and send pull requests!