Jo Engine 2026.11.1
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
dsp.h File Reference

SCU DSP: the third processor of the Saturn (about 14 MHz, one 32 x 32 bits multiply and accumulate per cycle). More...

Go to the source code of this file.

Macros

#define JO_DSP_BANK_SIZE
 Words of a data RAM bank.
#define JO_DSP_PROGRAM_SIZE
 Words of the program RAM.
#define JO_DSP_PPAF
 Program control port (PPAF).
#define JO_DSP_PPD
 Program RAM data port.
#define JO_DSP_PDA
 Data RAM address port.
#define JO_DSP_PDD
 Data RAM data port.
#define JO_DSP_PPAF_EXECUTE
 PPAF: execute (write: start, read: running).
#define JO_DSP_PPAF_LOAD
 PPAF: program counter load (the low 8 bits).
#define JO_DSP_PPAF_DMA
 PPAF: a DMA of the DSP is in progress.

Functions

void jo_dsp_load_program (const unsigned int *const program, const unsigned int count)
 Stop the DSP and load a program.
void jo_dsp_write_data (const unsigned int bank, const unsigned int address, const unsigned int *const data, const unsigned int count)
 Write the data RAM (the DSP must be stopped).
void jo_dsp_read_data (const unsigned int bank, const unsigned int address, unsigned int *const data, const unsigned int count)
 Read the data RAM (the DSP must be stopped).
static __jo_force_inline void jo_dsp_start (const unsigned int pc)
 Start the program loaded by jo_dsp_load_program().
static __jo_force_inline bool jo_dsp_is_running (void)
 Check if the DSP is running.
static __jo_force_inline void jo_dsp_wait (void)
 Wait for the end of the program started by jo_dsp_start().

Detailed Description

SCU DSP: the third processor of the Saturn (about 14 MHz, one 32 x 32 bits multiply and accumulate per cycle).

Author
Johannes Fetz
Remarks
The DSP has 256 instructions of program RAM and 4 banks of 64 words of data RAM. It reads and writes the high work RAM and the B-bus by DMA (not the low work RAM). It has no division
Programs are written in DSP assembler and converted to a C array by Compiler/COMMON/scudsp_asm.py
The 3D module can use the DSP to transform the vertices (see jo_3d_enable_dsp())
Warning
The data RAM and the program RAM can only be accessed by the CPU when the DSP is stopped

Macro Definition Documentation

◆ JO_DSP_BANK_SIZE

#define JO_DSP_BANK_SIZE

Words of a data RAM bank.

◆ JO_DSP_PDA

#define JO_DSP_PDA

Data RAM address port.

◆ JO_DSP_PDD

#define JO_DSP_PDD

Data RAM data port.

◆ JO_DSP_PPAF

#define JO_DSP_PPAF

Program control port (PPAF).

◆ JO_DSP_PPAF_DMA

#define JO_DSP_PPAF_DMA

PPAF: a DMA of the DSP is in progress.

◆ JO_DSP_PPAF_EXECUTE

#define JO_DSP_PPAF_EXECUTE

PPAF: execute (write: start, read: running).

◆ JO_DSP_PPAF_LOAD

#define JO_DSP_PPAF_LOAD

PPAF: program counter load (the low 8 bits).

◆ JO_DSP_PPD

#define JO_DSP_PPD

Program RAM data port.

◆ JO_DSP_PROGRAM_SIZE

#define JO_DSP_PROGRAM_SIZE

Words of the program RAM.

Function Documentation

◆ jo_dsp_is_running()

__jo_force_inline bool jo_dsp_is_running ( void )
static

Check if the DSP is running.

Returns
true until the END instruction (and the end of the last DMA of the DSP)

◆ jo_dsp_load_program()

void jo_dsp_load_program ( const unsigned int *const program,
const unsigned int count )

Stop the DSP and load a program.

Parameters
programInstructions
countInstruction count (256 at most)

◆ jo_dsp_read_data()

void jo_dsp_read_data ( const unsigned int bank,
const unsigned int address,
unsigned int *const data,
const unsigned int count )

Read the data RAM (the DSP must be stopped).

Parameters
bankBank (0 to 3)
addressFirst word (0 to 63)
dataWords (output)
countWord count

◆ jo_dsp_start()

__jo_force_inline void jo_dsp_start ( const unsigned int pc)
static

Start the program loaded by jo_dsp_load_program().

Parameters
pcFirst instruction
Remarks
The DSP runs until its END instruction, the CPU keeps working (see jo_dsp_is_running())

◆ jo_dsp_wait()

__jo_force_inline void jo_dsp_wait ( void )
static

Wait for the end of the program started by jo_dsp_start().

◆ jo_dsp_write_data()

void jo_dsp_write_data ( const unsigned int bank,
const unsigned int address,
const unsigned int *const data,
const unsigned int count )

Write the data RAM (the DSP must be stopped).

Parameters
bankBank (0 to 3)
addressFirst word (0 to 63)
dataWords
countWord count