psx.wiki

PS-X OS

Kernel of the PlayStation that provides its services as C functions.

This is an old revision of this page, as edited by RemmyLee at 02:22, 23 October 2026. Edit this revision | Latest revision

Overview

The PS-X OS was developed for the R3000. The R3000 is the CPU of the PlayStation.1

The kernel is a set of services (subroutines) that control the R3000 and the PlayStation hardware. Each service is a C language function.1

The PS-X OS takes at most 64 kilobytes of RAM.1

The OS discloses its system tables. Applications can extend the OS and read its internal data.1

The OS leaves out the checks for prohibited operations that other operating systems perform. The application must perform these checks.1

The OS has no user interface for operating the hardware directly. The debug monitor in the debugging environment is the exception.2

Tasks

The PS-X OS is a multi-tasking operating system. It starts in single task mode.3

A program that does not start more threads stays in single task mode.3

Boot

The OS has two start modes. The DIP switches of the target box select the mode at power on or reset.2

In hardware mode the OS boots as the PlayStation hardware does.2

The application boot jumps to a fixed address in ROM. The boot code then checks the CD-ROM drive and the other hardware connected to the PlayStation.2

The application boot then checks the type of disc.2

On the right disc the boot code reads the file SYSTEM.CNF. The boot code then starts the program named in SYSTEM.CNF.2

With no disc the application boot runs a looping demonstration.2

On a development system booted from a PC/AT host, the kernel takes its default configuration and the remote debugger starts. The executable is then loaded by hand.2

File System

The file system assumes that files are on CD-ROM. It is based on ISO 9660 level 1.4

File systems are accessed through device drivers. Several file systems can therefore coexist.5

A file name is an 8-character base name and a 3-character extension. A period separates the two. This is the MS-DOS name format.4

Names use 1-byte alphanumeric characters. Katakana and kanji cannot be used.4

Subdirectories cannot be created. All files are in the root directory, and the number of files there has no limit.4

Memory Map

The memory map of the PS-X OS is the memory map of the CPU.6

Interface registers of peripheral devices are mapped in logical space as memory mapped I/O.6

Memory can be accessed in units of 1 to 4 bytes.6

An interface register must be accessed in its own unit size. Any other size raises a bus error.6

System Tables (ToT)

The OS discloses its internal system tables through the ToT (Table of Tables) structure. ToT is at address 0x00000100.7

ToT has the following entries:

Table 1: System tables
Entries Nature
0 Queue header requires interrupt processing7
1 Task state queue header
2 Task management block
3 System reserved
4 Event management block
5 to 31 System reserved

The structure is defined in include/kernel.h. Each entry holds the lead address and the size in bytes of one system table.7

struct ToT {                  /*system table table*/
    unsigned long *head;      /*system table lead address*/
    long size;                /*system table size (byte)*/
};

Function Calls

A C function receives its first 4 arguments in A0 to A3.8

Space for those 4 arguments is also reserved on the stack. Further arguments are passed on the stack.8

A return value of less than 32 bits is in V0. For a 64-bit double the high 32 bits are in V1.8

An external interrupt or an error other than a debug error saves the program counter to the EPC register of coprocessor 0.8

The CPU then jumps to 0x00000080.8

The CPU page lists the register assignments.

Services

The OS services are called application programmer interfaces (API). A program that calls the OS links their function libraries.9

The API has the following services:

Table 2: PS-X OS services
Service Content
Module Management Service Loads and executes user application programs9
Event Management Service Controls program execution triggered by asynchronous events
Controller Service Supports up to 64 controllers of up to 16 buttons each
I/O Management Service Low-level input and output to files and logical devices
Thread Management Service Threads of register states, stack areas and CPU states
Other Services I-cache and R3000 setup, enabling and disabling interrupts
Standard C Library K&R standard C functions such as string operations and standard I/O
Root Counter Management Service Counters for timing10

All file control on the PlayStation goes through the I/O management service.9

Root Counters

The PS-X OS has 4 root counters. Each counts automatically.

Table 3: Root counters
Counter Counts
1 Display pixels10
2 Horizontal synchronization
3 System clock
4 Vertical synchronization

A counter counts up from zero. At its target value it raises an interrupt, clears to zero and counts again.10

Every counter except vertical synchronization takes a 16-bit target value. The target value of vertical synchronization is fixed at 1.10

The root counter and the event management service together detect the start of the vertical blanking period.11

Programming Notes

EnterCriticalSection() stops interrupts.3

An overlay runs as a child process of a resident module. The application must load and start the overlay itself.3

The PlayStation has no character generator and no fonts. An application draws its own text as graphics.3

The C library has heap functions. The OS does not initialize the heap.11

The program passes the start address and size of the heap to the heap initialization function.11

The entry point of an executable is set by a function name at link time. The default is main(), and the entry function takes no argument.11

A program needs a stack pointer value as well as a start address. A stack pointer at an address that cannot be accessed causes a bus error.12

Standard output is file descriptor 0 and standard input is file descriptor 1. Both use RS232C channel 0. Its device name is tty00.12

The tty00 port uses 8-bit characters, 1 stop bit, no parity and hardware flow control.12

References


  1. ^ a b c d e Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 1-3.

  2. ^ a b c d e f g h Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 2-3.

  3. ^ a b c d e Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 4-3.

  4. ^ a b c d Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 2-4.

  5. ^ Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 1-4.

  6. ^ a b c d Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 2-5, Table 2-2.

  7. ^ a b c Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 2-6, Table 2-3.

  8. ^ a b c d e Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 2-8.

  9. ^ a b c Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 3-3.

  10. ^ a b c d Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 3-4.

  11. ^ a b c d Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 4-4.

  12. ^ a b c Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 4-5.

Categories: System software