Use psx-rt in every bare-metal program to supply the entry point, panic handling and runtime support. Keep extern crate psx_rt; in your executable so the runtime is linked. The loader enters _start, which clears .bss, initializes the optional heap and calls your main.
How the crate is organized
Peripherals is the token set for the GPU and SPU DMA channels, the CD-ROM controller and the controller port; Peripherals::take() returns it once and None after that. bios and tty expose target-side kernel calls and debug text. interrupts owns interrupt and VBlank helpers, including queued display flips, and present holds the VBlank-kicked present queue behind the present-queue feature. cache handles instruction-cache maintenance; scratchpad provides regions and scoped scratchpad stacks. heap is available with alloc. Internal mem and builtins modules implement the memory routines and corrected software 64-bit arithmetic used on the target.
Integration notes
The default build has no heap. Enable alloc only when your program needs allocation; its bump allocator is not a general reclaiming allocator. Use the top-level build commands so the linker script, load-delay hazard patcher and stack guard all run. Scratchpad stacks need the documented interrupt contract and a size proof. scratchpad-stack-check adds runtime checks; it does not replace the build-time guard.
Start with hello-tri, then study queued presentation, the present queue and scratchpad stacks.
API, dependencies and source structure
SDK revision f2fec1c301f1. Structure, dependencies and features below come from this revision.
The PS1 reference includes all Cargo features. The manifest below shows which features are enabled by default.
Dependencies
critical-section(shared repository crate): all targets; optional; features:restore-state-boolpsx-hw(shared repository crate): all targetspsx-io: all targets
Cargo features
| Feature | Enables |
|---|---|
alloc | No additional dependency features |
boot-trace | No additional dependency features |
critical-section | dep:critical-section |
default | No additional dependency features |
hazard-trampolines-256 | No additional dependency features |
present-queue | psx-io/present-queue |
scratchpad-stack-check | No additional dependency features |
strict-faults | No additional dependency features |
Read the complete manifest and feature comments.
Source layout
The list includes internal implementation and test files. Public modules, types, functions and their signatures are indexed in the API reference above.
14 source and manifest files
Cargo.tomlsrc/bios.rs: The runtime's one remaining BIOS entry point: TTYputchar.src/builtins.rs: Corrected software 64-bit integer builtins for the PSX target.src/cache.rs: Instruction-cache invalidation, done directly on the hardware.src/critical_section.rs: Critical sections: run code with CPU interrupts masked.src/heap.rs: Bump allocator gated behind theallocfeature.src/interrupts.rs: Minimal interrupt support used by engine-level clocks.src/lib.rs: PS1 bare-metal runtime.src/mem.rs: Hand-scheduled R3000memcpy/memset/memcmp/bcmp.src/peripherals.rs: The one-per-program set of peripheral ownership tokens.src/present.rs: VBlank-kicked presentation: a one-frame-deep queue between the CPU and thesrc/scratchpad.rs: The CPU scratchpad, and running code with its stack there.src/tty.rs: TTY output for debug printing.src/wait.rs: Bounded spin waits shared by the VBlank and present-queue waits.