$ show Kelsidavis/System7
This repository is a clean-room, portable reimplementation of Apple Macintosh System 7.1, targeting bare-metal x86, ARM (Raspberry Pi), and PowerPC hardware. It is a monolithic kernel that emulates the classic Mac OS Toolbox API, including subsystems such as the Event Manager, Window Manager, Menu Manager, Dialog Manager, QuickDraw, Font Manager, File Manager (HFS), and a Finder-like desktop environment. The codebase is written in C and assembly, with a hardware abstraction layer (HAL) for platform-specific drivers (USB, storage, timers, framebuffer). It boots via GRUB2 (x86) or custom bootloaders (ARM, PPC) and includes built-in applications like SimpleText and MacPaint. The project is explicitly a reverse-engineering effort based on public documentation and ROM analysis, with many subsystems partially implemented or stubbed. It is not production-ready but demonstrates deep knowledge of Mac OS internals and provides a foundation for running classic Mac software on modern hardware.
The LLM identified 5 files worth highlighting for reuse:
Implements a preallocated buffer pool for saving and restoring menu background pixels. This avoids heap fragmentation from frequent small allocations during menu tracking, a common problem in memory-constrained systems. The pattern is self-contained and could be extracted for any system needing transient, fixed-size buffers.
Provides RAII-style macros for automatic disposal of QuickDraw regions (RgnHandle) when they go out of scope. This prevents memory leaks from scattered DisposeRgn calls and is a clean, reusable pattern for any codebase using Mac-style region handles.
A standalone library for 16.16 fixed-point arithmetic, including addition, subtraction, multiplication, division, and trigonometric functions. It is fully self-contained, uses no external dependencies, and can be reused in any embedded or graphics project requiring fixed-point math.
Provides generic utility functions for Mac-style handles: HandToHand (duplicate handle), PtrToHand (copy pointer to handle), PtrAndHand (append to handle), and HandAndHand (concatenate handles). These are isolated, well-tested operations that can be reused in any project using handle-based memory.
Defines macros for runtime memory safety checks: buffer bounds validation, pointer alignment verification, and overlap detection. These guards can be enabled or disabled at compile time and are useful for debugging memory corruption in any C codebase.