diff options
-rw-r--r-- | src/dsp1emu.c | 182 | ||||
-rw-r--r-- | src/dsp1emu_fixed.c | 234 | ||||
-rw-r--r-- | src/dsp2emu.c | 2 |
3 files changed, 1 insertions, 417 deletions
diff --git a/src/dsp1emu.c b/src/dsp1emu.c index 932c7db..e14ddf0 100644 --- a/src/dsp1emu.c +++ b/src/dsp1emu.c @@ -15,51 +15,12 @@ //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//#define __ZSNES__
-
-#if (defined __ZSNES__ && __LINUX__)
-#include "../gblhdr.h"
-#else
-#endif
-
-
#include <math.h>
-
-
-//#define DebugDSP1
-
-// uncomment some lines to test
-//#define printinfo
-//#define debug02
-//#define debug0A
-//#define debug06
-
#define __OPT__
#define __OPT02__
#define __OPT06__
-#ifdef DebugDSP1
-
-FILE* LogFile = NULL;
-
-void Log_Message(char* Message, ...)
-{
- char Msg[400];
- va_list ap;
-
- va_start(ap, Message);
- vsprintf(Msg, Message, ap);
- va_end(ap);
-
- strcat(Msg, "\r\n\0");
- fwrite(Msg, strlen(Msg), 1, LogFile);
- fflush(LogFile);
-}
-
-
-#endif
-
const unsigned short DSP1ROM[1024] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -246,9 +207,6 @@ void InitDSP(void) SinTable2Fix[i] = (65536 * sinf((float)(2 * PI * i / INCR)));
}
#endif
-#ifdef DebugDSP1
- Start_Log();
-#endif
}
@@ -259,10 +217,6 @@ short Op00Result; void DSPOp00()
{
Op00Result = Op00Multiplicand * Op00Multiplier >> 15;
-
-#ifdef DebugDSP1
- Log_Message("OP00 MULT %d*%d/32768=%d", Op00Multiplicand, Op00Multiplier, Op00Result);
-#endif
}
short Op20Multiplicand;
@@ -273,10 +227,6 @@ void DSPOp20() {
Op20Result = Op20Multiplicand * Op20Multiplier >> 15;
Op20Result++;
-
-#ifdef DebugDSP1
- Log_Message("OP20 MULT %d*%d/32768=%d", Op20Multiplicand, Op20Multiplier, Op20Result);
-#endif
}
signed short Op10Coefficient;
@@ -338,9 +288,6 @@ void DSP1_Inverse(short Coefficient, short Exponent, short* iCoefficient, short* void DSPOp10()
{
DSP1_Inverse(Op10Coefficient, Op10Exponent, &Op10CoefficientR, &Op10ExponentR);
-#ifdef DebugDSP1
- Log_Message("OP10 INV %d*2^%d = %d*2^%d", Op10Coefficient, Op10Exponent, Op10CoefficientR, Op10ExponentR);
-#endif
}
short Op04Angle;
@@ -611,11 +558,6 @@ void DSPOp02() ViewerY1 = Sin(Angle(Op02AZS)) * Cos(Angle(Op02AAS));
-#ifdef debug02
- printf("\nViewerX1 : %f ViewerY1 : %f ViewerZ1 : %f\n", ViewerX1, ViewerY1,
- ViewerZ1);
- getch();
-#endif
ViewerX = Op02FX - ViewerX1 * Op02LFE;
ViewerY = Op02FY - ViewerY1 * Op02LFE;
ViewerZ = Op02FZ - ViewerZ1 * Op02LFE;
@@ -624,12 +566,6 @@ void DSPOp02() ScreenY = Op02FY + ViewerY1 * (Op02LES - Op02LFE);
ScreenZ = Op02FZ + ViewerZ1 * (Op02LES - Op02LFE);
-#ifdef debug02
- printf("ViewerX : %f ViewerY : %f ViewerZ : %f\n", ViewerX, ViewerY, ViewerZ);
- printf("Op02FX : %d Op02FY : %d Op02FZ : %d\n", Op02FX, Op02FY, Op02FZ);
- printf("ScreenX : %f ScreenY : %f ScreenZ : %f\n", ScreenX, ScreenY, ScreenZ);
- getch();
-#endif
if (ViewerZ1 == 0)ViewerZ1++;
NumberOfSlope = ViewerZ / -ViewerZ1;
@@ -699,13 +635,6 @@ void DSPOp02() // if(Op02LFE==0x2200)Op02VVA=0xFECD;
// else Op02VVA=0xFFB2;
-
-#ifdef DebugDSP1
- Log_Message("OP02 FX:%d FY:%d FZ:%d LFE:%d LES:%d", Op02FX, Op02FY, Op02FZ, Op02LFE, Op02LES);
- Log_Message(" AAS:%d AZS:%d VOF:%d VVA:%d", Op02AAS, Op02AZS, Op02VOF, Op02VVA);
- Log_Message(" VX:%d VY:%d VZ:%d", (short)ViewerX, (short)ViewerY, (short)ViewerZ);
-#endif
-
}
#else
@@ -715,11 +644,6 @@ void DSPOp02() ViewerX1 = sinf(Op02AZS * 6.2832 / 65536.0) * sinf(Op02AAS * 6.2832 / 65536.0);
ViewerY1 = sinf(Op02AZS * 6.2832 / 65536.0) * cosf(-Op02AAS * 6.2832 / 65536.0);
-#ifdef debug02
- printf("\nViewerX1 : %f ViewerY1 : %f ViewerZ1 : %f\n", ViewerX1, ViewerY1,
- ViewerZ1);
- getch();
-#endif
ViewerX = Op02FX - ViewerX1 * Op02LFE;
ViewerY = Op02FY - ViewerY1 * Op02LFE;
ViewerZ = Op02FZ - ViewerZ1 * Op02LFE;
@@ -728,12 +652,6 @@ void DSPOp02() ScreenY = Op02FY + ViewerY1 * (Op02LES - Op02LFE);
ScreenZ = Op02FZ + ViewerZ1 * (Op02LES - Op02LFE);
-#ifdef debug02
- printf("ViewerX : %f ViewerY : %f ViewerZ : %f\n", ViewerX, ViewerY, ViewerZ);
- printf("Op02FX : %d Op02FY : %d Op02FZ : %d\n", Op02FX, Op02FY, Op02FZ);
- printf("ScreenX : %f ScreenY : %f ScreenZ : %f\n", ScreenX, ScreenY, ScreenZ);
- getch();
-#endif
if (ViewerZ1 == 0)ViewerZ1++;
NumberOfSlope = ViewerZ / -ViewerZ1;
@@ -796,13 +714,6 @@ void DSPOp02() // if(Op02LFE==0x2200)Op02VVA=0xFECD;
// else Op02VVA=0xFFB2;
-
-#ifdef DebugDSP1
- Log_Message("OP02 FX:%d FY:%d FZ:%d LFE:%d LES:%d", Op02FX, Op02FY, Op02FZ, Op02LFE, Op02LES);
- Log_Message(" AAS:%d AZS:%d VOF:%d VVA:%d", Op02AAS, Op02AZS, Op02VOF, Op02VVA);
- Log_Message(" VX:%d VY:%d VZ:%d", (short)ViewerX, (short)ViewerY, (short)ViewerZ);
-#endif
-
}
#endif
@@ -978,10 +889,6 @@ void DSPOp06() SADDMULT1616(ObjPY2, ObjPY1, CosFix(tanval2), ObjPZ1, -SinFix(tanval2))
SADDMULT1616(ObjPZ2, ObjPY1, SinFix(tanval2), ObjPZ1, CosFix(tanval2))
-#ifdef debug06
- Log_Message("ObjPX2: %f ObjPY2: %f ObjPZ2: %f\n", ObjPX2, ObjPY2, ObjPZ2);
-#endif
-
ObjPZ2 = ObjPZ2 - Op02LFE;
if (ObjPZ2 < 0)
@@ -1010,12 +917,6 @@ void DSPOp06() Op06V = 14 * 16;
Op06S = 0xFFFF;
}
-
-
-#ifdef DebugDSP1
- Log_Message("OP06 X:%d Y:%d Z:%d", Op06X, Op06Y, Op06Z);
- Log_Message("OP06 H:%d V:%d S:%d", Op06H, Op06V, Op06S);
-#endif
}
#else
@@ -1031,22 +932,12 @@ void DSPOp06() ObjPY1 = (ObjPX * sinf(tanval) + ObjPY * cosf(tanval));
ObjPZ1 = ObjPZ;
-#ifdef debug06
- Log_Message("Angle : %f", tanval);
- Log_Message("ObjPX1: %f ObjPY1: %f ObjPZ1: %f\n", ObjPX1, ObjPY1, ObjPZ1);
- Log_Message("cos(tanval) : %f sin(tanval) : %f", cosf(tanval), sinf(tanval));
-#endif
-
// rotate around X
tanval = (-Op02AZS) / 65536.0 * 6.2832;
ObjPX2 = ObjPX1;
ObjPY2 = (ObjPY1 * cosf(tanval) + ObjPZ1 * -sinf(tanval));
ObjPZ2 = (ObjPY1 * sinf(tanval) + ObjPZ1 * cosf(tanval));
-#ifdef debug06
- Log_Message("ObjPX2: %f ObjPY2: %f ObjPZ2: %f\n", ObjPX2, ObjPY2, ObjPZ2);
-#endif
-
ObjPZ2 = ObjPZ2 - Op02LFE;
if (ObjPZ2 < 0)
@@ -1069,11 +960,6 @@ void DSPOp06() Op06V = 14 * 16;
Op06S = 0xFFFF;
}
-
-#ifdef DebugDSP1
- Log_Message("OP06 X:%d Y:%d Z:%d", Op06X, Op06Y, Op06Z);
- Log_Message("OP06 H:%d V:%d S:%d", Op06H, Op06V, Op06S);
-#endif
}
#endif
@@ -1191,10 +1077,6 @@ void DSPOp0D() Op0DF = (Op0DX * matrixA[0][0] >> 15) + (Op0DY * matrixA[0][1] >> 15) + (Op0DZ * matrixA[0][2] >> 15);
Op0DL = (Op0DX * matrixA[1][0] >> 15) + (Op0DY * matrixA[1][1] >> 15) + (Op0DZ * matrixA[1][2] >> 15);
Op0DU = (Op0DX * matrixA[2][0] >> 15) + (Op0DY * matrixA[2][1] >> 15) + (Op0DZ * matrixA[2][2] >> 15);
-
-#ifdef DebugDSP1
- Log_Message("OP0D X: %d Y: %d Z: %d / F: %d L: %d U: %d", Op0DX, Op0DY, Op0DZ, Op0DF, Op0DL, Op0DU);
-#endif
}
void DSPOp1D()
@@ -1202,10 +1084,6 @@ void DSPOp1D() Op1DF = (Op1DX * matrixB[0][0] >> 15) + (Op1DY * matrixB[0][1] >> 15) + (Op1DZ * matrixB[0][2] >> 15);
Op1DL = (Op1DX * matrixB[1][0] >> 15) + (Op1DY * matrixB[1][1] >> 15) + (Op1DZ * matrixB[1][2] >> 15);
Op1DU = (Op1DX * matrixB[2][0] >> 15) + (Op1DY * matrixB[2][1] >> 15) + (Op1DZ * matrixB[2][2] >> 15);
-
-#ifdef DebugDSP1
- Log_Message("OP1D X: %d Y: %d Z: %d / F: %d L: %d U: %d", Op1DX, Op1DY, Op1DZ, Op1DF, Op1DL, Op1DU);
-#endif
}
void DSPOp2D()
@@ -1213,10 +1091,6 @@ void DSPOp2D() Op2DF = (Op2DX * matrixC[0][0] >> 15) + (Op2DY * matrixC[0][1] >> 15) + (Op2DZ * matrixC[0][2] >> 15);
Op2DL = (Op2DX * matrixC[1][0] >> 15) + (Op2DY * matrixC[1][1] >> 15) + (Op2DZ * matrixC[1][2] >> 15);
Op2DU = (Op2DX * matrixC[2][0] >> 15) + (Op2DY * matrixC[2][1] >> 15) + (Op2DZ * matrixC[2][2] >> 15);
-
-#ifdef DebugDSP1
- Log_Message("OP2D X: %d Y: %d Z: %d / F: %d L: %d U: %d", Op2DX, Op2DY, Op2DZ, Op2DF, Op2DL, Op2DU);
-#endif
}
short Op03F;
@@ -1243,10 +1117,6 @@ void DSPOp03() Op03X = (Op03F * matrixA[0][0] >> 15) + (Op03L * matrixA[1][0] >> 15) + (Op03U * matrixA[2][0] >> 15);
Op03Y = (Op03F * matrixA[0][1] >> 15) + (Op03L * matrixA[1][1] >> 15) + (Op03U * matrixA[2][1] >> 15);
Op03Z = (Op03F * matrixA[0][2] >> 15) + (Op03L * matrixA[1][2] >> 15) + (Op03U * matrixA[2][2] >> 15);
-
-#ifdef DebugDSP1
- Log_Message("OP03 F: %d L: %d U: %d / X: %d Y: %d Z: %d", Op03F, Op03L, Op03U, Op03X, Op03Y, Op03Z);
-#endif
}
void DSPOp13()
@@ -1254,10 +1124,6 @@ void DSPOp13() Op13X = (Op13F * matrixB[0][0] >> 15) + (Op13L * matrixB[1][0] >> 15) + (Op13U * matrixB[2][0] >> 15);
Op13Y = (Op13F * matrixB[0][1] >> 15) + (Op13L * matrixB[1][1] >> 15) + (Op13U * matrixB[2][1] >> 15);
Op13Z = (Op13F * matrixB[0][2] >> 15) + (Op13L * matrixB[1][2] >> 15) + (Op13U * matrixB[2][2] >> 15);
-
-#ifdef DebugDSP1
- Log_Message("OP13 F: %d L: %d U: %d / X: %d Y: %d Z: %d", Op13F, Op13L, Op13U, Op13X, Op13Y, Op13Z);
-#endif
}
void DSPOp23()
@@ -1265,10 +1131,6 @@ void DSPOp23() Op23X = (Op23F * matrixC[0][0] >> 15) + (Op23L * matrixC[1][0] >> 15) + (Op23U * matrixC[2][0] >> 15);
Op23Y = (Op23F * matrixC[0][1] >> 15) + (Op23L * matrixC[1][1] >> 15) + (Op23U * matrixC[2][1] >> 15);
Op23Z = (Op23F * matrixC[0][2] >> 15) + (Op23L * matrixC[1][2] >> 15) + (Op23U * matrixC[2][2] >> 15);
-
-#ifdef DebugDSP1
- Log_Message("OP23 F: %d L: %d U: %d / X: %d Y: %d Z: %d", Op23F, Op23L, Op23U, Op23X, Op23Y, Op23Z);
-#endif
}
short Op14Zr;
@@ -1346,10 +1208,6 @@ void DSPOp0E() GetRXYPos();
Op0EX = (short)(RXRes);
Op0EY = (short)(RYRes);
-
-#ifdef DebugDSP1
- Log_Message("OP0E COORDINATE H:%d V:%d X:%d Y:%d", Op0EH, Op0EV, Op0EX, Op0EY);
-#endif
}
short Op0BX;
@@ -1368,30 +1226,16 @@ short Op2BS; void DSPOp0B()
{
Op0BS = (Op0BX * matrixA[0][0] + Op0BY * matrixA[0][1] + Op0BZ * matrixA[0][2]) >> 15;
-
-#ifdef DebugDSP1
- Log_Message("OP0B");
-#endif
}
void DSPOp1B()
{
Op1BS = (Op1BX * matrixB[0][0] + Op1BY * matrixB[0][1] + Op1BZ * matrixB[0][2]) >> 15;
-
-#ifdef DebugDSP1
- Log_Message("OP1B X: %d Y: %d Z: %d S: %d", Op1BX, Op1BY, Op1BZ, Op1BS);
- Log_Message(" MX: %d MY: %d MZ: %d Scale: %d", (short)(matrixB[0][0] * 100), (short)(matrixB[0][1] * 100),
- (short)(matrixB[0][2] * 100), (short)(sc2 * 100));
-#endif
}
void DSPOp2B()
{
Op2BS = (Op2BX * matrixC[0][0] + Op2BY * matrixC[0][1] + Op2BZ * matrixC[0][2]) >> 15;
-
-#ifdef DebugDSP1
- Log_Message("OP2B");
-#endif
}
short Op08X, Op08Y, Op08Z, Op08Ll, Op08Lh;
@@ -1401,11 +1245,6 @@ void DSPOp08() int Op08Size = (Op08X * Op08X + Op08Y * Op08Y + Op08Z * Op08Z) << 1;
Op08Ll = Op08Size & 0xffff;
Op08Lh = (Op08Size >> 16) & 0xffff;
-
-#ifdef DebugDSP1
- Log_Message("OP08 %d,%d,%d", Op08X, Op08Y, Op08Z);
- Log_Message("OP08 ((Op08X^2)+(Op08Y^2)+(Op08X^2))=%x", Op08Size);
-#endif
}
short Op18X, Op18Y, Op18Z, Op18R, Op18D;
@@ -1413,10 +1252,6 @@ short Op18X, Op18Y, Op18Z, Op18R, Op18D; void DSPOp18()
{
Op18D = (Op18X * Op18X + Op18Y * Op18Y + Op18Z * Op18Z - Op18R * Op18R) >> 15;
-
-#ifdef DebugDSP1
- Log_Message("Op18 X: %d Y: %d Z: %d R: %D DIFF %d", Op18X, Op18Y, Op38Z, Op18D);
-#endif
}
short Op38X, Op38Y, Op38Z, Op38R, Op38D;
@@ -1425,10 +1260,6 @@ void DSPOp38() {
Op38D = (Op38X * Op38X + Op38Y * Op38Y + Op38Z * Op38Z - Op38R * Op38R) >> 15;
Op38D++;
-
-#ifdef DebugDSP1
- Log_Message("OP38 X: %d Y: %d Z: %d R: %D DIFF %d", Op38X, Op38Y, Op38Z, Op38D);
-#endif
}
short Op28X;
@@ -1455,11 +1286,6 @@ void DSPOp28() Op28R = ((Node2 - Node1) * (C & 0x1ff) >> 9) + Node1;
Op28R >>= (E >> 1);
}
-
-#ifdef DebugDSP1
- Log_Message("OP28 X:%d Y:%d Z:%d", Op28X, Op28Y, Op28Z);
- Log_Message("OP28 Vector Length %d", Op28R);
-#endif
}
short Op1CX, Op1CY, Op1CZ;
@@ -1491,10 +1317,6 @@ void DSPOp1C() Op1CZ1 = (Op1CZBR * DSP1_Cos(Op1CX) >> 15) - (Op1CYBR * DSP1_Sin(Op1CX) >> 15);
Op1CYAR = Op1CY1;
Op1CZAR = Op1CZ1;
-
-#ifdef DebugDSP1
- Log_Message("OP1C Apply Matrix CX:%d CY:%d CZ", Op1CXAR, Op1CYAR, Op1CZAR);
-#endif
}
unsigned short Op0FRamsize;
@@ -1503,10 +1325,6 @@ unsigned short Op0FPass; void DSPOp0F()
{
Op0FPass = 0x0000;
-
-#ifdef DebugDSP1
- Log_Message("OP0F RAM Test Pass:%d", Op0FPass);
-#endif
}
short Op2FUnknown;
diff --git a/src/dsp1emu_fixed.c b/src/dsp1emu_fixed.c index 3793bff..4c2cdc4 100644 --- a/src/dsp1emu_fixed.c +++ b/src/dsp1emu_fixed.c @@ -15,17 +15,12 @@ //along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#ifndef __GP32__
#include <stdio.h>
#include <stdarg.h>
-#endif
#include <math.h>
-#ifndef __GP32__
#include <string.h>
#include <stdlib.h>
-#endif
-//#define DebugDSP1
#define funcSADDMULT1616(a,b,c,d) (((int64)a*(int64)b+(int64)c*(int64)d)>>16);
@@ -36,17 +31,6 @@ res=funcSADDMULT1616(a,b,0,0);\
}
-// uncomment some lines to test
-//#define printinfo
-//#define debug02
-//#define debug0A
-//#define debug06
-
-//#ifdef __GP32__
-//for the SMUL1616 & UMUL1616
-//#include "gp32_func.h"
-//#endif
-
#define __OPT__
#define __OPT01__
#define __OPT02__
@@ -57,45 +41,6 @@ #define __OPT21__
#define __OPT1C__
-#ifdef DebugDSP1
-
-FILE* LogFile = NULL;
-
-void Log_Message(char* Message, ...)
-{
- char Msg[400];
- va_list ap;
-
- va_start(ap, Message);
- vsprintf(Msg, Message, ap);
- va_end(ap);
-
- strcat(Msg, "\r\n\0");
- fwrite(Msg, strlen(Msg), 1, LogFile);
- fflush(LogFile);
-}
-
-void Start_Log(void)
-{
- char LogFileName[255];
- // [4/15/2001] char *p;
-
- strcpy(LogFileName, "dsp1emu.log\0");
-
- LogFile = fopen(LogFileName, "wb");
-}
-
-void Stop_Log(void)
-{
- if (LogFile)
- {
- fclose(LogFile);
- LogFile = NULL;
- }
-}
-
-#endif
-
const unsigned short DSP1ROM[1024] =
{
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -289,9 +234,6 @@ void InitDSP(void) SinTable2[i] = (int32)((sin((double)(2 * PI_float * i / INCR))) * (1 << _FIX_SHIFT_));
}
#endif
-#ifdef DebugDSP1
- Start_Log();
-#endif
}
@@ -303,9 +245,6 @@ void DSPOp00() {
//Op00Result=Op00Multiplicand*Op00Multiplier/32768;
Op00Result = Op00Multiplicand * Op00Multiplier >> 15;
-#ifdef DebugDSP1
- Log_Message("OP00 MULT %d*%d/32768=%d", Op00Multiplicand, Op00Multiplier, Op00Result);
-#endif
}
short Op20Multiplicand;
@@ -316,10 +255,6 @@ void DSPOp20() {
Op20Result = Op20Multiplicand * Op20Multiplier >> 15;
Op20Result++;
-
-#ifdef DebugDSP1
- Log_Message("OP20 MULT %d*%d/32768=%d", Op20Multiplicand, Op20Multiplier, Op20Result);
-#endif
}
@@ -358,9 +293,6 @@ void DSPOp10() }
//Op10CoefficientR = Op10Temp*32768;
Op10CoefficientR = Op10Temp >> (_FIX_SHIFT_ - 15);
-#ifdef DebugDSP1
- Log_Message("OP10 INV %d*2^%d = %d*2^%d", Op10Coefficient, Op10Exponent, Op10CoefficientR, Op10ExponentR);
-#endif
}
@@ -381,11 +313,6 @@ void DSPOp04() //Op04Cos = Cos(angle) * Op04Radius;
SMULT1616(Op04Sin, Sin(angle), Op04Radius)
SMULT1616(Op04Cos, Cos(angle), Op04Radius)
-
-#ifdef DebugDSP1
- Log_Message("OP04 Angle:%d Radius:%d", (Op04Angle / 256) & 255, Op04Radius);
- Log_Message("OP04 SIN:%d COS:%d", Op04Sin, Op04Cos);
-#endif
}
#else
@@ -397,11 +324,6 @@ void DSPOp04() Op04Sin = sin(angle) * Op04Radius;
Op04Cos = cos(angle) * Op04Radius;
-
-#ifdef DebugDSP1
- Log_Message("OP04 Angle:%d Radius:%d", (Op04Angle / 256) & 255, Op04Radius);
- Log_Message("OP04 SIN:%d COS:%d", Op04Sin, Op04Cos);
-#endif
}
#endif
@@ -418,10 +340,6 @@ void DSPOp0C() //Op0CY2=Op0CX1*-Sin(Angle(Op0CA))+Op0CY1*Cos(Angle(Op0CA));
Op0CX2 = ((int32)Op0CX1 * Cos(Angle(Op0CA)) + (int32)Op0CY1 * Sin(Angle(Op0CA))) >> _FIX_SHIFT_;
Op0CY2 = ((int32)Op0CX1 * -Sin(Angle(Op0CA)) + (int32)Op0CY1 * Cos(Angle(Op0CA))) >> _FIX_SHIFT_;
-
-#ifdef DebugDSP1
- Log_Message("OP0C Angle:%d X:%d Y:%d CX:%d CY:%d", (Op0CA / 256) & 255, Op0CX1, Op0CY1, Op0CX2, Op0CY2);
-#endif
}
#else
void DSPOp0C()
@@ -429,9 +347,6 @@ void DSPOp0C() Op0CX2 = (Op0CX1 * cos(Op0CA * 2 * PI / 65536.0) + Op0CY1 * sin(Op0CA * 2 * PI / 65536.0));
Op0CY2 = (Op0CX1 * -sin(Op0CA * 2 * PI / 65536.0) + Op0CY1 * cos(Op0CA * 2 * PI / 65536.0));
-#ifdef DebugDSP1
- Log_Message("OP0C Angle:%d X:%d Y:%d CX:%d CY:%d", (Op0CA / 256) & 255, Op0CX1, Op0CY1, Op0CX2, Op0CY2);
-#endif
}
#endif
@@ -539,11 +454,6 @@ void DSPOp02() SMULT1616(ViewerY1, Sin(Angle(Op02AZS)), Cos(Angle(Op02AAS)))
-#ifdef debug02
- printf("\nViewerX1 : %f ViewerY1 : %f ViewerZ1 : %f\n", ViewerX1, ViewerY1,
- ViewerZ1);
- getch();
-#endif
/*ViewerX=Op02FX-ViewerX1*Op02LFE;
ViewerY=Op02FY-ViewerY1*Op02LFE;
ViewerZ=Op02FZ-ViewerZ1*Op02LFE;
@@ -559,12 +469,6 @@ void DSPOp02() ScreenY = ((int32)Op02FY << _FIX_SHIFT_) + ViewerY1 * (int32)(Op02LES - Op02LFE);
ScreenZ = ((int32)Op02FZ << _FIX_SHIFT_) + ViewerZ1 * (int32)(Op02LES - Op02LFE);
-#ifdef debug02
- printf("ViewerX : %f ViewerY : %f ViewerZ : %f\n", ViewerX, ViewerY, ViewerZ);
- printf("Op02FX : %d Op02FY : %d Op02FZ : %d\n", Op02FX, Op02FY, Op02FZ);
- printf("ScreenX : %f ScreenY : %f ScreenZ : %f\n", ScreenX, ScreenY, ScreenZ);
- getch();
-#endif
if (ViewerZ1 == 0)ViewerZ1++;
NumberOfSlope = ((int64)ViewerZ << _FIX_SHIFT_) / (-ViewerZ1);
@@ -665,14 +569,6 @@ void DSPOp02() // if(Op02LFE==0x2200)Op02VVA=0xFECD;
// else Op02VVA=0xFFB2;
-
-
-#ifdef DebugDSP1
- Log_Message("OP02 FX:%d FY:%d FZ:%d LFE:%d LES:%d", Op02FX, Op02FY, Op02FZ, Op02LFE, Op02LES);
- Log_Message(" AAS:%d AZS:%d VOF:%d VVA:%d", Op02AAS, Op02AZS, Op02VOF, Op02VVA);
- Log_Message(" VX:%d VY:%d VZ:%d", (short)ViewerX, (short)ViewerY, (short)ViewerZ);
-#endif
-
}
#else
@@ -682,11 +578,6 @@ void DSPOp02() ViewerX1 = sin(Op02AZS * 6.2832 / 65536.0) * sin(Op02AAS * 6.2832 / 65536.0);
ViewerY1 = sin(Op02AZS * 6.2832 / 65536.0) * cos(-Op02AAS * 6.2832 / 65536.0);
-#ifdef debug02
- printf("\nViewerX1 : %f ViewerY1 : %f ViewerZ1 : %f\n", ViewerX1, ViewerY1,
- ViewerZ1);
- getch();
-#endif
ViewerX = Op02FX - ViewerX1 * Op02LFE;
ViewerY = Op02FY - ViewerY1 * Op02LFE;
ViewerZ = Op02FZ - ViewerZ1 * Op02LFE;
@@ -695,12 +586,6 @@ void DSPOp02() ScreenY = Op02FY + ViewerY1 * (Op02LES - Op02LFE);
ScreenZ = Op02FZ + ViewerZ1 * (Op02LES - Op02LFE);
-#ifdef debug02
- printf("ViewerX : %f ViewerY : %f ViewerZ : %f\n", ViewerX, ViewerY, ViewerZ);
- printf("Op02FX : %d Op02FY : %d Op02FZ : %d\n", Op02FX, Op02FY, Op02FZ);
- printf("ScreenX : %f ScreenY : %f ScreenZ : %f\n", ScreenX, ScreenY, ScreenZ);
- getch();
-#endif
if (ViewerZ1 == 0)ViewerZ1++;
NumberOfSlope = ViewerZ / -ViewerZ1;
@@ -762,14 +647,6 @@ void DSPOp02() // if(Op02LFE==0x2200)Op02VVA=0xFECD;
// else Op02VVA=0xFFB2;
-
-
-#ifdef DebugDSP1
- Log_Message("OP02 FX:%d FY:%d FZ:%d LFE:%d LES:%d", Op02FX, Op02FY, Op02FZ, Op02LFE, Op02LES);
- Log_Message(" AAS:%d AZS:%d VOF:%d VVA:%d", Op02AAS, Op02AZS, Op02VOF, Op02VVA);
- Log_Message(" VX:%d VY:%d VZ:%d", (short)ViewerX, (short)ViewerY, (short)ViewerZ);
-#endif
-
}
#endif
@@ -975,10 +852,6 @@ void DSPOp06() //ObjPZ2=(ObjPY1*Sin(tanval2)+ObjPZ1*Cos(tanval2));
SADDMULT1616(ObjPZ2, ObjPY1, Sin(tanval2), ObjPZ1, Cos(tanval2))
-#ifdef debug06
- Log_Message("ObjPX2: %f ObjPY2: %f ObjPZ2: %f\n", ObjPX2, ObjPY2, ObjPZ2);
-#endif
-
ObjPZ2 = ObjPZ2 - Op02LFE;
if (ObjPZ2 < 0)
@@ -993,12 +866,6 @@ void DSPOp06() Op06V = 14 * 16;
Op06S = 0xFFFF;
}
-
-
-#ifdef DebugDSP1
- Log_Message("OP06 X:%d Y:%d Z:%d", Op06X, Op06Y, Op06Z);
- Log_Message("OP06 H:%d V:%d S:%d", Op06H, Op06V, Op06S);
-#endif
}
#else
@@ -1014,22 +881,12 @@ void DSPOp06() ObjPY1 = (ObjPX * sin(tanval) + ObjPY * cos(tanval));
ObjPZ1 = ObjPZ;
-#ifdef debug06
- Log_Message("Angle : %f", tanval);
- Log_Message("ObjPX1: %f ObjPY1: %f ObjPZ1: %f\n", ObjPX1, ObjPY1, ObjPZ1);
- Log_Message("cos(tanval) : %f sin(tanval) : %f", cos(tanval), sin(tanval));
-#endif
-
// rotate around X
tanval = (-Op02AZS) / 65536.0 * 6.2832;
ObjPX2 = ObjPX1;
ObjPY2 = (ObjPY1 * cos(tanval) + ObjPZ1 * -sin(tanval));
ObjPZ2 = (ObjPY1 * sin(tanval) + ObjPZ1 * cos(tanval));
-#ifdef debug06
- Log_Message("ObjPX2: %f ObjPY2: %f ObjPZ2: %f\n", ObjPX2, ObjPY2, ObjPZ2);
-#endif
-
ObjPZ2 = ObjPZ2 - Op02LFE;
if (ObjPZ2 < 0)
@@ -1044,12 +901,6 @@ void DSPOp06() Op06V = 14 * 16;
Op06S = 0xFFFF;
}
-
-
-#ifdef DebugDSP1
- Log_Message("OP06 X:%d Y:%d Z:%d", Op06X, Op06Y, Op06Z);
- Log_Message("OP06 H:%d V:%d S:%d", Op06H, Op06V, Op06S);
-#endif
}
#endif
@@ -1159,10 +1010,6 @@ void DSPOp01() matrixA[2][0] = matrixB[2][0];
matrixA[2][1] = matrixB[2][1];
matrixA[2][2] = matrixB[2][2];
-
-#ifdef DebugDSP1
- Log_Message("OP01 ZR: %d XR: %d YR: %d", Op01Zr, Op01Xr, Op01Yr);
-#endif
}
#else
@@ -1220,10 +1067,6 @@ void DSPOp01() matrixA[2][0] = matrixB[2][0];
matrixA[2][1] = matrixB[2][1];
matrixA[2][2] = matrixB[2][2];
-
-#ifdef DebugDSP1
- Log_Message("OP01 ZR: %d XR: %d YR: %d", Op01Zr, Op01Xr, Op01Yr);
-#endif
}
#endif
@@ -1282,9 +1125,6 @@ void DSPOp11() matrixA2[2][0] = matrixB[2][0];
matrixA2[2][1] = matrixB[2][1];
matrixA2[2][2] = matrixB[2][2];
-#ifdef DebugDSP1
- Log_Message("OP11 ZR: %d XR: %d YR: %d SC: %d", Op11Zr, Op11Xr, Op11Yr, Op11m);
-#endif
}
#else
@@ -1341,9 +1181,6 @@ void DSPOp11() matrixA2[2][0] = matrixB[2][0];
matrixA2[2][1] = matrixB[2][1];
matrixA2[2][2] = matrixB[2][2];
-#ifdef DebugDSP1
- Log_Message("OP11 ZR: %d XR: %d YR: %d SC: %d", Op11Zr, Op11Xr, Op11Yr, Op11m);
-#endif
}
#endif
@@ -1403,9 +1240,6 @@ void DSPOp21() matrixA3[2][0] = matrixB[2][0];
matrixA3[2][1] = matrixB[2][1];
matrixA3[2][2] = matrixB[2][2];
-#ifdef DebugDSP1
- Log_Message("OP21 ZR: %d XR: %d YR: %d", Op21Zr, Op21Xr, Op21Yr);
-#endif
}
#else
@@ -1462,9 +1296,6 @@ void DSPOp21() matrixA3[2][0] = matrixB[2][0];
matrixA3[2][1] = matrixB[2][1];
matrixA3[2][2] = matrixB[2][2];
-#ifdef DebugDSP1
- Log_Message("OP21 ZR: %d XR: %d YR: %d", Op21Zr, Op21Xr, Op21Yr);
-#endif
}
#endif
@@ -1512,9 +1343,6 @@ void DSPOp0D() Op0DF = Op0DX;
Op0DL = Op0DY;
Op0DU = Op0DZ;
-#ifdef DebugDSP1
- Log_Message("OP0D Error! Det == 0");
-#endif
return;
}
swap(d, b);
@@ -1540,9 +1368,6 @@ void DSPOp0D() Op0DL = (short)((x * b2 + y * e2 + z * h2) / 2 * sc);
Op0DU = (short)((x * c2 + y * f2 + z * i2) / 2 * sc);
-#ifdef DebugDSP1
- Log_Message("OP0D X: %d Y: %d Z: %d / F: %d L: %d U: %d", Op0DX, Op0DY, Op0DZ, Op0DF, Op0DL, Op0DU);
-#endif
}
void DSPOp1D()
@@ -1591,9 +1416,6 @@ void DSPOp1D() Op1DF = (short)((x * a2 + y * d2 + z * g2) / 2 * sc2);
Op1DL = (short)((x * b2 + y * e2 + z * h2) / 2 * sc2);
Op1DU = (short)((x * c2 + y * f2 + z * i2) / 2 * sc2);
-#ifdef DebugDSP1
- Log_Message("OP1D X: %d Y: %d Z: %d / F: %d L: %d U: %d", Op1DX, Op1DY, Op1DZ, Op1DF, Op1DL, Op1DU);
-#endif
}
void DSPOp2D()
@@ -1642,9 +1464,6 @@ void DSPOp2D() Op2DF = (short)((x * a2 + y * d2 + z * g2) / 2 * sc3);
Op2DL = (short)((x * b2 + y * e2 + z * h2) / 2 * sc3);
Op2DU = (short)((x * c2 + y * f2 + z * i2) / 2 * sc3);
-#ifdef DebugDSP1
- Log_Message("OP2D X: %d Y: %d Z: %d / F: %d L: %d U: %d", Op2DX, Op2DY, Op2DZ, Op2DF, Op2DL, Op2DU);
-#endif
}
short Op03F;
@@ -1677,9 +1496,6 @@ void DSPOp03() Op03Y = (short)((F * matrixA[0][1] + L * matrixA[1][1] + U * matrixA[2][1]) / 2 * sc);
Op03Z = (short)((F * matrixA[0][2] + L * matrixA[1][2] + U * matrixA[2][2]) / 2 * sc);
-#ifdef DebugDSP1
- Log_Message("OP03 F: %d L: %d U: %d / X: %d Y: %d Z: %d", Op03F, Op03L, Op03U, Op03X, Op03Y, Op03Z);
-#endif
}
void DSPOp13()
@@ -1691,9 +1507,6 @@ void DSPOp13() Op13X = (short)((F * matrixA2[0][0] + L * matrixA2[1][0] + U * matrixA2[2][0]) / 2 * sc2);
Op13Y = (short)((F * matrixA2[0][1] + L * matrixA2[1][1] + U * matrixA2[2][1]) / 2 * sc2);
Op13Z = (short)((F * matrixA2[0][2] + L * matrixA2[1][2] + U * matrixA2[2][2]) / 2 * sc2);
-#ifdef DebugDSP1
- Log_Message("OP13 F: %d L: %d U: %d / X: %d Y: %d Z: %d", Op13F, Op13L, Op13U, Op13X, Op13Y, Op13Z);
-#endif
}
void DSPOp23()
@@ -1705,9 +1518,6 @@ void DSPOp23() Op23X = (short)((F * matrixA3[0][0] + L * matrixA3[1][0] + U * matrixA3[2][0]) / 2 * sc3);
Op23Y = (short)((F * matrixA3[0][1] + L * matrixA3[1][1] + U * matrixA3[2][1]) / 2 * sc3);
Op23Z = (short)((F * matrixA3[0][2] + L * matrixA3[1][2] + U * matrixA3[2][2]) / 2 * sc3);
-#ifdef DebugDSP1
- Log_Message("OP23 F: %d L: %d U: %d / X: %d Y: %d Z: %d", Op23F, Op23L, Op23U, Op23X, Op23Y, Op23Z);
-#endif
}
short Op14Zr;
@@ -1736,10 +1546,6 @@ void DSPOp14() Op14Yrr = (short)(Op14Temp * 65536.0 / 6.2832);
-#ifdef DebugDSP1
- Log_Message("OP14 X:%d Y%d Z:%D U:%d F:%d L:%d", Op14Xr, Op14Yr, Op14Zr, Op14U, Op14F, Op14L);
- Log_Message("OP14 X:%d Y%d Z:%D", Op14Xrr, Op14Yrr, Op14Zrr);
-#endif
}
short Op0EH;
@@ -1761,9 +1567,6 @@ void DSPOp0E() //Op0EY = RYRes;
Op0EY = RYRes >> _FIX_SHIFT_;
-#ifdef DebugDSP1
- Log_Message("OP0E COORDINATE H:%d V:%d X:%d Y:%d", Op0EH, Op0EV, Op0EX, Op0EY);
-#endif
}
short Op0BX;
@@ -1783,20 +1586,12 @@ void DSPOp0B() {
//Op0BS = (Op0BX*matrixA[0][0]+Op0BY*matrixA2[0][1]+Op0BZ*matrixA2[0][2]);
Op0BS = (Op0BX * matrixA[0][0] + Op0BY * matrixA2[0][1] + Op0BZ * matrixA2[0][2]) >> _FIX_SHIFT_;
-#ifdef DebugDSP1
- Log_Message("OP0B");
-#endif
}
void DSPOp1B()
{
//Op1BS = (Op1BX*matrixA2[0][0]+Op1BY*matrixA2[0][1]+Op1BZ*matrixA2[0][2]);
Op1BS = (Op1BX * matrixA2[0][0] + Op1BY * matrixA2[0][1] + Op1BZ * matrixA2[0][2]) >> _FIX_SHIFT_;
-#ifdef DebugDSP1
- Log_Message("OP1B X: %d Y: %d Z: %d S: %d", Op1BX, Op1BY, Op1BZ, Op1BS);
- Log_Message(" MX: %d MY: %d MZ: %d Scale: %d", (short)(matrixA2[0][0] * 100), (short)(matrixA2[0][1] * 100),
- (short)(matrixA2[0][2] * 100), (short)(sc2 * 100));
-#endif
}
@@ -1804,9 +1599,6 @@ void DSPOp2B() {
//Op2BS = (Op2BX*matrixA3[0][0]+Op2BY*matrixA3[0][1]+Op2BZ*matrixA3[0][2]);
Op2BS = (Op2BX * matrixA3[0][0] + Op2BY * matrixA3[0][1] + Op2BZ * matrixA3[0][2]) >> _FIX_SHIFT_;
-#ifdef DebugDSP1
- Log_Message("OP2B");
-#endif
}
short Op08X, Op08Y, Op08Z, Op08Ll, Op08Lh;
@@ -1817,10 +1609,6 @@ void DSPOp08() Op08Size = (Op08X * Op08X + Op08Y * Op08Y + Op08Z * Op08Z) * 2;
Op08Ll = Op08Size & 0xFFFF;
Op08Lh = (Op08Size >> 16) & 0xFFFF;
-#ifdef DebugDSP1
- Log_Message("OP08 %d,%d,%d", Op08X, Op08Y, Op08Z);
- Log_Message("OP08 ((Op08X^2)+(Op08Y^2)+(Op08X^2))=%x", Op08Size);
-#endif
}
short Op18X, Op18Y, Op18Z, Op18R, Op18D;
@@ -1837,9 +1625,6 @@ void DSPOp18() if (r > 32767) r = 32767;
if (r < -32768) r = -32768;
Op18D = (short)r;
-#ifdef DebugDSP1
- Log_Message("OP18 X: %d Y: %d Z: %d R: %D DIFF %d", Op18X, Op18Y, Op18Z, Op18D);
-#endif
}
short Op38X, Op38Y, Op38Z, Op38R, Op38D;
@@ -1849,9 +1634,6 @@ void DSPOp38() Op38D = (Op38X * Op38X + Op38Y * Op38Y + Op38Z * Op38Z - Op38R * Op38R) >> 15;
Op38D++;
-#ifdef DebugDSP1
- Log_Message("OP38 X: %d Y: %d Z: %d R: %D DIFF %d", Op38X, Op38Y, Op38Z, Op38D);
-#endif
}
@@ -1864,10 +1646,6 @@ void DSPOp28() {
//to optimize... sqrt
Op28R = (short)sqrt((double)(Op28X * Op28X + Op28Y * Op28Y + Op28Z * Op28Z));
-#ifdef DebugDSP1
- Log_Message("OP28 X:%d Y:%d Z:%d", Op28X, Op28Y, Op28Z);
- Log_Message("OP28 Vector Length %d", Op28R);
-#endif
}
short Op1CAZ;
@@ -1906,10 +1684,6 @@ void DSPOp1C() Op1CYAR = (Op1CY2 * Cos(xa) + Op1CZ2 * Sin(xa)) >> _FIX_SHIFT_;
//Op1CZAR=(Op1CY2*-Sin(xa)+Op1CZ2*Cos(xa));
Op1CZAR = (Op1CY2 * -Sin(xa) + Op1CZ2 * Cos(xa)) >> _FIX_SHIFT_;
-
-#ifdef DebugDSP1
- Log_Message("OP1C Apply Matrix CX:%d CY:%d CZ", Op1CXAR, Op1CYAR, Op1CZAR);
-#endif
}
#else
void DSPOp1C()
@@ -1930,10 +1704,6 @@ void DSPOp1C() Op1CXAR = Op1CX2;
Op1CYAR = (Op1CY2 * cos(xa) + Op1CZ2 * sin(xa));
Op1CZAR = (Op1CY2 * -sin(xa) + Op1CZ2 * cos(xa));
-
-#ifdef DebugDSP1
- Log_Message("OP1C Apply Matrix CX:%d CY:%d CZ", Op1CXAR, Op1CYAR, Op1CZAR);
-#endif
}
#endif
@@ -1944,10 +1714,6 @@ unsigned short Op0FPass; void DSPOp0F()
{
Op0FPass = 0x0000;
-
-#ifdef DebugDSP1
- Log_Message("OP0F RAM Test Pass:%d", Op0FPass);
-#endif
}
diff --git a/src/dsp2emu.c b/src/dsp2emu.c index 4fdf804..ba48368 100644 --- a/src/dsp2emu.c +++ b/src/dsp2emu.c @@ -336,4 +336,4 @@ void DSP2_Op0D() DSP1.output[i] = (pixelarray[i << 1] << 4) | pixelarray[(i << 1) + 1];
}
-#endif
\ No newline at end of file +#endif
|