セガサターンのエミュレーターを語ろう 6

このエントリーをはてなブックマークに追加
188名無しさん@お腹いっぱい。
___aamNNNQWQQQQWWWXNNNaa__
_ammXQQQQQQQQQQQQQQQQQQQQQQQWNma__
_gXQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQWWNp
_mQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQWWWNg
_mQQQQXCNNNHPYYYYDNCXXQQQQQQQQQQQQQQQQWWWWWWMr
]QXNRY""[;LLLLLLLLdiiiiiiCXXQQQQQQQQQQWWWWWWWWML
vNP"]mmCXXXQQQQQQQQQQQQQQQXCCXQWWQQWWWWWWWWWWWWWMj
AdCXQQQQQQQQQQQQQQQQQQQQQQWWWWQQQWWWWWWWWWWWWWWWWN
CQQQQQQQQQQQQQQQQQQQQQQQQQQQWWWWWWWWWWWWWWWWWWWWWWWk
_mQQQQQQQQQQQQQQQQQQQQQQQQQQQQQWWWWWWWWWWWWWWWWWWWWWWM,
dWQQQQQQQQQQQQQQQQQQQQQQXQQQQQQQQWWWWWMWWWWWWWWWWWWWWWM}
{QQQQQQQQQQQQWQQQQQQQQQQQXiXQQQQQQWWWWWWMWWWWWWWWWWWWWWWNL
WQQQQQQQQQQQQXQQQQQQQQQQQQ6]XQQQQQQWWWWWMWWWWWWWWWWWWWWWW[
QQQQQWQQQQQQQNPQQQQQQQQQQWK,{XQQQWWWWWWWWWWWWWWWWWWWWWWWWm
QQQQQXQQQQQQQNLDXQQXNNNPP[ZLLZ""""]XQQWWMWWWWWWWWWWWWWWWWNL
QQQQQiCQQQXNNPP.""""umNNPPP[ZZ""゚ ,]QQWMMWX05ACQWWWWWWWWQk
QQQQWX[]GGGmL_ .Y""yYNNHWWQNmL "\QQWMM[gQXiPQWWWWWWWW4_
PPP"""H[naLGQBL_ .']NK゚HW0_\K\ ,NQQWMXXCiiBNWWWWWWWWM[
"4)N[VWNN[ ,' ]QQN'" ]QQWWWQNG::QWWWWWWWWMNL
db='"Nhdik "' JXQQWWi\LJQMWWWWWWWWWML
]L \KQF "AQQWMNuCWMWWWWWWWWWWWK,
4 ." ]XQQQWQQMMMWWWWWWWWWWWM[
Ar , ,dQQQQW0]WMMMWWWWWWWWWWWWk
,bL "OHa_ .uWQQQQW0"iWMMWWWWWWWWWWWWWk
NWk_ ""__ .amm _]9NXQQQWNm:iWMMWWWWWWWWWWWWWb
_QWWNL_ ""'__ ,aF[dQXXXi...:CWMWWWWWWWWWMWWWWm_
]WWWWWNp__ '"^ _,g("_!PPQmPF,J..iCWMWWWMWWWWWMWWWWWm_
dWWWWWWMMWNm, .xgCBV';gadP' ,T.:iCWMWWMWWWWWWMMWWWWWm,
""]NQWWMMMMMMMWmg;gmXWQC\\dP"' ,]..iCWMWWMWWWWWWWMMWWWWWN,
MWMMMMMMMMMMMMMN'"p ,T..iiCWWWMWWWWWWWMMMWWWWWm
vMWMMMMWMMWWWQCiL__ur ,H.iiiiXQQWWWWWWWWMMMWWWWWK.
]WWWQQQXiii:::iiPiiii[, ,(mii:ii:::iiCXQWWWWMMMWWWWWm
_dii:::..........P:}Ti:iBL ,jdiVPFi:........:::iCXWWWWWWWM0
_mHiBF""PH.RPP""' "9L]i:iM ,,j]umiP",iAF"""P\..........::iCXQWW0
,Vfi[^ ,",{HCimmmmm:VP""^ "^ """PH...:iii:::iC0_
{'1i[ ,g ]mmg;]iP""" :g qmK"""YH...ik
{ "i[,gm ,"\:iiiiii:mmm :Ap ,;\' ,T...:
]N ,YimBL :miRY"""""L :.:Lqm :H..:
.WCAm/ii[, cIK", ,T:i:P d..:
189名無しさん@お腹いっぱい。:2007/11/25(日) 20:07:56 ID:iEXPv5G6
mAPF1 = *((ushort *) 0x1F801DC0) * 4;
mAPF2 = *((ushort *) 0x1F801DC2) * 4;
gIIR = *((short *) 0x1F801DC4) / 32768.0;
gCOMB1 = *((short *) 0x1F801DC6) / 32768.0;
gCOMB2 = *((short *) 0x1F801DC8) / 32768.0;
gCOMB3 = *((short *) 0x1F801DCA) / 32768.0;
gCOMB4 = *((short *) 0x1F801DCC) / 32768.0;
gWALL = *((short *) 0x1F801DCE) / 32768.0;
gAPF1 = *((short *) 0x1F801DD0) / 32768.0;
gAPF2 = *((short *) 0x1F801DD2) / 32768.0;
z0_Lsame = *((ushort *) 0x1F801DD4) * 4;
z0_Rsame = *((ushort *) 0x1F801DD6) * 4;
m1_Lcomb = *((ushort *) 0x1F801DD8) * 4;
m1_Rcomb = *((ushort *) 0x1F801DDA) * 4;
m2_Lcomb = *((ushort *) 0x1F801DDC) * 4;
m2_Rcomb = *((ushort *) 0x1F801DDE) * 4;
zm_Lsame = *((ushort *) 0x1F801DE0) * 4;
zm_Rsame = *((ushort *) 0x1F801DE2) * 4;
z0_Ldiff = *((ushort *) 0x1F801DE4) * 4;
z0_Rdiff = *((ushort *) 0x1F801DE6) * 4;
m3_Lcomb = *((ushort *) 0x1F801DE8) * 4;
m3_Rcomb = *((ushort *) 0x1F801DEA) * 4;
m4_Lcomb = *((ushort *) 0x1F801DEC) * 4;
m4_Rcomb = *((ushort *) 0x1F801DEE) * 4;
zm_Ldiff = *((ushort *) 0x1F801DF0) * 4;
zm_Rdiff = *((ushort *) 0x1F801DF2) * 4;
z0_Lapf1 = *((ushort *) 0x1F801DF4) * 4;
z0_Rapf1 = *((ushort *) 0x1F801DF6) * 4;
z0_Lapf2 = *((ushort *) 0x1F801DF8) * 4;
z0_Rapf2 = *((ushort *) 0x1F801DFA) * 4;
gLIN = *((short *) 0x1F801DFC) / 32768.0;
gRIN = *((short *) 0x1F801DFE) / 32768.0;
z1_Lsame = z0_Lsame - 1;
z1_Rsame = z0_Rsame - 1;
z1_Ldiff = z0_Ldiff - 1;
z1_Rdiff = z0_Rdiff - 1;
zm_Lapf1 = z0_Lapf1 - mAPF1;
zm_Rapf1 = z0_Rapf1 - mAPF1;
zm_Lapf2 = z0_Lapf2 - mAPF2;
zm_Rapf2 = z0_Rapf2 - mAPF2;
for (;;) {
/*
* LoadFromLowPassFilterは35もしくは39タップのFIRフィルタ
* 最外周の係数が0でも結果は同じなので、35か39かは特定できず
*/
L_in = gLIN * LoadFromLowPassFilterL();
R_in = gRIN * LoadFromLowPassFilterR();

/* Left -> Wall -> Left Reflection */
L_temp = ReadReverbWork(zm_Lsame);
R_temp = ReadReverbWork(zm_Rsame);
L_same = L_in + gWALL * L_temp;
R_same = R_in + gWALL * R_temp;
190名無しさん@お腹いっぱい。:2007/11/25(日) 20:09:23 ID:iEXPv5G6
L_in = gLIN * LoadFromLowPassFilterL();
R_in = gRIN * LoadFromLowPassFilterR();

/* Left -> Wall -> Left Reflection */
L_temp = ReadReverbWork(zm_Lsame);
R_temp = ReadReverbWork(zm_Rsame);
L_same = L_in + gWALL * L_temp;
R_same = R_in + gWALL * R_temp;
L_temp = ReadReverbWork(z1_Lsame);
R_temp = ReadReverbWork(z1_Rsame);
L_same = L_temp + gIIR * (L_same - L_temp);
R_same = R_temp + gIIR * (R_same - R_temp);

/* Left -> Wall -> Right Reflection */
L_temp = ReadReverbWork(zm_Rdiff);
R_temp = ReadReverbWork(zm_Ldiff);
L_diff = L_in + gWALL * L_temp;
R_diff = R_in + gWALL * R_temp;
L_temp = ReadReverbWork(z1_Ldiff);
R_temp = ReadReverbWork(z1_Rdiff);
L_diff = L_temp + gIIR * (L_diff - L_temp);
R_diff = R_temp + gIIR * (R_diff - R_temp);

/* Early Echo(Comb Filter) */
L_in = gCOMB1 * ReadReverbWork(m1_Lcomb) + gCOMB2 *ReadReverbWork(m2_Lcomb) + gCOMB3 *ReadReverbWork(m3_Lcomb) + gCOMB4 *ReadReverbWork(m4_Lcomb);
R_in = gCOMB1 * ReadReverbWork(m1_Rcomb) + gCOMB2 *ReadReverbWork(m2_Rcomb) + gCOMB3 *ReadReverbWork(m3_Rcomb) + gCOMB4 *ReadReverbWork(m4_Rcomb);

/* Late Reverb(Two All Pass Filters) */
L_temp = ReadReverbWork(zm_Lapf1);
R_temp = ReadReverbWork(zm_Rapf1);
L_apf1 = L_in - gAPF1 * L_temp;
R_apf1 = R_in - gAPF1 * R_temp;
L_in = L_temp + gAPF1 * L_apf1;
R_in = R_temp + gAPF1 * R_apf1;
L_temp = ReadReverbWork(zm_Lapf2);
R_temp = ReadReverbWork(zm_Rapf2);
L_apf2 = L_in - gAPF2 * L_temp;
R_apf2 = R_in - gAPF2 * R_temp;
L_in = L_temp + gAPF2 * L_apf2;
R_in = R_temp + gAPF2 * R_apf2;

/* Output */
SetOutputL(L_in);
SetOutputR(R_in);

/* Write Buffer */
WriteReverbWork(z0_Lsame, L_same);
WriteReverbWork(z0_Rsame, R_same);
WriteReverbWork(z0_Ldiff, L_diff);
WriteReverbWork(z0_Rdiff, R_diff);
WriteReverbWork(z0_Lapf1, L_apf1);
WriteReverbWork(z0_Rapf1, R_apf1);
WriteReverbWork(z0_Lapf2, L_apf2);
WriteReverbWork(z0_Rapf2, R_apf2);

/* Update Circular Buffer */
UpdateReverbWork();
}
191名無しさん@お腹いっぱい。:2007/11/25(日) 20:58:42 ID:iEXPv5G6
L \KQF "AQQWMNuCWMWWWWWWWWWWWK,
4 ." ]XQQQWQQMMMWWWWWWWWWWWM[
Ar , ,dQQQQW0]WMMMWWWWWWWWWWWWk
,bL "OHa_ .uWQQQQW0"iWMMWWWWWWWWWWWWWk
NWk_ ""__ .amm _]9NXQQQWNm:iWMMWWWWWWWWWWWWWb
_QWWNL_ ""'__ ,aF[dQXXXi...:CWMWWWWWWWWWMWWWWm_
]WWWWWNp__ '"^ _,g("_!PPQmPF,J..iCWMWWWMWWWWWMWWWWWm_
dWWWWWWMMWNm, .xgCBV';gadP' ,T.:iCWMWWMWWWWWWMMWWWWWm,
""]NQWWMMMMMMMWmg;gmXWQC\\dP"' ,]..iCWMWWMWWWWWWWMMWWWWWN,
MWMMMMMMMMMMMMMN'"p ,T..iiCWWWMWWWWWWWMMMWWWWWm
vMWMMMMWMMWWWQCiL__ur ,H.iiiiXQQWWWWWWWWMMMWWWWWK.
]WWWQQQXiii:::iiPiiii[, ,(mii:ii:::iiCXQWWWWMMMWWWWWm
_dii:::..........P:}Ti:iBL ,jdiVPFi:........:::iCXWWWWWWWM0
_mHiBF""PH.RPP""' "9L]i:iM ,,j]umiP",iAF"""P\..........::iCXQWW0
,Vfi[^ ,",{HCimmmmm:VP""^ "^ """PH...:iii:::iC0_
{'1i[ ,g ]mmg;]iP""" :g qmK"""YH...ik
{ "i[,gm ,"\:iiiiii:mmm :Ap ,;\' ,T...:
]N ,YimBL :miRY"""""L :.:Lqm :H..:
.WCAm/ii[, cIK", ,T:i:P d..: