psx.wiki
Log in
Main page
Hardware
Hardware tests
System software
SDKs
File formats
Games
Tools
History
All pages
page
view source
history
View source for CD-ROM System
← CD-ROM System
You do not have permission to edit this page.
Log in
to edit.
--- title: CD-ROM System type: component summary: Drive and decoder that read CD-DA, CD-ROM XA and PlayStation discs. category: Hardware --- ## Overview The CD-ROM system is composed of the drive, the decoder and the other components needed to read a CD-ROM. It supports CD-DA, CD-ROM XA and PlayStation disc formats.[^hw15] The CD-ROM is the medium on which PlayStation applications are supplied, and the file system of the operating system therefore assumes that files are on CD-ROM.[^os24] The CD-ROM decoder reads data from a compact disc and either reproduces it as sound or transfers it to main memory. Data read from the drive into the CD-ROM buffer is error corrected, and audio data is then processed by the sound source in the decoder. The resulting audio signal goes to the [SPU](/hardware/spu/) through a mixer built into the decoder.[^hw43] The decoder reproduces CD-DA 16-bit PCM data and the ADPCM data defined by CD-ROM XA.[^hw43] The details are on the following pages: Table: CD-ROM pages | Page | Contents | | --- | --- | | [CD-ROM Registers](/hardware/cd-rom/registers/) | Host interface registers, banks, interrupts, audio attenuators | | [CD-ROM Commands](/hardware/cd-rom/commands/) | Every command with parameters, responses, errors and timing | | [XA Audio](/hardware/cd-rom/xa-audio/) | ADPCM sectors, interleave, decoding, sound map | | [CD-ROM Disc Format](/hardware/cd-rom/disc-format/) | Sectors, subheader, subchannel Q, file system, copy protection | ## Drive Controller The CPU has direct access only to the host interface of the decoder chip. That interface carries commands and responses between the CPU and the drive's microcontroller, delivers sector data and sets the audio volume. It consists of four banks of four 8-bit registers at 1F801800h to 1F801803h.[^spxio] The microcontroller is a Motorola MC68HC05 with its program in on-chip ROM, which cannot be reprogrammed.[^spxhc05] It runs a main loop that polls for incoming sectors and incoming commands and maintains the drive mechanics. The loop has no fixed priority between these events.[^spxmain] The chips of the drive changed over the board revisions:[^spxint][^spxchips] Table: CD-ROM chips | Function | Chips | | --- | --- | | Microcontroller | MC68HC05 | | Decoder and sector buffer interface | CXD1199BQ (PU-7), CXD1815Q (later boards) | | Sector buffer | 32K x 8 SRAM | | Signal processor | CXD2510Q (older boards) | | Servo amplifier | CXA1782BR (older boards) | | Signal processor and servo | CXD2545Q (later boards) | | Servo, signal processor and decoder | CXD1817R | | Servo, signal processor and SPU | CXD2938Q (later boards) | | Servo, signal processor, SPU and SPU RAM | CXD2941R (PM-41(2)) | The CXD2545Q is a CD digital signal processor with a built-in digital servo. It has a 32K RAM for a wide frame jitter margin, error correction with double C1 and quadruple C2 correction, and normal, double and quadruple speed playback.[^cxd2545] The CXD1199AQ decoder supports CD-ROM, CD-I and CD-ROM XA formats with real-time error correction, double speed playback and a built-in ADPCM decoder.[^cxd1199] ## Sectors and Transfer Rate A CD-ROM can rotate the disc at normal speed or double speed. Normal speed has the same rotation as an ordinary CD player and gives 150KB/sec, which is 75 sectors per second. Double speed gives 300KB/sec, or 150 sectors per second.[^ovr114] Each sector is an audio sector, an ADPCM sector or a data sector. A data sector normally holds 2048 bytes of user data.[^ovr113] The sector layouts are on the [CD-ROM Disc Format](/hardware/cd-rom/disc-format/) page. The CD-ROM is very slow compared to the main bus. The CD-ROM subsystem therefore keeps the data of each sector in a local memory called the sector buffer before it is transferred.[^ovr115] The contents of the buffer are valid only until the next sector overwrites them. A program must therefore transfer each sector to main memory in time, and libcd provides CdGetSector() for this. Data for the frame buffer or the sound buffer also passes through main memory first.[^ovr1114][^ovr1115] Sony gives the size of the sector buffer as 1 sector (usually 2KB).[^ovr1115] The decoder has 32KB of local memory, but the user cannot use all of it. The decoder's control software does not read ahead, so a read must start within 13.3 ms at standard speed or 6.6 ms at double speed after the data ready interrupt.[^ovr1120] psx-spx finds that the buffer has 8 slots, of which the controller uses only a few. It can hold one undelivered INT1, so sectors that are not taken in time are lost without notice.[^spxbuf][^spxresp] ## Sound Control The CD-ROM subsystem outputs two channels of audio, left and right, for both CD audio and ADPCM audio. The signals go to the SPU, where they are added to the output of the SPU voices to form the composite sound.[^ovr115] Four attenuators control the CD-ROM audio output. libcd sets them with CdMix() and the CdlATV structure.[^ovr115] Table: CD-ROM attenuators | Attenuator | Path | | --- | --- | | ATV0 | CD left to SPU left | | ATV1 | CD left to SPU right | | ATV2 | CD right to SPU right | | ATV3 | CD right to SPU left | The attenuators make it possible to play stereo, mono or swapped channels. In the SPU the CD input has its own volume and reverb enable, and then passes through the reverb unit to the final output.[^hw43][^spxatv] ## Primitive Commands The lowest level of operation is a primitive command sent directly to the CD-ROM subsystem. libcd issues them with CdControl(), which takes the command code, its parameters and an 8-byte result buffer.[^ovr115] Blocking commands wait for completion before they return. Non-blocking commands return at once, and CdSync() or a callback set with CdSyncCallback() reports their completion.[^ovr116][^ovr1112][^ovr1113] Commands are not queued, so a new command waits until the previous command has completed.[^ovr1112] The full set is on the [CD-ROM Commands](/hardware/cd-rom/commands/) page. A normal read is three commands: CdlSetloc sets the target, CdlReadN or CdlReadS seeks and reads, and CdlPause stops the read.[^spxslrp] CdlReadN retries a failed sector for up to 8 seconds, while CdlReadS reports the error without a retry for streaming.[^ovr119] The high-level functions CdReadFile(), CdReadExec() and CdPlay() combine these steps to read a file, load an executable or play CD-DA tracks.[^ovr1123][^ovr1124] ## Disc Swap A title that changes discs during play must first set the drive to standard speed with CdlSetmode. It may also stop the disc with CdlStop.[^ovr1124] CdlNop detects a new disc. The CdlStatShellOpen bit is always 1 while the cover is open, and it reads 1 once more after the cover closes and then 0. A change of the bit from 1 to 0 therefore means a new disc, and status bit 1 shows when the spindle turns again.[^ovr1124] After the cover closes, the subsystem reads the TOC of the new disc. Until it has finished only CdlNop and CdlGetTN may be issued, and CdlGetTN is repeated until it succeeds.[^ovr1124] CdDiskReady() waits for the cover to close and the status to settle. Sony gives the longest wait on a PlayStation as 3 seconds for a black PlayStation disc and 5 seconds for CD-DA. With no disc the wait is about 5 seconds.[^ref1015] ## Error Handling Sony asks that every CD-ROM program handle errors and also run a watchdog, which checks the state of the subsystem every few vertical syncs and restarts the operation after a timeout.[^ovr1122] CD-DA or XA play can stop on a seek error or when the cover is opened. CdlNop is then polled, and the track is played again when CdlStatPlay is clear.[^ovr1122] A read can stop in the same way, and Sony detects it by keeping the time of the last CdlDataReady and restarting the read when it is a few seconds old.[^ovr1123] On a disc that is hard to read, repeated errors and retries can make a read of many sectors take far longer than expected. The program then appears to hang.[^ovr1120] Seeks within the outer three minutes of the disc may not give correct results, and these minutes are normally left as dummy data.[^ovr1120][^ovr1121] ## References [^hw15]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 1-5. [^hw43]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 4-3, Figure 4-1, Figure 4-2. [^os24]: Sony Computer Entertainment Inc. PlayStation Operating System. August 1998. Page 2-4. [^ovr113]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-3, Table 11-1. [^ovr114]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-4. [^ovr115]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-5, Figure 11-1. [^ovr116]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-6, Table 11-2. [^ovr119]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-9. [^ovr1112]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-12. [^ovr1113]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-13. [^ovr1114]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-14. [^ovr1115]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-15. [^ovr1120]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-20. [^ovr1121]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-21. [^ovr1122]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-22. [^ovr1123]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-23. [^ovr1124]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 11-24. [^ref1015]: Sony Computer Entertainment Inc. Run-Time Library Reference. January 1999. Page 10-15, CdDiskReady(). [^cxd1199]: Sony Corporation. CXD1199AQ CD-ROM Decoder. Page 1. [^cxd2545]: Sony Corporation. CXD2545Q CD Digital Signal Processor with Built-in Digital Servo. Page 1. [^spxio]: psx-spx. CDROM Drive, CDROM Controller I/O Ports. https://psx-spx.consoledev.net/cdromdrive/ [^spxhc05]: psx-spx. CDROM Internal Info on PSX CDROM Controller, Motorola MC68HC05. https://psx-spx.consoledev.net/cdrominternalinfoonpsxcdromcontroller/ [^spxint]: psx-spx. CDROM Internal Info on PSX CDROM Controller, Decoder/FIFO and Signal Processor and Servo Amplifier. https://psx-spx.consoledev.net/cdrominternalinfoonpsxcdromcontroller/ [^spxchips]: psx-spx. CDROM Drive, CDROM - Test Commands, 19h,23h to 19h,25h. https://psx-spx.consoledev.net/cdromdrive/ [^spxmain]: psx-spx. CDROM Drive, CDROM - Mainloop/Responses, SUB-CPU Mainloop. https://psx-spx.consoledev.net/cdromdrive/ [^spxbuf]: psx-spx. CDROM Drive, CDROM - Response/Data Queueing, Sector Buffer. https://psx-spx.consoledev.net/cdromdrive/ [^spxresp]: psx-spx. CDROM Drive, CDROM - Mainloop/Responses, Responses. https://psx-spx.consoledev.net/cdromdrive/ [^spxatv]: psx-spx. CDROM Drive, CDROM Controller I/O Ports, ATV0 to ATV3. https://psx-spx.consoledev.net/cdromdrive/ [^spxslrp]: psx-spx. CDROM Drive, CDROM - Read Commands, Setloc, Read, Pause. https://psx-spx.consoledev.net/cdromdrive/