mirror of
https://github.com/libretro/parallel-dc.git
synced 2026-11-07 12:37:53 -10:00
Fix Windows EOL
This commit is contained in:
1 parent
ec817799de
commit
f8a2f2df2f
5 files changed
+1533
-1533
No files matched your search
+22
-22
@@ -1,23 +1,23 @@
|
||||
#pragma once
|
||||
#include "types.h"
|
||||
#include "hw/arm7/arm7.h"
|
||||
|
||||
extern u32 VREG;
|
||||
extern VArray2 aica_ram;
|
||||
#pragma once
|
||||
#include "types.h"
|
||||
#include "hw/arm7/arm7.h"
|
||||
|
||||
extern u32 VREG;
|
||||
extern VArray2 aica_ram;
|
||||
u32 GetRTC_now();
|
||||
u32 ReadMem_aica_rtc(u32 addr,u32 sz);
|
||||
void WriteMem_aica_rtc(u32 addr,u32 data,u32 sz);
|
||||
u32 ReadMem_aica_reg(u32 addr,u32 sz);
|
||||
void WriteMem_aica_reg(u32 addr,u32 data,u32 sz);
|
||||
|
||||
void aica_Init();
|
||||
void aica_Reset(bool Manual);
|
||||
void aica_Term();
|
||||
|
||||
void aica_sb_Init();
|
||||
void aica_sb_Reset(bool Manual);
|
||||
void aica_sb_Term();
|
||||
|
||||
s32 libAICA_Init();
|
||||
void libAICA_Reset(bool hard);
|
||||
void libAICA_Term();
|
||||
u32 ReadMem_aica_rtc(u32 addr,u32 sz);
|
||||
void WriteMem_aica_rtc(u32 addr,u32 data,u32 sz);
|
||||
u32 ReadMem_aica_reg(u32 addr,u32 sz);
|
||||
void WriteMem_aica_reg(u32 addr,u32 data,u32 sz);
|
||||
|
||||
void aica_Init();
|
||||
void aica_Reset(bool Manual);
|
||||
void aica_Term();
|
||||
|
||||
void aica_sb_Init();
|
||||
void aica_sb_Reset(bool Manual);
|
||||
void aica_sb_Term();
|
||||
|
||||
s32 libAICA_Init();
|
||||
void libAICA_Reset(bool hard);
|
||||
void libAICA_Term();
|
||||
+124
-124
@@ -1,129 +1,129 @@
|
||||
#include "aica.h"
|
||||
#include "aica.h"
|
||||
#include "aica_if.h"
|
||||
#include "dsp.h"
|
||||
#include "sgc_if.h"
|
||||
|
||||
u8 aica_reg[0x8000];
|
||||
|
||||
//00000000~007FFFFF @DRAM_AREA*
|
||||
//00800000~008027FF @CHANNEL_DATA
|
||||
//00802800~00802FFF @COMMON_DATA
|
||||
//00803000~00807FFF @DSP_DATA
|
||||
template<u32 sz>
|
||||
u32 ReadReg(u32 addr)
|
||||
{
|
||||
if (addr<0x2800)
|
||||
{
|
||||
ReadMemArrRet(aica_reg,addr,sz);
|
||||
}
|
||||
if (addr < 0x2818)
|
||||
{
|
||||
if (sz==1)
|
||||
{
|
||||
ReadCommonReg(addr,true);
|
||||
ReadMemArrRet(aica_reg,addr,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadCommonReg(addr,false);
|
||||
//ReadCommonReg8(addr+1);
|
||||
ReadMemArrRet(aica_reg,addr,2);
|
||||
}
|
||||
}
|
||||
|
||||
ReadMemArrRet(aica_reg,addr,sz);
|
||||
}
|
||||
template<u32 sz>
|
||||
void WriteReg(u32 addr,u32 data)
|
||||
{
|
||||
if (addr < 0x2000)
|
||||
{
|
||||
//Channel data
|
||||
u32 chan = addr >> 7;
|
||||
u32 reg = addr & 0x7F;
|
||||
#include "dsp.h"
|
||||
#include "sgc_if.h"
|
||||
|
||||
u8 aica_reg[0x8000];
|
||||
|
||||
//00000000~007FFFFF @DRAM_AREA*
|
||||
//00800000~008027FF @CHANNEL_DATA
|
||||
//00802800~00802FFF @COMMON_DATA
|
||||
//00803000~00807FFF @DSP_DATA
|
||||
template<u32 sz>
|
||||
u32 ReadReg(u32 addr)
|
||||
{
|
||||
if (addr<0x2800)
|
||||
{
|
||||
ReadMemArrRet(aica_reg,addr,sz);
|
||||
}
|
||||
if (addr < 0x2818)
|
||||
{
|
||||
if (sz==1)
|
||||
{
|
||||
ReadCommonReg(addr,true);
|
||||
ReadMemArrRet(aica_reg,addr,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReadCommonReg(addr,false);
|
||||
//ReadCommonReg8(addr+1);
|
||||
ReadMemArrRet(aica_reg,addr,2);
|
||||
}
|
||||
}
|
||||
|
||||
ReadMemArrRet(aica_reg,addr,sz);
|
||||
}
|
||||
template<u32 sz>
|
||||
void WriteReg(u32 addr,u32 data)
|
||||
{
|
||||
if (addr < 0x2000)
|
||||
{
|
||||
//Channel data
|
||||
u32 chan = addr >> 7;
|
||||
u32 reg = addr & 0x7F;
|
||||
WriteMemArr(aica_reg, addr, data, sz);
|
||||
WriteChannelReg(chan, reg, sz);
|
||||
return;
|
||||
}
|
||||
|
||||
if (addr<0x2800)
|
||||
{
|
||||
if (sz==1)
|
||||
{
|
||||
WriteMemArr(aica_reg,addr,data,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteMemArr(aica_reg,addr,data,2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (addr < 0x2818)
|
||||
{
|
||||
if (sz==1)
|
||||
{
|
||||
WriteCommonReg8(addr,data);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteCommonReg8(addr,data&0xFF);
|
||||
WriteCommonReg8(addr+1,data>>8);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (addr>=0x3000)
|
||||
{
|
||||
if (sz==1)
|
||||
{
|
||||
WriteMemArr(aica_reg,addr,data,1);
|
||||
dsp_writenmem(addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteMemArr(aica_reg,addr,data,2);
|
||||
dsp_writenmem(addr);
|
||||
dsp_writenmem(addr+1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (sz==1)
|
||||
WriteAicaReg<1>(addr,data);
|
||||
else
|
||||
WriteAicaReg<2>(addr,data);
|
||||
}
|
||||
}
|
||||
|
||||
if (addr<0x2800)
|
||||
{
|
||||
if (sz==1)
|
||||
{
|
||||
WriteMemArr(aica_reg,addr,data,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteMemArr(aica_reg,addr,data,2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (addr < 0x2818)
|
||||
{
|
||||
if (sz==1)
|
||||
{
|
||||
WriteCommonReg8(addr,data);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteCommonReg8(addr,data&0xFF);
|
||||
WriteCommonReg8(addr+1,data>>8);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (addr>=0x3000)
|
||||
{
|
||||
if (sz==1)
|
||||
{
|
||||
WriteMemArr(aica_reg,addr,data,1);
|
||||
dsp_writenmem(addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteMemArr(aica_reg,addr,data,2);
|
||||
dsp_writenmem(addr);
|
||||
dsp_writenmem(addr+1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (sz==1)
|
||||
WriteAicaReg<1>(addr,data);
|
||||
else
|
||||
WriteAicaReg<2>(addr,data);
|
||||
}
|
||||
//Aica reads (both sh4&arm)
|
||||
u32 libAICA_ReadReg(u32 addr,u32 size)
|
||||
{
|
||||
if (size==1)
|
||||
return ReadReg<1>(addr & 0x7FFF);
|
||||
else
|
||||
return ReadReg<2>(addr & 0x7FFF);
|
||||
|
||||
//must never come here
|
||||
return 0;
|
||||
}
|
||||
|
||||
void libAICA_WriteReg(u32 addr,u32 data,u32 size)
|
||||
{
|
||||
if (size==1)
|
||||
WriteReg<1>(addr & 0x7FFF,data);
|
||||
else
|
||||
WriteReg<2>(addr & 0x7FFF,data);
|
||||
}
|
||||
|
||||
//Map using _vmem .. yay
|
||||
void init_mem()
|
||||
{
|
||||
memset(aica_reg,0,sizeof(aica_reg));
|
||||
aica_ram.data[ARAM_SIZE-1]=1;
|
||||
aica_ram.Zero();
|
||||
}
|
||||
|
||||
//kill mem map & free used mem ;)
|
||||
void term_mem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
u32 libAICA_ReadReg(u32 addr,u32 size)
|
||||
{
|
||||
if (size==1)
|
||||
return ReadReg<1>(addr & 0x7FFF);
|
||||
else
|
||||
return ReadReg<2>(addr & 0x7FFF);
|
||||
|
||||
//must never come here
|
||||
return 0;
|
||||
}
|
||||
|
||||
void libAICA_WriteReg(u32 addr,u32 data,u32 size)
|
||||
{
|
||||
if (size==1)
|
||||
WriteReg<1>(addr & 0x7FFF,data);
|
||||
else
|
||||
WriteReg<2>(addr & 0x7FFF,data);
|
||||
}
|
||||
|
||||
//Map using _vmem .. yay
|
||||
void init_mem()
|
||||
{
|
||||
memset(aica_reg,0,sizeof(aica_reg));
|
||||
aica_ram.data[ARAM_SIZE-1]=1;
|
||||
aica_ram.Zero();
|
||||
}
|
||||
|
||||
//kill mem map & free used mem ;)
|
||||
void term_mem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
+296
-296
@@ -1,306 +1,306 @@
|
||||
//
|
||||
// Audio Overload SDK
|
||||
//
|
||||
// Copyright (c) 2007-2009 R. Belmont and Richard Bannister, and others.
|
||||
// All rights reserved.
|
||||
//
|
||||
#include "dsp.h"
|
||||
//
|
||||
// Audio Overload SDK
|
||||
//
|
||||
// Copyright (c) 2007-2009 R. Belmont and Richard Bannister, and others.
|
||||
// All rights reserved.
|
||||
//
|
||||
#include "dsp.h"
|
||||
#include "aica.h"
|
||||
#include "aica_if.h"
|
||||
#include "aica_mem.h"
|
||||
|
||||
#if FEAT_DSPREC != DYNAREC_JIT
|
||||
|
||||
#ifdef RELEASE
|
||||
#undef verify
|
||||
#define verify(...)
|
||||
#endif
|
||||
|
||||
void AICADSP_Init(struct dsp_t *DSP)
|
||||
{
|
||||
memset(DSP, 0, sizeof(*DSP));
|
||||
DSP->RBL = 0x8000 - 1;
|
||||
DSP->Stopped = 1;
|
||||
dsp.regs.MDEC_CT = 1;
|
||||
}
|
||||
|
||||
void AICADSP_Step(struct dsp_t *DSP)
|
||||
{
|
||||
s32 ACC = 0; //26 bit
|
||||
s32 SHIFTED = 0; //24 bit
|
||||
s32 X = 0; //24 bit
|
||||
s32 Y = 0; //13 bit
|
||||
s32 B = 0; //26 bit
|
||||
s32 INPUTS = 0; //24 bit
|
||||
s32 MEMVAL[4] = {0};
|
||||
s32 FRC_REG = 0; //13 bit
|
||||
s32 Y_REG = 0; //24 bit
|
||||
u32 ADRS_REG = 0; //13 bit
|
||||
|
||||
memset(DSPData->EFREG, 0, sizeof(DSPData->EFREG));
|
||||
|
||||
if (DSP->Stopped)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
int dump = 0;
|
||||
FILE *f = NULL;
|
||||
if (dump)
|
||||
f = fopen("dsp.txt", "wt");
|
||||
#endif
|
||||
|
||||
for (int step = 0; step < 128; ++step)
|
||||
{
|
||||
u32 *IPtr = DSPData->MPRO + step * 4;
|
||||
|
||||
if (IPtr[0] == 0 && IPtr[1] == 0 && IPtr[2] == 0 && IPtr[3] == 0)
|
||||
{
|
||||
// Empty instruction shortcut
|
||||
X = DSP->TEMP[DSP->regs.MDEC_CT & 0x7F];
|
||||
Y = FRC_REG;
|
||||
|
||||
ACC = (((s64)X * (s64)Y) >> 12) + X;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
u32 TRA = (IPtr[0] >> 9) & 0x7F;
|
||||
bool TWT = IPtr[0] & 0x100;
|
||||
|
||||
bool XSEL = IPtr[1] & 0x8000;
|
||||
u32 YSEL = (IPtr[1] >> 13) & 3;
|
||||
u32 IRA = (IPtr[1] >> 7) & 0x3F;
|
||||
bool IWT = IPtr[1] & 0x40;
|
||||
|
||||
bool EWT = IPtr[2] & 0x1000;
|
||||
bool ADRL = IPtr[2] & 0x80;
|
||||
bool FRCL = IPtr[2] & 0x40;
|
||||
u32 SHIFT = (IPtr[2] >> 4) & 3;
|
||||
bool YRL = IPtr[2] & 8;
|
||||
bool NEGB = IPtr[2] & 4;
|
||||
bool ZERO = IPtr[2] & 2;
|
||||
bool BSEL = IPtr[2] & 1;
|
||||
|
||||
u32 COEF = step;
|
||||
|
||||
// operations are done at 24 bit precision
|
||||
#if 0
|
||||
#define DUMP(v) printf(" " #v ": %04X",v);
|
||||
|
||||
printf("%d: ",step);
|
||||
DUMP(ACC);
|
||||
DUMP(SHIFTED);
|
||||
DUMP(X);
|
||||
DUMP(Y);
|
||||
DUMP(B);
|
||||
DUMP(INPUTS);
|
||||
DUMP(MEMVAL);
|
||||
DUMP(FRC_REG);
|
||||
DUMP(Y_REG);
|
||||
DUMP(ADDR);
|
||||
DUMP(ADRS_REG);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
// INPUTS RW
|
||||
if (IRA <= 0x1f)
|
||||
INPUTS = DSP->MEMS[IRA];
|
||||
else if (IRA <= 0x2F)
|
||||
INPUTS = DSP->MIXS[IRA - 0x20] << 4; // MIXS is 20 bit
|
||||
else if (IRA <= 0x31)
|
||||
INPUTS = DSPData->EXTS[IRA - 0x30] << 8; // EXTS is 16 bits
|
||||
else
|
||||
INPUTS = 0;
|
||||
|
||||
if (IWT)
|
||||
{
|
||||
u32 IWA = (IPtr[1] >> 1) & 0x1F;
|
||||
DSP->MEMS[IWA] = MEMVAL[step & 3]; // MEMVAL was selected in previous MRD
|
||||
}
|
||||
|
||||
// Operand sel
|
||||
// B
|
||||
if (!ZERO)
|
||||
{
|
||||
if (BSEL)
|
||||
B = ACC;
|
||||
else
|
||||
B = DSP->TEMP[(TRA + DSP->regs.MDEC_CT) & 0x7F];
|
||||
if (NEGB)
|
||||
B = -B;
|
||||
}
|
||||
else
|
||||
#include "aica_if.h"
|
||||
#include "aica_mem.h"
|
||||
|
||||
#if FEAT_DSPREC != DYNAREC_JIT
|
||||
|
||||
#ifdef RELEASE
|
||||
#undef verify
|
||||
#define verify(...)
|
||||
#endif
|
||||
|
||||
void AICADSP_Init(struct dsp_t *DSP)
|
||||
{
|
||||
memset(DSP, 0, sizeof(*DSP));
|
||||
DSP->RBL = 0x8000 - 1;
|
||||
DSP->Stopped = 1;
|
||||
dsp.regs.MDEC_CT = 1;
|
||||
}
|
||||
|
||||
void AICADSP_Step(struct dsp_t *DSP)
|
||||
{
|
||||
s32 ACC = 0; //26 bit
|
||||
s32 SHIFTED = 0; //24 bit
|
||||
s32 X = 0; //24 bit
|
||||
s32 Y = 0; //13 bit
|
||||
s32 B = 0; //26 bit
|
||||
s32 INPUTS = 0; //24 bit
|
||||
s32 MEMVAL[4] = {0};
|
||||
s32 FRC_REG = 0; //13 bit
|
||||
s32 Y_REG = 0; //24 bit
|
||||
u32 ADRS_REG = 0; //13 bit
|
||||
|
||||
memset(DSPData->EFREG, 0, sizeof(DSPData->EFREG));
|
||||
|
||||
if (DSP->Stopped)
|
||||
return;
|
||||
|
||||
#if 0
|
||||
int dump = 0;
|
||||
FILE *f = NULL;
|
||||
if (dump)
|
||||
f = fopen("dsp.txt", "wt");
|
||||
#endif
|
||||
|
||||
for (int step = 0; step < 128; ++step)
|
||||
{
|
||||
u32 *IPtr = DSPData->MPRO + step * 4;
|
||||
|
||||
if (IPtr[0] == 0 && IPtr[1] == 0 && IPtr[2] == 0 && IPtr[3] == 0)
|
||||
{
|
||||
B = 0;
|
||||
// Empty instruction shortcut
|
||||
X = DSP->TEMP[DSP->regs.MDEC_CT & 0x7F];
|
||||
Y = FRC_REG;
|
||||
|
||||
ACC = (((s64)X * (s64)Y) >> 12) + X;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// X
|
||||
if (XSEL)
|
||||
X = INPUTS;
|
||||
else
|
||||
X = DSP->TEMP[(TRA + DSP->regs.MDEC_CT) & 0x7F];
|
||||
|
||||
// Y
|
||||
if (YSEL == 0)
|
||||
Y = FRC_REG;
|
||||
else if (YSEL == 1)
|
||||
|
||||
u32 TRA = (IPtr[0] >> 9) & 0x7F;
|
||||
bool TWT = IPtr[0] & 0x100;
|
||||
|
||||
bool XSEL = IPtr[1] & 0x8000;
|
||||
u32 YSEL = (IPtr[1] >> 13) & 3;
|
||||
u32 IRA = (IPtr[1] >> 7) & 0x3F;
|
||||
bool IWT = IPtr[1] & 0x40;
|
||||
|
||||
bool EWT = IPtr[2] & 0x1000;
|
||||
bool ADRL = IPtr[2] & 0x80;
|
||||
bool FRCL = IPtr[2] & 0x40;
|
||||
u32 SHIFT = (IPtr[2] >> 4) & 3;
|
||||
bool YRL = IPtr[2] & 8;
|
||||
bool NEGB = IPtr[2] & 4;
|
||||
bool ZERO = IPtr[2] & 2;
|
||||
bool BSEL = IPtr[2] & 1;
|
||||
|
||||
u32 COEF = step;
|
||||
|
||||
// operations are done at 24 bit precision
|
||||
#if 0
|
||||
#define DUMP(v) printf(" " #v ": %04X",v);
|
||||
|
||||
printf("%d: ",step);
|
||||
DUMP(ACC);
|
||||
DUMP(SHIFTED);
|
||||
DUMP(X);
|
||||
DUMP(Y);
|
||||
DUMP(B);
|
||||
DUMP(INPUTS);
|
||||
DUMP(MEMVAL);
|
||||
DUMP(FRC_REG);
|
||||
DUMP(Y_REG);
|
||||
DUMP(ADDR);
|
||||
DUMP(ADRS_REG);
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
// INPUTS RW
|
||||
if (IRA <= 0x1f)
|
||||
INPUTS = DSP->MEMS[IRA];
|
||||
else if (IRA <= 0x2F)
|
||||
INPUTS = DSP->MIXS[IRA - 0x20] << 4; // MIXS is 20 bit
|
||||
else if (IRA <= 0x31)
|
||||
INPUTS = DSPData->EXTS[IRA - 0x30] << 8; // EXTS is 16 bits
|
||||
else
|
||||
INPUTS = 0;
|
||||
|
||||
if (IWT)
|
||||
{
|
||||
u32 IWA = (IPtr[1] >> 1) & 0x1F;
|
||||
DSP->MEMS[IWA] = MEMVAL[step & 3]; // MEMVAL was selected in previous MRD
|
||||
}
|
||||
|
||||
// Operand sel
|
||||
// B
|
||||
if (!ZERO)
|
||||
{
|
||||
if (BSEL)
|
||||
B = ACC;
|
||||
else
|
||||
B = DSP->TEMP[(TRA + DSP->regs.MDEC_CT) & 0x7F];
|
||||
if (NEGB)
|
||||
B = -B;
|
||||
}
|
||||
else
|
||||
{
|
||||
B = 0;
|
||||
}
|
||||
|
||||
// X
|
||||
if (XSEL)
|
||||
X = INPUTS;
|
||||
else
|
||||
X = DSP->TEMP[(TRA + DSP->regs.MDEC_CT) & 0x7F];
|
||||
|
||||
// Y
|
||||
if (YSEL == 0)
|
||||
Y = FRC_REG;
|
||||
else if (YSEL == 1)
|
||||
Y = ((s32)(s16)DSPData->COEF[COEF]) >> 3; //COEF is 16 bits
|
||||
else if (YSEL == 2)
|
||||
else if (YSEL == 2)
|
||||
Y = Y_REG >> 11;
|
||||
else if (YSEL == 3)
|
||||
Y = (Y_REG >> 4) & 0x0FFF;
|
||||
|
||||
if (YRL)
|
||||
Y_REG = INPUTS;
|
||||
|
||||
// Shifter
|
||||
// There's a 1-step delay at the output of the X*Y + B adder. So we use the ACC value from the previous step.
|
||||
if (SHIFT == 0 || SHIFT == 3)
|
||||
SHIFTED = ACC;
|
||||
else
|
||||
SHIFTED = ACC << 1; // x2 scale
|
||||
|
||||
if (SHIFT < 2)
|
||||
SHIFTED = std::min(std::max(SHIFTED, -0x00800000), 0x007FFFFF);
|
||||
|
||||
// ACCUM
|
||||
else if (YSEL == 3)
|
||||
Y = (Y_REG >> 4) & 0x0FFF;
|
||||
|
||||
if (YRL)
|
||||
Y_REG = INPUTS;
|
||||
|
||||
// Shifter
|
||||
// There's a 1-step delay at the output of the X*Y + B adder. So we use the ACC value from the previous step.
|
||||
if (SHIFT == 0 || SHIFT == 3)
|
||||
SHIFTED = ACC;
|
||||
else
|
||||
SHIFTED = ACC << 1; // x2 scale
|
||||
|
||||
if (SHIFT < 2)
|
||||
SHIFTED = std::min(std::max(SHIFTED, -0x00800000), 0x007FFFFF);
|
||||
|
||||
// ACCUM
|
||||
ACC = (((s64)X * (s64)Y) >> 12) + B;
|
||||
|
||||
if (TWT)
|
||||
{
|
||||
u32 TWA = (IPtr[0] >> 1) & 0x7F;
|
||||
DSP->TEMP[(TWA + DSP->regs.MDEC_CT) & 0x7F] = SHIFTED;
|
||||
}
|
||||
|
||||
if (FRCL)
|
||||
{
|
||||
if (SHIFT == 3)
|
||||
FRC_REG = SHIFTED & 0x0FFF;
|
||||
else
|
||||
|
||||
if (TWT)
|
||||
{
|
||||
u32 TWA = (IPtr[0] >> 1) & 0x7F;
|
||||
DSP->TEMP[(TWA + DSP->regs.MDEC_CT) & 0x7F] = SHIFTED;
|
||||
}
|
||||
|
||||
if (FRCL)
|
||||
{
|
||||
if (SHIFT == 3)
|
||||
FRC_REG = SHIFTED & 0x0FFF;
|
||||
else
|
||||
FRC_REG = SHIFTED >> 11;
|
||||
}
|
||||
|
||||
if (step & 1)
|
||||
{
|
||||
bool MWT = IPtr[2] & 0x4000;
|
||||
bool MRD = IPtr[2] & 0x2000;
|
||||
|
||||
if (MRD || MWT)
|
||||
{
|
||||
bool TABLE = IPtr[2] & 0x8000;
|
||||
|
||||
//bool NOFL = IPtr[3] & 0x8000;
|
||||
//verify(!NOFL);
|
||||
u32 MASA = (IPtr[3] >> 9) & 0x3f;
|
||||
bool ADREB = IPtr[3] & 0x100;
|
||||
bool NXADR = IPtr[3] & 0x80;
|
||||
|
||||
u32 ADDR = DSPData->MADRS[MASA];
|
||||
if (ADREB)
|
||||
ADDR += ADRS_REG & 0x0FFF;
|
||||
if (NXADR)
|
||||
ADDR++;
|
||||
if (!TABLE)
|
||||
{
|
||||
ADDR += DSP->regs.MDEC_CT;
|
||||
ADDR &= DSP->RBL; // RBL is ring buffer length - 1
|
||||
}
|
||||
else
|
||||
ADDR &= 0xFFFF;
|
||||
|
||||
ADDR <<= 1; // Word -> byte address
|
||||
ADDR += DSP->RBP; // RBP is already a byte address
|
||||
if (MRD) // memory only allowed on odd. DoA inserts NOPs on even
|
||||
{
|
||||
//if (NOFL)
|
||||
// MEMVAL[(step + 2) & 3] = (*(s16 *)&aica_ram[ADDR]) << 8;
|
||||
//else
|
||||
MEMVAL[(step + 2) & 3] = UNPACK(*(u16 *)&aica_ram[ADDR & ARAM_MASK]);
|
||||
}
|
||||
if (MWT)
|
||||
{
|
||||
// FIXME We should wait for the next step to copy stuff to SRAM (same as read)
|
||||
//if (NOFL)
|
||||
// *(s16 *)&aica_ram[ADDR] = SHIFTED >> 8;
|
||||
//else
|
||||
*(u16 *)&aica_ram[ADDR & ARAM_MASK] = PACK(SHIFTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ADRL)
|
||||
{
|
||||
if (SHIFT == 3)
|
||||
}
|
||||
|
||||
if (step & 1)
|
||||
{
|
||||
bool MWT = IPtr[2] & 0x4000;
|
||||
bool MRD = IPtr[2] & 0x2000;
|
||||
|
||||
if (MRD || MWT)
|
||||
{
|
||||
bool TABLE = IPtr[2] & 0x8000;
|
||||
|
||||
//bool NOFL = IPtr[3] & 0x8000;
|
||||
//verify(!NOFL);
|
||||
u32 MASA = (IPtr[3] >> 9) & 0x3f;
|
||||
bool ADREB = IPtr[3] & 0x100;
|
||||
bool NXADR = IPtr[3] & 0x80;
|
||||
|
||||
u32 ADDR = DSPData->MADRS[MASA];
|
||||
if (ADREB)
|
||||
ADDR += ADRS_REG & 0x0FFF;
|
||||
if (NXADR)
|
||||
ADDR++;
|
||||
if (!TABLE)
|
||||
{
|
||||
ADDR += DSP->regs.MDEC_CT;
|
||||
ADDR &= DSP->RBL; // RBL is ring buffer length - 1
|
||||
}
|
||||
else
|
||||
ADDR &= 0xFFFF;
|
||||
|
||||
ADDR <<= 1; // Word -> byte address
|
||||
ADDR += DSP->RBP; // RBP is already a byte address
|
||||
if (MRD) // memory only allowed on odd. DoA inserts NOPs on even
|
||||
{
|
||||
//if (NOFL)
|
||||
// MEMVAL[(step + 2) & 3] = (*(s16 *)&aica_ram[ADDR]) << 8;
|
||||
//else
|
||||
MEMVAL[(step + 2) & 3] = UNPACK(*(u16 *)&aica_ram[ADDR & ARAM_MASK]);
|
||||
}
|
||||
if (MWT)
|
||||
{
|
||||
// FIXME We should wait for the next step to copy stuff to SRAM (same as read)
|
||||
//if (NOFL)
|
||||
// *(s16 *)&aica_ram[ADDR] = SHIFTED >> 8;
|
||||
//else
|
||||
*(u16 *)&aica_ram[ADDR & ARAM_MASK] = PACK(SHIFTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ADRL)
|
||||
{
|
||||
if (SHIFT == 3)
|
||||
ADRS_REG = SHIFTED >> 12;
|
||||
else
|
||||
else
|
||||
ADRS_REG = INPUTS >> 16;
|
||||
}
|
||||
|
||||
if (EWT)
|
||||
{
|
||||
u32 EWA = (IPtr[2] >> 8) & 0x0F;
|
||||
}
|
||||
|
||||
if (EWT)
|
||||
{
|
||||
u32 EWA = (IPtr[2] >> 8) & 0x0F;
|
||||
DSPData->EFREG[EWA] = SHIFTED >> 8;
|
||||
}
|
||||
|
||||
}
|
||||
--DSP->regs.MDEC_CT;
|
||||
if (dsp.regs.MDEC_CT == 0)
|
||||
dsp.regs.MDEC_CT = dsp.RBL + 1; // RBL is ring buffer length - 1
|
||||
|
||||
// memset(DSP->MIXS, 0, sizeof(DSP->MIXS));
|
||||
// if(f)
|
||||
// fclose(f);
|
||||
}
|
||||
|
||||
void AICADSP_Start(struct dsp_t *DSP)
|
||||
{
|
||||
dsp.Stopped = 1;
|
||||
for (int i = 127; i >= 0; --i)
|
||||
{
|
||||
u32 *IPtr = DSPData->MPRO + i * 4;
|
||||
|
||||
if (IPtr[0] != 0 || IPtr[1] != 0 || IPtr[2 ]!= 0 || IPtr[3] != 0)
|
||||
{
|
||||
DSP->Stopped = 0;
|
||||
//printf("DSP: starting %d steps\n", i + 1);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dsp_init()
|
||||
{
|
||||
AICADSP_Init(&dsp);
|
||||
AICADSP_Start(&dsp);
|
||||
}
|
||||
|
||||
void dsp_term()
|
||||
{
|
||||
dsp.Stopped = 1;
|
||||
}
|
||||
|
||||
void dsp_step()
|
||||
{
|
||||
AICADSP_Step(&dsp);
|
||||
}
|
||||
|
||||
void dsp_writenmem(u32 addr)
|
||||
{
|
||||
if (addr >= 0x3400 && addr < 0x3C00)
|
||||
{
|
||||
AICADSP_Start(&dsp);
|
||||
}
|
||||
else if (addr >= 0x4000 && addr < 0x4400)
|
||||
{
|
||||
// TODO proper sharing of memory with sh4 through DSPData
|
||||
memset(dsp.TEMP, 0, sizeof(dsp.TEMP));
|
||||
}
|
||||
else if (addr >= 0x4400 && addr < 0x4500)
|
||||
{
|
||||
// TODO proper sharing of memory with sh4 through DSPData
|
||||
memset(dsp.MEMS, 0, sizeof(dsp.MEMS));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
--DSP->regs.MDEC_CT;
|
||||
if (dsp.regs.MDEC_CT == 0)
|
||||
dsp.regs.MDEC_CT = dsp.RBL + 1; // RBL is ring buffer length - 1
|
||||
|
||||
// memset(DSP->MIXS, 0, sizeof(DSP->MIXS));
|
||||
// if(f)
|
||||
// fclose(f);
|
||||
}
|
||||
|
||||
void AICADSP_Start(struct dsp_t *DSP)
|
||||
{
|
||||
dsp.Stopped = 1;
|
||||
for (int i = 127; i >= 0; --i)
|
||||
{
|
||||
u32 *IPtr = DSPData->MPRO + i * 4;
|
||||
|
||||
if (IPtr[0] != 0 || IPtr[1] != 0 || IPtr[2 ]!= 0 || IPtr[3] != 0)
|
||||
{
|
||||
DSP->Stopped = 0;
|
||||
//printf("DSP: starting %d steps\n", i + 1);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dsp_init()
|
||||
{
|
||||
AICADSP_Init(&dsp);
|
||||
AICADSP_Start(&dsp);
|
||||
}
|
||||
|
||||
void dsp_term()
|
||||
{
|
||||
dsp.Stopped = 1;
|
||||
}
|
||||
|
||||
void dsp_step()
|
||||
{
|
||||
AICADSP_Step(&dsp);
|
||||
}
|
||||
|
||||
void dsp_writenmem(u32 addr)
|
||||
{
|
||||
if (addr >= 0x3400 && addr < 0x3C00)
|
||||
{
|
||||
AICADSP_Start(&dsp);
|
||||
}
|
||||
else if (addr >= 0x4000 && addr < 0x4400)
|
||||
{
|
||||
// TODO proper sharing of memory with sh4 through DSPData
|
||||
memset(dsp.TEMP, 0, sizeof(dsp.TEMP));
|
||||
}
|
||||
else if (addr >= 0x4400 && addr < 0x4500)
|
||||
{
|
||||
// TODO proper sharing of memory with sh4 through DSPData
|
||||
memset(dsp.MEMS, 0, sizeof(dsp.MEMS));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+1017
-1017
File diff suppressed because it is too large.
Load diff
+74
-74
@@ -1,77 +1,77 @@
|
||||
#pragma once
|
||||
#include "aica.h"
|
||||
|
||||
void AICA_Sample();
|
||||
void AICA_Sample32();
|
||||
|
||||
//u32 ReadChannelReg(u32 channel,u32 reg);
|
||||
#pragma once
|
||||
#include "aica.h"
|
||||
|
||||
void AICA_Sample();
|
||||
void AICA_Sample32();
|
||||
|
||||
//u32 ReadChannelReg(u32 channel,u32 reg);
|
||||
void WriteChannelReg(u32 channel, u32 reg, int size);
|
||||
|
||||
void sgc_Init();
|
||||
void sgc_Term();
|
||||
|
||||
union fp_22_10
|
||||
{
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_FIRST
|
||||
u32 ip:22;
|
||||
u32 fp:10;
|
||||
#else
|
||||
u32 fp:10;
|
||||
u32 ip:22;
|
||||
#endif
|
||||
};
|
||||
u32 full;
|
||||
};
|
||||
union fp_s_22_10
|
||||
{
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_FIRST
|
||||
s32 ip:22;
|
||||
u32 fp:10;
|
||||
#else
|
||||
u32 fp:10;
|
||||
s32 ip:22;
|
||||
#endif
|
||||
};
|
||||
s32 full;
|
||||
};
|
||||
union fp_20_12
|
||||
{
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_FIRST
|
||||
u32 ip:20;
|
||||
u32 fp:12;
|
||||
#else
|
||||
u32 fp:12;
|
||||
u32 ip:20;
|
||||
#endif
|
||||
};
|
||||
u32 full;
|
||||
};
|
||||
|
||||
struct DSP_OUT_VOL_REG
|
||||
{
|
||||
//-- EFSDL[3:0] -- EFPAN[4:0]
|
||||
|
||||
u32 EFPAN:5;
|
||||
u32 res_1:3;
|
||||
|
||||
u32 EFSDL:4;
|
||||
u32 res_2:4;
|
||||
|
||||
u32 pad:16;
|
||||
};
|
||||
|
||||
//#define SAMPLE_TYPE_SHIFT (8)
|
||||
typedef s32 SampleType;
|
||||
|
||||
void ReadCommonReg(u32 reg,bool byte);
|
||||
void WriteCommonReg8(u32 reg,u32 data);
|
||||
|
||||
void sgc_Init();
|
||||
void sgc_Term();
|
||||
|
||||
union fp_22_10
|
||||
{
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_FIRST
|
||||
u32 ip:22;
|
||||
u32 fp:10;
|
||||
#else
|
||||
u32 fp:10;
|
||||
u32 ip:22;
|
||||
#endif
|
||||
};
|
||||
u32 full;
|
||||
};
|
||||
union fp_s_22_10
|
||||
{
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_FIRST
|
||||
s32 ip:22;
|
||||
u32 fp:10;
|
||||
#else
|
||||
u32 fp:10;
|
||||
s32 ip:22;
|
||||
#endif
|
||||
};
|
||||
s32 full;
|
||||
};
|
||||
union fp_20_12
|
||||
{
|
||||
struct
|
||||
{
|
||||
#ifdef MSB_FIRST
|
||||
u32 ip:20;
|
||||
u32 fp:12;
|
||||
#else
|
||||
u32 fp:12;
|
||||
u32 ip:20;
|
||||
#endif
|
||||
};
|
||||
u32 full;
|
||||
};
|
||||
|
||||
struct DSP_OUT_VOL_REG
|
||||
{
|
||||
//-- EFSDL[3:0] -- EFPAN[4:0]
|
||||
|
||||
u32 EFPAN:5;
|
||||
u32 res_1:3;
|
||||
|
||||
u32 EFSDL:4;
|
||||
u32 res_2:4;
|
||||
|
||||
u32 pad:16;
|
||||
};
|
||||
|
||||
//#define SAMPLE_TYPE_SHIFT (8)
|
||||
typedef s32 SampleType;
|
||||
|
||||
void ReadCommonReg(u32 reg,bool byte);
|
||||
void WriteCommonReg8(u32 reg,u32 data);
|
||||
#define clip(x,min,max) do { if ((x)<(min)) (x)=(min); else if ((x)>(max)) (x)=(max); } while (false)
|
||||
#define clip16(x) clip(x,-32768,32767)
|
||||
bool channel_serialize(void **data, unsigned int *total_size);
|
||||
#define clip16(x) clip(x,-32768,32767)
|
||||
bool channel_serialize(void **data, unsigned int *total_size);
|
||||
bool channel_unserialize(void **data, unsigned int *total_size, serialize_version_enum version);
|
||||
Reference in new issue
Block a user