-
Notifications
You must be signed in to change notification settings - Fork 64
Architecture Tier 3 Core API
The LinApple Core API is the primary interface between the platform-specific frontend and the emulator. It is defined in src/core/LinAppleCore.h as a C-compatible ABI to ensure cross-language support and stability.
Note on Alpha Status: The Core API is currently in Alpha (Version 0). It is subject to change as the project's tiered architecture is finalized. Backwards compatibility will be guaranteed only after a future date when the API is officially locked down (planned for Version 1.0).
Initializes all emulator-agnostic subsystems.
- Allocates main/aux memory.
- Loads ROMs from the file system.
- Resets the CPU and prepares the video core.
The most critical function in the API. It represents one "heartbeat" of the emulator, typically called once per 16.6ms (60Hz) by the frontend.
- CPU Execution: Executes the 6502 core for the requested number of cycles (e.g., 17,030).
- Peripheral Manager Think: Drains the thread-safe command queue and allows each peripheral to update its state for the elapsed cycle count.
- Video & Timer Logic: Updates VBlank signals and processes the high-frequency system clock.
-
Callback Dispatch: If a video frame is complete, it invokes the
LinappleVideoCallback.
Cleans up all virtual hardware, shuts down peripherals, and frees all allocated memory.
PeripheralStatus Peripheral_Command(int slot, uint32_t cmd_id, const void* data, size_t size);Used by the frontend to interact with specific cards. Commands are queued and processed synchronously with the CPU execution to prevent race conditions.
-
slot: The virtual slot number (0-7). -
cmd_id: A peripheral-specific command ID (e.g.,DISK_CMD_INSERT).
PeripheralStatus Peripheral_Query(int slot, uint32_t cmd_id, void* out, size_t* out_size);Used to retrieve status information (e.g., "Is Disk 1 spinning?"). Must be called from the emulation thread to ensure consistency.
Frontends provide implementations for these to receive the results of emulation:
-
LinappleVideoCallback: Receives aconst uint32_t*pointer to the finished 560x384 RGBA pixel buffer. -
LinappleAudioCallback: Receives interleaved 16-bit signed stereo samples. -
LinappleTitleCallback: Receives strings to be displayed in the host's window title (e.g., "LinApple - Disk 1: Master.dsk").
Architecture
- Architecture-Overview
- Architecture-Debugger
- Architecture-Fonts
- Tier 1
- Tier 2
- Tier 3
- Tier 4