CPU_SMP.i

Summary
CPU_SMP.i
SMP macros
SMP_readyWait for SMP ready signal
SMP_execTransfer & execute SPC700 binary via IPL transfer
SMP_memcpyCopy bytes from CPU to SMP memory and return to IPL
SMP_jmpTransfer SPC700 control to address via IPL jump
SMP_playspcTransfer & start SPC music file using custom (fast!)
Helper macrosHelper macros for importing SPC dumps
SPC_incbinImport 64KB SPC RAM image
SPC_incbin_loImport lower 32KB of SPC RAM image
SPC_incbin_hiImport upper 32KB of SPC RAM image
SPC_incbin_stateImport SPC DSP/CPU state (#$87 bytes)

SMP macros

SMP_ready

Wait for SMP ready signal

SMP_exec

Transfer & execute SPC700 binary via IPL transfer

Parameters

:in:    dest      Destination address (uint16)    constant
:in:    source    Source address (uint24)         constant
:in:    length    Length (uint16)                 constant
:in:    exec      Jump address (uint16)           constant

Example

;Transfer and execute SMP code
;The __SMPCODE_***__ symbols are exported from Map.cfg
SMP_ready
SMP_exec          __SMPCODE_RUN__, __SMPCODE_LOAD__, __SMPCODE_SIZE__, __SMPCODE_RUN__

SMP_memcpy

Copy bytes from CPU to SMP memory and return to IPL

Parameters

:in:    dest      Destination address (uint16)    constant
:in:    source    Source address (uint24)         constant
:in:    length    Length (uint16)                 constant

Example

;Transfer data to SMP
SMP_ready
SMP_memcpy        $2000, Sample1, sizeof_Sample1

SMP_jmp

Transfer SPC700 control to address via IPL jump

Parameters

:in:    addr      Jump address (uint16)           constant

SMP_playspc

Transfer & start SPC music file using custom (fast!) transfer

If ROM_MAPMODE == 0 (“LoROM”) both ram and ram_hi parameters are required.

Parameters

:in:    state     Address to DSP/CPU state (uint24)            constant
:in:    ram       Address to full 64kB SPC RAM dump (uint24)   constant
                  Address to lower 32kB SPC RAM dump (uint24)  constant
:in?:   ram_hi    Address to upper 32kB SPC RAM dump (uint24)  constant

Example

;Transfer and execute SPC file
SMP_playspc       SPC_State, SPC_Image_Lo, SPC_Image_Hi

;Import music
.define spc_file  "Data/Music.spc"
.segment "RODATA"
SPC_State:        SPC_incbin_state spc_file
.segment "ROM2"
SPC_Image_Lo:     SPC_incbin_lo spc_file
.segment "ROM3"
SPC_Image_Hi:     SPC_incbin_hi spc_file

Helper macros

Helper macros for importing SPC dumps

SPC_incbin

Import 64KB SPC RAM image

Parameters

:in:    filename  SPC File                path

SPC_incbin_lo

Import lower 32KB of SPC RAM image

Parameters

:in:    filename  SPC File                path

SPC_incbin_hi

Import upper 32KB of SPC RAM image

Parameters

:in:    filename  SPC File                path

SPC_incbin_state

Import SPC DSP/CPU state (#$87 bytes)

Parameters

:in:    filename  SPC File                path