SaturnRingLibrary 0.9.2
SGL wrapper
Loading...
Searching...
No Matches
SRL::System Class Referencefinal

Detailed Description

System-level hardware control and BIOS services.

Provides a modern C++ interface to the Sega Saturn BIOS service routines. Each method maps to a function pointer stored in the system work area (0x6000000-0x6000FFF).

Functional Groups:
Group Functions
SCU Interrupt Routine Access SetInterruptHandler, GetInterruptHandler
SH2 Interrupt Vector Access SetInterruptVector, GetInterruptVector
SCU Interrupt Mask SetInterruptMask, ChangeInterruptMask, GetInterruptMask
Simple Semaphore TestAndSetSemaphore, ClearSemaphore
System Clock SetClockMode, GetClockMode
SCU Interrupt Priority SetInterruptPriorities
CD Multiplayer ExecuteCdMultiplayer
Power-On Clear Memory PowerOffClearMemory
MPEG Check CheckMpeg
CD Track Verification CheckTrack
Exit Exit
Warning
SCU interrupt-related operations and clock changes must only be performed from the master SH2. Using them from the slave SH2 is undefined.
Basic Usage:
// Set up interrupt mask allowing only V-Blank
// Read current clock mode
auto clock = System::GetClockMode();
@ VBlankIn
Enable V-Blank In interrupt (0x0001).
Definition srl_interrupt.hpp:88
static ClockMode GetClockMode()
Query the current system clock mode.
Definition srl_system.hpp:335
static void SetInterruptMask(uint32_t mask)
Replace the entire SCU interrupt mask.
Definition srl_system.hpp:264
See also
Interrupt for the higher-level type-safe interrupt API
Timer for hardware timer services

#include <srl_system.hpp>

Classes

struct  InterruptPriorityTable
 SCU interrupt priority table (32 longword entries). More...

Static Public Member Functions

SCU Interrupt Routine Access

Register and query SCU interrupt handler functions.

static void SetInterruptHandler (InterruptType type, void *handler)
 Register a function as an SCU interrupt handler.
static void * GetInterruptHandler (InterruptType type)
 Query the currently registered SCU interrupt handler.
SH2 Interrupt Vector Access

Register and query SH2 interrupt vector entries.

static void SetInterruptVector (uint32_t vector, void *handler)
 Set an SH2 interrupt vector entry.
static void * GetInterruptVector (uint32_t vector)
 Query the current SH2 interrupt vector entry.
Simple Semaphore

Atomic test-and-set semaphore operations.

static uint32_t TestAndSetSemaphore (uint32_t semaphore)
 Atomically test and set a system semaphore.
static void ClearSemaphore (uint32_t semaphore)
 Release a system semaphore.
SCU Interrupt Mask

Control which SCU interrupt sources are enabled.

static void SetInterruptMask (uint32_t mask)
 Replace the entire SCU interrupt mask.
static void ChangeInterruptMask (uint32_t andMask, uint32_t orMask)
 Modify the SCU interrupt mask with AND/OR logic.
static uint32_t GetInterruptMask ()
 Read the current SCU interrupt mask.
System Clock

Change and query the master CPU clock frequency.

static void SetClockMode (ClockMode mode)
 Switch the system clock frequency.
static ClockMode GetClockMode ()
 Query the current system clock mode.
SCU Interrupt Priority

Reprogram the SCU interrupt priority dispatch table.

static void SetInterruptPriorities (const InterruptPriorityTable &priorityTable)
 Program the SCU interrupt routine priority table.
CD Multiplayer

Launch the CD Multiplayer application.

static void ExecuteCdMultiplayer ()
 Launch the CD Multiplayer and relinquish control.
Power-On Clear Memory

8-byte BIOS-managed memory area preserved across soft resets.

static volatile uint8_t & PowerOffClearMemory ()
 Access the power-on clear memory area.
MPEG Cartridge Check

Check for the presence and readiness of the MPEG cartridge.

static int32_t CheckMpeg (int32_t dummy=0)
 Check MPEG cartridge status (blocking).
CD Track Verification

Verify disc authenticity by comparing track positions.

static void CheckTrack (int32_t trackNumber)
 Verify a CD track position against TOC data.
Exit

Terminate the application and transfer control to the system.

static void Exit (int32_t exitCode=0)
 Terminate the application.

BIOS Function Pointer Types

Type aliases matching the calling conventions of each BIOS entry point.

enum class  InterruptType : uint32_t {
  VBlankIn = 0x40 , VBlankOut = 0x41 , HBlankIn = 0x42 , Timer0 = 0x43 ,
  Timer1 = 0x44 , DspEnd = 0x45 , SoundRequest = 0x46 , SystemManager = 0x47
}
 SCU interrupt type identifiers. More...
enum class  ClockMode : uint32_t { Mode26MHz = 0 , Mode28MHz = 1 }
 System clock mode selection. More...