Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Module disc_base

Module disc_base 

Source
Expand description

Where this program’s data sits on the disc it was booted from.

A program that owns its disc knows exactly where everything is: pack LBAs are cooked in, CD-DA tracks are numbered from 2. Put several programs on one disc and those absolutes stop being absolute. Rather than re-cook every program for every disc it might ship on, a multi-program loader hands over two numbers at boot and the SDK’s disc entry points apply them.

Both default to zero, so a program booted the ordinary way – BIOS reads SYSTEM.CNF, runs the one EXE – behaves exactly as it did before this module existed. Nothing needs a separate build to work on both.

The handover is by register, not by an agreed memory address: there is no address the SDK can prove a game will leave alone (hl-psx already uses the scratchpad, and a headerless PSX-EXE gives no way to bound .bss). psx-rt’s _start takes the loader’s arguments and calls install before anything else runs.

Constants§

HANDOFF_MAGIC
Marks $a0 as a loader handover rather than boot-time register garbage. ASCII PSXD.

Functions§

cdda_track_base
CD-DA tracks belonging to programs ahead of this one on the disc.
install⚠
Record the loader’s handover, if magic says there is one.
lba_offset
Sectors between the disc’s LBA 0 and this program’s.
shift_lba
Translate a disc-relative LBA into a physical one.
shift_track
Translate a program-relative CD-DA track number into a physical one.