New SPU Findings and Questions

Members research, findings and information that can be useful towards the PlayStation 1.
Post Reply
User avatar
nocash
Verified
PSX Aficionado
PSX Aficionado
Posts: 574
Joined: Nov 12, 2012
Contact:

New SPU Findings and Questions

Post by nocash » April 11th, 2024, 11:35 pm

SPU Soft Reset
If and as long as SPUCNT.bit15=0: All voices are Keyed Off, writes to Key On are ignored, and all voices are forced to ADSR volume=0000h.
That is about same as FLG.bit7 on SNES APU (with big thanks to Anomie for rev-engineering the SNES hardware).

Unstable 32bit SPU Writes
One long-standing problem has been that I had never figured out how to issue stable SPU writes. The problem has been that I've been using some 32bit writes here and there, which does work most of the time, but fails at about 1:8 chance, then causing the lower 16bit to be left unchanged.
Doing all SPU writes in 16bit units does fix that problem; I am also adding a warning message on 32bit writes in no$psx, in case somebody else runs into that problem.

SPU-ADPCM Loops
The game Viewpoint is doing some unusual stuff for the background music. It does set the voice start address to a looped 10h-byte dummy ADPCM block. And when starting the actual music it doesn't issue any Key On with changed start address, instead it's merely changing the loop address.
As by now, I had emulated ADPCM decoding as so (with all steps done at BEGIN of each ADPCM blocks):

Code: Select all

step1: if loop_start_flag then loop_addr=addr
step2: decode_samples(addr), addr=addr+10h
step3: if loop_end_flag then addr=loop_addr
Whereas, step3 must be done near END of the ADPCM block, so that Viewpoint gets a chance to overwrite "loop_addr".
(Although, even on real hardware, I suspect that the game's write to loop_addr may collide with step1, so it might occassionally start the level with missing music on at least one of the two music channels).

Viewpoint Stereo Music
This seems to be a bug in Viewpoint (?), not a hardware/emulation problem: The game does output music on voice 0 and 1, and VIEW.DIR\streams\.. contains stereo sound in VCML and VCMR chunks, and the Options screen allows to select between Stereo and Mono mode. Nonetheless, the music playback seems to be always Mono (it starts with voice 0 and 1 volume set to left-only and right-only, but it does then apply a fade-in effect which sets left/right sides of both voices to the same volume).
Well, I guess that's just a bug in the game... unless somebody with good ears & headphones can hear stereo music in Viewpoint?

SPU DMA uploads?
I had thought that I knew how to upload data to SPU. But, I have just encountered problems when trying to upload a looped 40h-byte ADPCM sample... it doesn't loop properly : /
After changing the DMA transfer length to 80h bytes (two 40h byte blocks), it's now working (and properly looping through the first 40h bytes).
But I don't know what went wrong there... maybe the last some transfer bytes were somehow left in the FIFO instead of being written to SPU RAM... didn't anybody else encounter such problems?

SPU 8-byte or 16-byte address alignment?
The various SPU address registers do contain addresses in 8-byte steps... or do they?
It seems that there are case(s) where the low bit is ignored, hence resulting in 16-byte aligned addresses.
For example, when setting voice start to 12348h/8, with loop_start_flag in the first block, then one would expect to see loop_addr=12348h/8, but the hardware does instead set it to loop_addr=12340h/8.
I am not sure what is happening there exactly, maybe the first loop cycle is only 8 bytes long, and the following ones are forced to 16 byte length? And, there are many more address registers, and I've no idea which (if any) do support "odd" addresses on 8-byte boundaries.
Is there anything know about that?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests