⚠️ PROOF OF CONCEPT - This is an experimental, educational reimplementation of Apple's Macintosh System 7. This is NOT a finished product and should not be considered production-ready software.
An open-source reimplementation of Apple Macintosh System 7 for modern x86 hardware, bootable via GRUB2/Multiboot2. This project aims to recreate the classic Mac OS experience while documenting the System 7 architecture through reverse engineering analysis.
Current State: Active development, core functionality partially working
⚠️ XOR Ghost Dragging for Folder Windows: Initial implementation (in progress)- XOR ghost outline appears and follows mouse during drag
- Proper port context management (window → screen → window)
- Known issue: Ghost coordinates need adjustment for proper initial positioning
- Drop-to-desktop alias creation pending coordinate fix
- ✅ Drag-Drop System Implementation: Complete drag-drop with modifier key support
- Option key creates aliases, Cmd key forces copy, cross-volume auto-copy
- Folder window drops, desktop drops, and trash integration
- VFS operations for move, copy, delete with unique name generation
- ✅ Modal Drag Loop Freeze Fix: Fixed desktop and folder window drag freezes
- Root cause:
gCurrentButtons
not updated during modal drag loops - Added
ProcessModernInput()
calls to update button state during drag - Desktop icons and folder items now drag/release correctly
- Root cause:
- ✅ HFS B-tree Catalog Fixed: Folder windows now display file system contents correctly
- Root cause: B-tree node size (512 bytes) too small for 7 initial catalog entries (~644 bytes)
- Buffer overflow was corrupting offset table, making entries unreadable
- Fixed by increasing catalog B-tree node size from 512 to 1024 bytes
- Folder windows now show 5 root folder icons (System Folder, Documents, Applications, etc.)
- ✅ VFS Integration for Folder Windows: Folder windows now display actual file system contents via VFS_Enumerate()
- ✅ Icon Label Spacing: Adjusted spacing for full-height icons (label offset 40px for folders, 34px for desktop)
- ✅ Icon Rendering Fixed: Full-height 32x32 folder/document icons, restored "Trash is empty" message
- ✅ Folder Window Icons Fixed: Correct vertical positioning in folder windows, proper coordinate transformation
- ✅ Window Close Cleanup: Fixed crash when closing folder windows by adding proper state cleanup
- ✅ Window Dragging Restored: XOR mode implementation for drag outlines, smooth window repositioning
- ✅ QuickDraw XOR Mode: PenMode support with proper XOR rendering for interactive feedback
- ✅ Production-Quality Time Manager: Accurate TSC frequency calibration, <100 ppm drift, generation checking
- ✅ Enhanced Resource Manager: O(log n) binary search, LRU cache, comprehensive bounds checking
- ✅ Gestalt Manager: Clean-room implementation with multi-architecture support (x86/ARM/RISC-V/PowerPC)
- ✅ TextEdit Application: Complete text editor with window creation, event handling, and full compilation
- ✅ Performance Optimizations: Resource cold miss <15 µs, cache hit <2 µs, timer precision ±10 µs
This is a proof-of-concept implementation focused on understanding and recreating System 7's architecture. Many features are incomplete, stubbed, or in various stages of development.
- Boot System: Successfully boots via GRUB2/Multiboot2 on x86 hardware
- Graphics Foundation: VESA framebuffer (800x600x32) with QuickDraw primitives
- PenMode support including XOR mode (patXor) for interactive drag feedback
- Rect, Line, and Frame operations with mode-aware rendering
- Desktop Rendering:
- System 7 menu bar with rainbow Apple logo
- Desktop pattern rendering with authentic System 7 patterns
- Hard drive icon with proper rendering and compositing
- Trash icon support
- Typography: Chicago bitmap font with pixel-perfect rendering and proper kerning
- Input System: PS/2 keyboard and mouse support with full event forwarding pipeline
- Event Manager:
- Cooperative multitasking via WaitNextEvent
- Unified event queue with mouse/keyboard event dispatching
- Proper event mask filtering and sleep/idle support
- Resource System: Pattern (PAT) and pixel pattern (ppat) resources from JSON
- Icon System: Small icons (SICN) and 32-bit color icons (ARGB) with mask compositing
- Memory Manager: Zone-based memory management (8MB total: System and App zones)
- Menu System: Menu bar rendering with File, Edit, View, and Label menus
- File System: HFS virtual file system with B-tree implementation and trash folder integration
- VFS layer with directory enumeration (VFS_Enumerate)
- Folder windows display actual file system contents
- File metadata tracking (FileID, DirID, type, creator)
- Window Manager:
- Window structure, creation, and display with chrome (title bar, close box)
- Interactive window dragging with XOR outline feedback
- Window layering and activation
- Mouse hit testing (title bar, content, close box)
- Time Manager: Production-quality implementation with:
- Accurate TSC frequency calibration via CPUID (±100 ppm drift)
- Binary min-heap scheduler with O(log n) operations
- Microsecond precision with generation checking
- Periodic timer drift correction with catch-up limits
- Resource Manager: High-performance implementation with:
- Binary search index for O(log n) lookups
- LRU cache with open-addressing hash table
- Comprehensive bounds checking and validation
- Named resource support (GetNamedResource)
- Gestalt Manager: Multi-architecture system information with:
- Clean-room implementation (no dynamic allocation)
- Architecture detection (x86/ARM/RISC-V/PowerPC)
- Built-in selectors (sysv, mach, proc, fpu, init bits)
- GetSysEnv compatibility layer
- TextEdit: Fully integrated text editor with window creation and event handling
- Window Manager:
- Window content rendering (coordinate fixes completed)
- Update event pipeline (basic implementation in place)
- WDEF (Window Definition Procedure) dispatch (partial)
- Visible region (visRgn) calculation (basic implementation)
- Window resizing and grow box handling (stubbed)
- Desktop Icons:
- Icons render and display correctly
- Double-click to open functional
- Menu Manager:
- Menu bar displays and tracks mouse correctly
- Dropdown menu rendering incomplete
- Menu selection and command dispatch stubbed
- Control Manager: Framework in place, most controls not implemented
- Dialog Manager: Core structure present, dialog drawing/interaction not complete
- File Manager: Core implemented, in progress.
- Application Launching: No process management or application loading
- Clipboard/Scrap Manager: Copy/paste functionality incomplete, scrap manager implemented.
- List Manager: List controls not working
- Sound Manager: No audio support
- Printing: No print system
- Networking: No AppleTalk or network functionality
- Desk Accessories: Framework only, no functional DAs
- Color Manager: Minimal color support
- Font Manager: Only Chicago font supported, no TrueType or font scaling
- Architecture: Multi-architecture support (x86/ARM/RISC-V/PowerPC)
- Boot Protocol: Multiboot2
- Graphics: VESA framebuffer, 800x600 @ 32-bit color
- Memory Layout: Kernel loads at 1MB physical address
- Font Rendering: Custom bitmap renderer with authentic Chicago font data
- Input: PS/2 keyboard and mouse via port I/O with full event pipeline
- Timing: Architecture-agnostic counters with microsecond precision:
- x86: RDTSC with CPUID frequency calibration
- ARM/AArch64: Generic timer
- RISC-V: Cycle CSR
- PowerPC: Time Base Register
- Resource Performance:
- Cold miss: <15 µs (target met)
- Cache hit: <2 µs (target met)
- Index lookup: O(log n) binary search
- Toolbox Managers: Modular implementation matching Inside Macintosh specifications
- 140+ header files across 26+ subsystems
- 220+ source files (~55,000+ lines of code)
- 69 resource types extracted from original System 7.1
- Performance targets achieved:
- Timer drift: <100 ppm (target met)
- Timer precision: ±10 µs (target met)
- Resource cold miss: <15 µs (target met)
- Resource cache hit: <2 µs (target met)
iteration2/
├── src/
│ ├── main.c # Kernel entry point & initialization
│ ├── SystemInit.c # System startup sequence
│ ├── QuickDraw/ # 2D graphics primitives
│ ├── WindowManager/ # Window management (8 modules)
│ ├── MenuManager/ # Menu system (7 modules)
│ ├── EventManager/ # Event handling & cooperative multitasking
│ ├── MemoryMgr/ # Zone-based memory management
│ ├── Finder/ # Desktop & Finder implementation
│ │ └── Icon/ # Icon system (5 modules)
│ ├── FS/ # Virtual file system & HFS
│ ├── ControlManager/ # UI controls
│ ├── DialogManager/ # Dialog boxes
│ ├── DeskManager/ # Desk accessories
│ ├── PatternMgr/ # Pattern resources
│ ├── TimeManager/ # Production timer scheduler (7 modules)
│ ├── ResourceMgr/ # High-performance resource manager
│ ├── Gestalt/ # System information manager
│ ├── TextEdit/ # Complete text editing application
│ ├── FileMgr/ # File Manager subsystems
│ ├── FileManager.c # File Manager API
│ └── PS2Controller.c # Hardware input driver
├── include/ # Public headers (Inside Mac API)
├── docs/ # Archaeological documentation
│ ├── WM_STATUS_REPORT.md # Window Manager implementation status
│ └── WM_RESTRUCTURE_PLAN.md # Architecture planning docs
└── System_Resources_Extracted/ # Original System 7.1 resources
└── [69 resource type folders]
- GCC with 32-bit support (
gcc-multilib
on 64-bit systems) - GNU Make
- GRUB tools:
grub-mkrescue
(fromgrub2-common
orgrub-pc-bin
) - QEMU for testing (
qemu-system-i386
) - Python 3 for resource processing
- xxd for binary conversion
sudo apt-get install build-essential gcc-multilib grub-pc-bin xorriso qemu-system-x86 python3 vim-common
# Build kernel only
make
# Create bootable ISO
make iso
# Build and run in QEMU
make run
# Clean build artifacts
make clean
# Check exported symbols
make check-exports
# Display build statistics
make info
# Standard run with serial logging
make run
# Or manually:
qemu-system-i386 -cdrom system71.iso -serial file:/tmp/serial.log -display sdl -vga std -m 256M
# Debug with GDB
make debug
# In another terminal: gdb kernel.elf -ex "target remote :1234"
# Custom QEMU options
qemu-system-i386 -cdrom system71.iso \
-serial stdio \ # Serial to console
-display sdl \ # SDL window
-vga std \ # Standard VGA
-m 256M # 256MB RAM
- Write ISO to USB drive:
dd if=system71.iso of=/dev/sdX bs=4M
- Boot from USB with legacy BIOS (not UEFI)
- Serial output available on COM1 (115200 baud) if available
This project follows an archaeological approach to reimplementation:
-
Evidence-Based: Every non-trivial implementation decision is backed by citations from:
- Inside Macintosh documentation (official Apple specs)
- MPW Universal Interfaces (canonical struct layouts)
- System 7 ROM disassembly analysis
- Emulator trace comparison
-
Documented Findings: All changes are tagged with Finding IDs (e.g.,
[WM-001]
) that reference archaeological evidence indocs/ARCHAEOLOGY.md
-
Behavioral Parity: Goal is to match original System 7 behavior, not to improve or modernize it
-
Clean Room: Implementation is based on public documentation and black-box analysis, not original Apple source code
This project serves as:
- Operating System Education: Demonstrates classic OS architecture (cooperative multitasking, event-driven UI, resource management)
- Reverse Engineering Study: Documents the process of analyzing and recreating complex software systems
- Historical Preservation: Keeps System 7's architecture and design philosophy accessible
- Low-Level Programming: Real bare-metal x86 programming with no OS layer
- Menu Dropdowns Incomplete: Menus display but don't show items when clicked
- Icon Drag Artifacts: Dragging desktop icons causes visual artifacts
- No Application Support: Cannot launch or run applications
- Limited Font Support: Only Chicago font implemented
- HFS Read-Only: File system is virtual/simulated, no real disk I/O
- No Stability Guarantees: Crashes, hangs, and unexpected behavior are common
This is primarily a learning/research project, but contributions are welcome:
- Bug Reports: File issues with detailed reproduction steps
- Testing: Test on different hardware/emulators and report results
- Inside Macintosh (1992-1994 editions): Official Apple Toolbox documentation
- MPW Universal Interfaces 3.2: Canonical header files and struct definitions
- Guide to Macintosh Family Hardware: Hardware architecture reference
- Mini vMac: System 7 emulator for behavioral reference
- Basilisk II: Another classic Mac emulator
- ResEdit: Resource editor (for studying original System 7 resources)
- Ghidra/IDA: For ROM disassembly analysis
This is a clean-room reimplementation for educational and preservation purposes.
- No Apple source code was used in this implementation
- Implementation is based on public documentation and black-box analysis
- "System 7", "Macintosh", "QuickDraw", and Apple logo are trademarks of Apple Inc.
- This project is not affiliated with, endorsed by, or sponsored by Apple Inc.
This project exists for:
- Educational purposes (teaching OS design and implementation)
- Historical preservation (documenting 1980s-90s OS architecture)
- Interoperability research (understanding file formats and protocols)
Original System 7 ROM and software remain property of Apple Inc. This reimplementation does not include or require original Apple software to function.
- Apple Computer, Inc. for creating the original System 7
- Inside Macintosh authors for comprehensive documentation
- Classic Mac preservation community for keeping the platform alive
- 68k.news and Macintosh Garden for resource archives and documentation
- Lines of Code: ~55,000+
- Development Time: Several months (ongoing)
- Compilation Time: ~3-5 seconds on modern hardware
- Kernel Size: ~900KB (kernel.elf)
- ISO Size: ~12.5MB (system71.iso)
- Error Reduction: 94% (30 of 32 Window Manager errors resolved)
- New Managers Added: 3 (Gestalt, enhanced Resource, production Time Manager)
This project is in active development with no guaranteed timeline. Planned work includes:
Short Term (Proof of Concept Completion):
- Fix desktop artifacts
- Debug window close crash issue
- Complete window resizing functionality
Medium Term (Core Toolbox):
- Complete Window Definition Procedure (WDEF) dispatch
- Implement standard controls (buttons, scrollbars, text fields)
- Enhance TextEdit with full editing capabilities (cut/copy/paste)
- Implement functional dialog boxes with standard items
Long Term (Application Support):
- Resource Manager with .rsrc file support
- Process Manager for application launching
- Segment Loader for loading CODE resources
- Basic desk accessories (Calculator, Note Pad)
Stretch Goals (Full System):
- Sound Manager with sample playback
- AppleTalk networking stack
- Color QuickDraw with 8-bit palette support
Status: Experimental - Educational - In Development
Last Updated: October 2025
For questions, issues, or discussion, please use GitHub Issues.