link dspproc

This commit is contained in:
Prakxo
2024-06-13 00:23:42 +02:00
parent 5299baa10b
commit 0896b19994
3 changed files with 96 additions and 1 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ symbol_aligns:
0x80026400: 32
0x80031d80: 32
0x8001ada0: 32
0x8002cd20: 32
0x8002cfe0: 32
0x8018f1a8: 8
0x80207458: 8 # align RunQueue to 0x001251d8
0x800b9140: 32 # align gam_win_moji1_tex to 32 bytes
+3
View File
@@ -121,6 +121,9 @@ jaudio_NES/internal/dspboot.c:
.rodata: [0x800aa780, 0x800aa7a0]
.data: [0x800d3b00, 0x800d5500]
.sdata2: [0x80218f08, 0x80218f10]
jaudio_NES/internal/dspproc.c:
.text: [0x8002cd20, 0x8002cfe0]
.sdata: [0x80217c18, 0x80217c20]
jaudio_NES/internal/random.c:
.text: [0x80031ce0, 0x80031d80]
.sdata: [0x80217c38, 0x80217c40]
+92
View File
@@ -0,0 +1,92 @@
#include "jaudio_NES/dspproc.h"
#include "dolphin/dsp.h"
static u16 DSP_MIXERLEVEL = 0x4000;
extern s32 DSPSendCommands(u32* commands, u32 count) {
if (DSPCheckMailToDSP() != 0) {
return -1;
}
if (DSPCheckMailFromDSP() != 0) {
return -1;
}
int i;
for (i = 0; i < count; i++) {
DSPSendMailToDSP(commands[i]);
while (DSPCheckMailToDSP() != 0);
}
return 0;
}
extern u32 DSPReleaseHalt() {
while (DSPCheckMailToDSP() != 0);
DSPSendMailToDSP(0);
if (DSPCheckMailFromDSP() != 0) {
DSPReadMailFromDSP();
}
return 0x88881357;
}
extern void DSPWaitFinish() {
do {
while (DSPCheckMailFromDSP() == 0);
} while ((DSPReadMailFromDSP() + 0x77780000) == 0x1357);
}
extern void DsetupTable(u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4) {
u32 commands[5];
commands[0] = (arg0 & 0xFFFF) | 0x81000000;
commands[1] = arg1;
commands[2] = arg2;
commands[3] = arg3;
commands[4] = arg4;
DSPSendCommands(commands, ARRAY_COUNT(commands));
DSPWaitFinish();
}
extern void DsyncFrame(u32 subframes, u32 dspbuf_start, u32 dspbuf_end){
u32 commands[3];
commands[0] = (subframes << 16 & 0xFF0000) | 0x82000000 | DSP_MIXERLEVEL;
commands[1] = dspbuf_start;
commands[2] = dspbuf_end;
DSPSendCommands(commands, ARRAY_COUNT(commands));
DSPWaitFinish();
}
extern void DwaitFrame(){
u32 commands[1];
commands[0] = 0x80000000;
DSPSendCommands(commands, ARRAY_COUNT(commands));
DSPWaitFinish();
}
extern void DiplSec(u32 arg0){
u32 commands[2];
commands[0] = 0x8B000008;
commands[1] = arg0;
DSPSendCommands(commands, ARRAY_COUNT(commands));
DSPWaitFinish();
}
extern void DagbSec(u32 arg0){
u32 commands[2];
commands[0] = 0x8C000008;
commands[1] = arg0;
DSPSendCommands(commands, ARRAY_COUNT(commands));
DSPWaitFinish();
}