|
| 1 | +# System Architecture |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This repository contains the source code for a reconstruction of Macintosh System Software 7.1. It is designed to be cross-compiled on Linux targeting the Motorola 680x0 (m68k) architecture. The system follows the classic Macintosh "Toolbox" architecture, where the Operating System serves as a foundation for a rich set of user interface and system service APIs. |
| 6 | + |
| 7 | +## High-Level Diagram |
| 8 | + |
| 9 | +```mermaid |
| 10 | +graph TD |
| 11 | + User[User] --> Finder[Finder / MiniFinder] |
| 12 | + Finder --> Toolbox[Macintosh Toolbox] |
| 13 | + Toolbox --> OS[Operating System Core] |
| 14 | + OS --> Drivers[Device Drivers] |
| 15 | + Drivers --> Hardware[Macintosh Hardware (m68k)] |
| 16 | +``` |
| 17 | + |
| 18 | +## Core Components |
| 19 | + |
| 20 | +### 1. Operating System (OS) |
| 21 | +The kernel of the system, located in the `OS/` directory. It manages hardware resources and provides fundamental services: |
| 22 | +- **Memory Manager:** Manages the application heap and system memory. |
| 23 | +- **Process Manager:** Implements cooperative multitasking. |
| 24 | +- **File System (HFS):** Hierarchical File System support. |
| 25 | +- **Trap Dispatcher:** The mechanism that routes Toolbox calls to their implementations. |
| 26 | + |
| 27 | +### 2. Toolbox |
| 28 | +A collection of high-level APIs located across `OS/`, `Interfaces/`, and `Libs/`. It provides the building blocks for Macintosh applications: |
| 29 | +- **Window Manager:** Manages on-screen windows. |
| 30 | +- **Menu Manager:** Handles drop-down menus. |
| 31 | +- **QuickDraw:** The graphics primitive library. |
| 32 | +- **Event Manager:** Handles user input (mouse, keyboard). |
| 33 | + |
| 34 | +### 3. Drivers |
| 35 | +Located in `Drivers/`, these modules handle low-level hardware interaction: |
| 36 | +- **Sony:** Floppy disk driver. |
| 37 | +- **Video:** Display drivers. |
| 38 | +- **IOP/ADB:** Input/Output Processors and Apple Desktop Bus for peripherals. |
| 39 | + |
| 40 | +### 4. Build System |
| 41 | +The project uses a cross-compilation strategy: |
| 42 | +- **Host:** Linux. |
| 43 | +- **Toolchain:** MPW (Macintosh Programmer's Workshop) running under `empw` emulation. |
| 44 | +- **Configuration:** `.make` files in the `Make/` directory define dependencies and build rules. |
| 45 | + |
| 46 | +## Data Flow |
| 47 | +The system operates primarily on an event-driven model: |
| 48 | +1. **Hardware Interrupts:** Input devices trigger interrupts. |
| 49 | +2. **OS Event Queue:** The OS places these events into a queue. |
| 50 | +3. **Event Loop:** The active application (e.g., Finder) polls `WaitNextEvent`. |
| 51 | +4. **Dispatch:** The application processes the event and calls Toolbox functions to update the display or state. |
| 52 | + |
| 53 | +## Key Directories |
| 54 | + |
| 55 | +| Directory | Description | |
| 56 | +|-----------|-------------| |
| 57 | +| `OS/` | Core system components (Memory, Process, HFS). | |
| 58 | +| `Drivers/` | Hardware drivers. | |
| 59 | +| `Interfaces/` | Public SDK headers (C, Pascal, Assembly). | |
| 60 | +| `Internal/` | Private headers and stub implementations. | |
| 61 | +| `Make/` | Build configuration files. | |
| 62 | +| `Libs/` | Static libraries linked into the final system. | |
0 commit comments