psx.wiki

Psy-Q: Difference between revisions

Revision as of 02:58, 23 October 2026
RemmyLee
(Run-time library pages: 20 libraries from the Library Overview and Reference 4.4)
Revision as of 03:05, 23 October 2026
RemmyLee
(File libraries under their SDK: /sdk/psy-q/; Psy-Q page; sidebar SDKs and System software)
Line 1:Line 1:
+---
+title: Psy-Q
+type: tool
+summary: Development kit of compiler tools and Sony's run-time library for PlayStation programs.
+category: SDKs
+category: Psy-Q
+---
+
+## Overview
+
+Psy-Q is the set of compiler, assembler and linker programs that build PlayStation programs. Sony distributed it on the Programmer Tools CD (DTL-S2002) in the \PSYQ directory. The run-time library was on the same CD in the \PSX directory. The \PSX directory contains the "lib" and "include" directories for compiling code, and the \PSYQ directory contains the Psy-Q development libraries.[^rd]
+
+A program therefore uses both. It calls the functions of the run-time library (libgpu, libgte, libspu, libcd and the others listed below), and the Psy-Q tools compile it and link those libraries into the executable. The Psy-Q linker links libgs, libgte, libgpu, libetc, libapi and libsn automatically unless the -nostdlib option is given.[^cc]
+
+The GNU compiler parts of the distribution are "provided by Psy-Q" and are derived from GNU source files. They may be used only under the terms of the GNU public license, and they must be copied into the \psyq directory before the tools are complete.[^rd][^gnu]
+
+## CCPSX
+
+CCPSX is the control program of the tools. It accepts a list of source files and option switches, and it calls the C pre-processor, the C compiler, the assembler and the linker as each file requires.[^cc]
+
+The case of a switch is significant, so -O and -o are different options. A long command line can be kept in a control file. Writing an @ sign before the file name embeds its contents in the command line: `ccpsx @main.cf -o main`. A control file may span several lines and may refer to another control file.[^cc]
+
+CCPSX finds its programs through environment variables, which are normally set in AUTOEXEC.BAT:[^cc]
+
+Table: CCPSX environment variables
+
+| Variable | Content |
+| --- | --- |
+| COMPILER_PATH | Directory of the compiler executables. With the GNU C compiler CCPSX looks there for CPPPSX.EXE, CC1PSX.EXE and CPLUSPSX.EXE. |
+| PSYQ_PATH | Directory of the Psy-Q executables, such as PSYLINK.EXE |
+| C_INCLUDE_PATH | Directory of the standard C header files, searched for an #include in angle brackets |
+| LIBRARY_PATH | Directory of the standard library files |
+| TMPDIR | Directory for temporary files made during compilation |
+
+The CCPSX documentation gives the following settings as an example. The run-time library headers and libraries are in c:/psx, and the Psy-Q programs are in c:/psyq. The paths use forward slashes.[^cc]
+
+```
+set COMPILER_PATH=c:/psyq
+set PSYQ_PATH=c:/psyq
+set C_INCLUDE_PATH=c:/psx/include
+set LIBRARY_PATH=c:/psx/lib
+set TMPDIR=c:/
+```
+
+CCPSX decides how to process each source file from its extension.[^cc]
+
+Table: CCPSX processing by file extension
+
+| Extension | Stages |
+| --- | --- |
+| .C | C pre-processor, C compiler, Assembler, Linker |
+| .I | C compiler, Assembler, Linker |
+| .CC, .CPP | C pre-processor, C++ compiler, Assembler, Linker |
+| .II, .IPP | C++ compiler, Assembler, Linker |
+| .ASM | C pre-processor, Assembler, Linker |
+| .S | Assembler, Linker |
+| other | Linker |
+
+The CCPSX documentation calls PSYLINK the standard Psy-Q linker. An option of the form -Xoption passes /option to the linker, so any linker option can be given through CCPSX.[^cc]
+
+## Programs
+
+The BIN directory of the Psy-Q 4.6 distribution holds the following programs. The CCPSX documentation names the role of four of them; the others are listed by file name only.[^bin46]
+
+Table: Psy-Q programs in Run-Time Library 4.6
+
+| Program | Use |
+| --- | --- |
+| CCPSX.EXE | Control program that runs the stages below[^cc] |
+| CPPPSX.EXE | C pre-processor (GNU)[^cc] |
+| CC1PSX.EXE | C compiler (GNU)[^cc] |
+| CC1PLPSX.EXE | |
+| ASPSX.EXE | |
+| ASMPSX.EXE | |
+| PSYLINK.EXE | Linker[^cc] |
+| PSYLIBD.EXE | |
+| PSYMAKE.COM | |
+| PSYQ.INI | |
+
+Sony released new versions of the GNU parts with the run-time library. Release 4.7 updated ASPSX, CC1PSX, CC1PLPSX and CPPPSX, added the source of gcc 2.95 and removed the source of gcc 2.8.1. The 4.7 notes list these files under "SDevTC Tools" in a directory named pssn.[^rl47]
+
+## LIBSN
+
+LIBSN is the library of Psy-Q functions, declared in libsn.h. It is one of the libraries the linker links by default.[^sn][^cc]
+
+The release of 20 September 1995 added SNFlushCache(). It replaces the FlushCache() function of the run-time library. The library version must be called with interrupts off, and the replacement does not have that limitation and runs faster. It has a different name so that it can be told apart from the version in the other PlayStation libraries.[^sn]
+
+The startup modules in Sony's samples are marked "SN Systems replacement for main module".[^start]
+
+## Run-Time Library
+
+The run-time library is Sony's. Release 3.6 was the current release on the Programmer Tools CD of November 1996, and the CD kept release 3.5 in its \OLD_LIBS directory.[^rd] Later releases include 4.4, whose Library Overview is dated January 1999, and 4.7 of February 2000.[^lo44][^rl47]
+
+The LIB directory of release 4.7 holds the following libraries and objects:[^lib47]
+
+Table: Libraries of Run-Time Library 4.7
+
+| File | Page |
+| --- | --- |
+| LIBAPI.LIB | [libapi](/sdk/psy-q/libapi/) |
+| LIBC.LIB, LIBC2.LIB | [libc](/sdk/psy-q/libc/) |
+| LIBMATH.LIB | [libmath](/sdk/psy-q/libmath/) |
+| LIBETC.LIB | [libetc](/sdk/psy-q/libetc/) |
+| LIBGPU.LIB | [libgpu](/sdk/psy-q/libgpu/) |
+| LIBGTE.LIB | [libgte](/sdk/psy-q/libgte/) |
+| LIBGS.LIB | [libgs](/sdk/psy-q/libgs/) |
+| LIBHMD.LIB | [libhmd](/sdk/psy-q/libhmd/) |
+| LIBCD.LIB | [libcd](/sdk/psy-q/libcd/) |
+| LIBDS.LIB | [libds](/sdk/psy-q/libds/) |
+| LIBPRESS.LIB | [libpress](/sdk/psy-q/libpress/) |
+| LIBSPU.LIB | [libspu](/sdk/psy-q/libspu/) |
+| LIBSND.LIB | [libsnd](/sdk/psy-q/libsnd/) |
+| LIBPAD.LIB, LIBTAP.LIB, LIBGUN.LIB | [libpad](/sdk/psy-q/libpad/) |
+| LIBCARD.LIB | [libcard](/sdk/psy-q/libcard/) |
+| LIBMCRD.LIB | [libmcrd](/sdk/psy-q/libmcrd/) |
+| LIBMCX.LIB | [libmcx](/sdk/psy-q/libmcx/) |
+| LIBCOMB.LIB | [libcomb](/sdk/psy-q/libcomb/) |
+| LIBSIO.LIB | [libsio](/sdk/psy-q/libsio/) |
+| LIBSN.LIB | LIBSN, above |
+| MCGUI.OBJ, MCGUI_E.OBJ | [mcgui](/sdk/psy-q/mcgui/) |
+| 2MBYTE.OBJ, 8MBYTE.OBJ, NOHEAP.OBJ, NONE3.OBJ, NOPRINT.OBJ, POWERON.OBJ | Link-time objects |
+
+## Conversion Tools
+
+Sony shipped data conversion tools with the library. Release 4.4 lists the following graphics tools:[^cv44]
+
+Table: Graphics conversion tools in Run-Time Library 4.4
+
+| File Name | Version | Release Date | Explanation |
+| --- | --- | --- | --- |
+| bmp2tim.exe | 2.2 | 96/01/25 | Converter from BMP to [TIM](/formats/tim/) |
+| dxf2rsd.exe | 2.81 | 96/04/25 | Converter from DXF to [RSD](/formats/rsd/) |
+| labp.exe | 1.12 | 98/01/12 | Label processor and [HMD](/formats/hmd/) assembler |
+| meshconv.exe | 1.2 | 98/01/12 | MSH (extended RSD file) creator |
+| mimefilt.exe | 1.51 | 96/04/01 | MIMe difference file creator |
+| mimesort.exe | 2.1 | 96/06/11 | TMD vertex information sorting tool |
+| mkmime.exe | 1.12 | 98/07/12 | MIMe HMD creator |
+| mktod.exe | 1.4 | 96/05/01 | [TOD](/formats/tod/) creator |
+| pict2tim | 3.1 | 94/10/13 | Converter from PICT to TIM |
+| rgb2tim.exe | 2.1 | 96/04/01 | Converter from RGB to TIM |
+| rsd2dxf.exe | 1.00 | 94/10/11 | Converter from RSD to DXF |
+| rsd2hmd.exe | 1.5 | 98/01/12 | Converter from new RSD to HMD |
+| rsdcat.exe | 1.06 | 97/08/18 | RSD catenation tool |
+| rsdform.exe | 1.81 | 96/04/01 | RSD modification tool |
+| rsdlink.exe | 3.72 | 96/10/01 | Converter from RSD to [TMD](/formats/tmd/) |
+| rsdup.exe | 1.1 | 98/01/12 | Converter from RSD to new RSD |
+| tim2bmp.exe | 1.2 | 98/05/01 | Converter from TIM to BMP |
+| timpos.exe | 1.1 | 96/05/01 | TIM VRAM address changing tool |
+| tmd2pmd.exe | 1.14 | 95/10/05 | Converter from TMD to [PMD](/formats/pmd/) |
+| tmdinfo.exe | 1.25 | 96/04/01 | TMD information tool |
+| tmdsort.exe | 1.25 | 96/04/01 | TMD sorting tool |
+| xhmd.exe | 1.20 | 98/09/21 | HMD disassembler |
+| movconv.exe | 2.2 | 97/08/06 | Movie data converter |
+| movpack.exe | 1.6 | 97/08/06 | XA and [STR](/formats/str/) interleave tool |
+| mc32.exe | 3.2 | 98/09/22 | Movie data converter, 32-bit version |
+
+The sound tools of the same release are as follows:[^cv44s]
+
+Table: Sound conversion tools in Run-Time Library 4.4
+
+| File Name | Version | Release Date | Explanation |
+| --- | --- | --- | --- |
+| aiff2vag.exe | 3.3 | 98/09/22 | Waveform data converter to [VAG](/formats/vag/) |
+| mkvab.exe | 2.0 | 96/05/01 | [VAB](/formats/vab/) (music bank) creator |
+| seq2sep.exe | 1.0 | 95/03/09 | [SEP](/formats/sep/) packer |
+| smf2seq.exe | 2.4 | 98/09/22 | Sequence data converter to [SEQ](/formats/seq/) |
+| vabsplit.exe | 2.0 | 96/05/01 | VAB splitter |
+
+## References
+
+[^rd]: Sony Computer Entertainment Inc. Programmer Tools CD (DTL-S2002), README.TXT. 11/26/96. Sections "CD-ROM Contents" and "CD-ROM Contents - Highlights".
+[^gnu]: Sony Computer Entertainment Inc. Programmer Tools CD (DTL-S2002), \psyq\README.TXT, "GNU Contents". 12/12/96.
+[^cc]: PlayStation Programmer Tools, \psyq\bin\DOC\CCPSX.TXT, "A Brief Introduction To Using CCPSX". Sections "What It Does", "Command Line Format", "Environment Variables" and the linker section.
+[^sn]: PlayStation Programmer Tools, \psyq\src\LIBSN\README.TXT. LIBSN dated 20-Sep-95.
+[^start]: PlayStation Programmer Tools, \psx\sample\scea\SAMPLER\STARTUP\STARTUP.S, line 1.
+[^bin46]: Psy-Q 4.6 distribution, BIN directory listing.
+[^lib47]: Sony Computer Entertainment Inc. Run-Time Library Release 4.7, LIB directory listing.
+[^rl47]: Sony Computer Entertainment Inc. Runtime Library Release 4.7, LIB\readme.txt, "Library Changes, New Additions, and Known Bugs from Release 4.6". February 2000. Section "SDevTC Tools".
+[^cv44]: Sony Computer Entertainment Inc. PlayStation Programmer Tools, \psyq\bin\README_E.TXT, graphics tools list. Document Release 1.0 for Run-time Library Release 4.4.
+[^cv44s]: Sony Computer Entertainment Inc. PlayStation Programmer Tools, \psyq\bin\README_E.TXT, sound tools list. Document Release 1.0 for Run-time Library Release 4.4.
+[^lo44]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. About This Manual.