diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DSP1_gp32.cpp | 15 | ||||
-rw-r--r-- | src/apu.cpp | 179 | ||||
-rw-r--r-- | src/asmout.sh | 37 | ||||
-rw-r--r-- | src/bsd_mem.h | 2 | ||||
-rw-r--r-- | src/c4.cpp | 3 | ||||
-rw-r--r-- | src/c4emu.cpp | 131 | ||||
-rw-r--r-- | src/cpuops.cpp | 17 | ||||
-rw-r--r-- | src/disk_img.c | 103 | ||||
-rw-r--r-- | src/disk_img.h | 12 | ||||
-rw-r--r-- | src/dma.cpp | 70 | ||||
-rw-r--r-- | src/soundux.cpp | 4 | ||||
-rw-r--r-- | src/sys_cacheflush.S | 29 | ||||
-rw-r--r-- | src/sys_cacheflush.h | 15 | ||||
-rw-r--r-- | src/warm.cpp | 148 | ||||
-rw-r--r-- | src/warm.h | 100 |
15 files changed, 1 insertions, 864 deletions
diff --git a/src/DSP1_gp32.cpp b/src/DSP1_gp32.cpp index a38763e..7c89cbf 100644 --- a/src/DSP1_gp32.cpp +++ b/src/DSP1_gp32.cpp @@ -73,13 +73,6 @@ uint8 S9xGetDSP (uint16 address) {
uint8 t;
-#ifdef DEBUGGER
- if (Settings.TraceDSP)
- {
- sprintf (String, "DSP read: 0x%04X", address);
- S9xMessage (S9X_TRACE, S9X_TRACE_DSP1, String);
- }
-#endif
if ((address & 0xf000) == 0x6000 ||
(address >= 0x8000 && address < 0xc000))
{
@@ -121,14 +114,6 @@ uint8 S9xGetDSP (uint16 address) void S9xSetDSP (uint8 byte, uint16 address)
{
-#ifdef DEBUGGER
- missing.unknowndsp_write = address;
- if (Settings.TraceDSP)
- {
- sprintf (String, "DSP write: 0x%04X=0x%02X", address, byte);
- S9xMessage (S9X_TRACE, S9X_TRACE_DSP1, String);
- }
-#endif
if ((address & 0xf000) == 0x6000 ||
(address >= 0x8000 && address < 0xc000))
{
diff --git a/src/apu.cpp b/src/apu.cpp index 2e83a00..48ee2d8 100644 --- a/src/apu.cpp +++ b/src/apu.cpp @@ -49,10 +49,6 @@ //#include "snapshot.h"
//extern int NoiseFreq [32];
-#ifdef DEBUGGER
-void S9xTraceSoundDSP (const char *s, int i1 = 0, int i2 = 0, int i3 = 0,
- int i4 = 0, int i5 = 0, int i6 = 0, int i7 = 0);
-#endif
#undef ABS
#define ABS(a) ((a) < 0 ? -(a) : (a))
@@ -508,10 +504,6 @@ void S9xSetAPUDSP (uint8 byte) APU.DSP [APU_KOFF] = 0;
APU.DSP [APU_KON] = 0;
S9xSetEchoWriteEnable (FALSE);
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] DSP reset\n", ICPU.Scanline);
-#endif
// Kill sound
S9xResetSound (FALSE);
}
@@ -520,10 +512,6 @@ void S9xSetAPUDSP (uint8 byte) S9xSetEchoWriteEnable (!(byte & APU_ECHO_DISABLED));
if (byte & APU_MUTE)
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Mute sound\n", ICPU.Scanline);
-#endif
S9xSetSoundMute (TRUE);
}
else
@@ -540,10 +528,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_NON:
if (byte != APU.DSP [APU_NON])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Noise:", ICPU.Scanline);
-#endif
uint8 mask = 1;
for (int c = 0; c < 8; c++, mask <<= 1)
{
@@ -551,43 +535,18 @@ void S9xSetAPUDSP (uint8 byte) if (byte & mask)
{
type = SOUND_NOISE;
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- {
- if (APU.DSP [reg] & mask)
- S9xTraceSoundDSP ("%d,", c);
- else
- S9xTraceSoundDSP ("%d(on),", c);
- }
-#endif
}
else
{
type = SOUND_SAMPLE;
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- {
- if (APU.DSP [reg] & mask)
- S9xTraceSoundDSP ("%d(off),", c);
- }
-#endif
}
S9xSetSoundType (c, type);
}
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("\n");
-#endif
}
break;
case APU_MVOL_LEFT:
if (byte != APU.DSP [APU_MVOL_LEFT])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Master volume left:%d\n",
- ICPU.Scanline, (signed char) byte);
-#endif
S9xSetMasterVolume ((signed char) byte,
(signed char) APU.DSP [APU_MVOL_RIGHT]);
}
@@ -595,11 +554,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_MVOL_RIGHT:
if (byte != APU.DSP [APU_MVOL_RIGHT])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Master volume right:%d\n",
- ICPU.Scanline, (signed char) byte);
-#endif
S9xSetMasterVolume ((signed char) APU.DSP [APU_MVOL_LEFT],
(signed char) byte);
}
@@ -607,11 +561,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_EVOL_LEFT:
if (byte != APU.DSP [APU_EVOL_LEFT])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Echo volume left:%d\n",
- ICPU.Scanline, (signed char) byte);
-#endif
S9xSetEchoVolume ((signed char) byte,
(signed char) APU.DSP [APU_EVOL_RIGHT]);
}
@@ -619,20 +568,11 @@ void S9xSetAPUDSP (uint8 byte) case APU_EVOL_RIGHT:
if (byte != APU.DSP [APU_EVOL_RIGHT])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Echo volume right:%d\n",
- ICPU.Scanline, (signed char) byte);
-#endif
S9xSetEchoVolume ((signed char) APU.DSP [APU_EVOL_LEFT],
(signed char) byte);
}
break;
case APU_ENDX:
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Reset ENDX\n", ICPU.Scanline);
-#endif
byte = 0;
break;
@@ -640,19 +580,10 @@ void S9xSetAPUDSP (uint8 byte) // if (byte)
{
uint8 mask = 1;
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Key off:", ICPU.Scanline);
-#endif
for (int c = 0; c < 8; c++, mask <<= 1)
{
if ((byte & mask) != 0)
{
-#ifdef DEBUGGER
-
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("%d,", c);
-#endif
if (APU.KeyedChannels & mask)
{
{
@@ -674,10 +605,6 @@ void S9xSetAPUDSP (uint8 byte) S9xPlaySample (c);
}
}
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("\n");
-#endif
}
//KeyOnPrev=0;
APU.DSP [APU_KOFF] = byte;
@@ -687,19 +614,10 @@ void S9xSetAPUDSP (uint8 byte) if (byte)
{
uint8 mask = 1;
-#ifdef DEBUGGER
-
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Key on:", ICPU.Scanline);
-#endif
for (int c = 0; c < 8; c++, mask <<= 1)
{
if ((byte & mask) != 0)
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("%d,", c);
-#endif
// Pac-In-Time requires that channels can be key-on
// regardeless of their current state.
if((APU.DSP [APU_KOFF] & mask) ==0)
@@ -714,10 +632,6 @@ void S9xSetAPUDSP (uint8 byte) else KeyOn|=mask;
}
}
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("\n");
-#endif
}
//spc_is_dumping_temp = byte;
return;
@@ -733,11 +647,6 @@ void S9xSetAPUDSP (uint8 byte) // At Shin Megami Tensei suggestion 6/11/00
// if (byte != APU.DSP [reg])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] %d volume left: %d\n",
- ICPU.Scanline, reg>>4, (signed char) byte);
-#endif
S9xSetSoundVolume (reg >> 4, (signed char) byte,
(signed char) APU.DSP [reg + 1]);
}
@@ -753,11 +662,6 @@ void S9xSetAPUDSP (uint8 byte) // At Shin Megami Tensei suggestion 6/11/00
// if (byte != APU.DSP [reg])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] %d volume right: %d\n",
- ICPU.Scanline, reg >>4, (signed char) byte);
-#endif
S9xSetSoundVolume (reg >> 4, (signed char) APU.DSP [reg - 1],
(signed char) byte);
}
@@ -771,11 +675,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_P_LOW + 0x50:
case APU_P_LOW + 0x60:
case APU_P_LOW + 0x70:
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] %d freq low: %d\n",
- ICPU.Scanline, reg>>4, byte);
-#endif
S9xSetSoundHertz (reg >> 4, (((byte + (APU.DSP [reg + 1] << 8)) & FREQUENCY_MASK) * 32000) >> 12);
break;
@@ -787,11 +686,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_P_HIGH + 0x50:
case APU_P_HIGH + 0x60:
case APU_P_HIGH + 0x70:
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] %d freq high: %d\n",
- ICPU.Scanline, reg>>4, byte);
-#endif
S9xSetSoundHertz (reg >> 4,
(((byte << 8) + APU.DSP [reg - 1]) & FREQUENCY_MASK) * 8);
break;
@@ -806,11 +700,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_SRCN + 0x70:
if (byte != APU.DSP [reg])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] %d sample number: %d\n",
- ICPU.Scanline, reg>>4, byte);
-#endif
//S9xSetSoundSample (reg >> 4, byte); // notaz: seems to be unused?
}
break;
@@ -825,11 +714,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_ADSR1 + 0x70:
if (byte != APU.DSP [reg])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] %d adsr1: %02x\n",
- ICPU.Scanline, reg>>4, byte);
-#endif
{
S9xFixEnvelope (reg >> 4, APU.DSP [reg + 2], byte,
APU.DSP [reg + 1]);
@@ -847,11 +731,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_ADSR2 + 0x70:
if (byte != APU.DSP [reg])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] %d adsr2: %02x\n",
- ICPU.Scanline, reg>>4, byte);
-#endif
{
S9xFixEnvelope (reg >> 4, APU.DSP [reg + 1], APU.DSP [reg - 1],
byte);
@@ -869,11 +748,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_GAIN + 0x70:
if (byte != APU.DSP [reg])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] %d gain: %02x\n",
- ICPU.Scanline, reg>>4, byte);
-#endif
{
S9xFixEnvelope (reg >> 4, byte, APU.DSP [reg - 2],
APU.DSP [reg - 1]);
@@ -902,39 +776,11 @@ void S9xSetAPUDSP (uint8 byte) break;
case APU_DIR:
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- S9xTraceSoundDSP ("[%d] Sample directory to: %02x\n",
- ICPU.Scanline, byte);
-#endif
break;
case APU_PMON:
if (byte != APU.DSP [APU_PMON])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- {
- S9xTraceSoundDSP ("[%d] FreqMod:", ICPU.Scanline);
- uint8 mask = 1;
- for (int c = 0; c < 8; c++, mask <<= 1)
- {
- if (byte & mask)
- {
- if (APU.DSP [reg] & mask)
- S9xTraceSoundDSP ("%d", c);
- else
- S9xTraceSoundDSP ("%d(on),", c);
- }
- else
- {
- if (APU.DSP [reg] & mask)
- S9xTraceSoundDSP ("%d(off),", c);
- }
- }
- S9xTraceSoundDSP ("\n");
- }
-#endif
S9xSetFrequencyModulationEnable (byte);
}
break;
@@ -942,31 +788,6 @@ void S9xSetAPUDSP (uint8 byte) case APU_EON:
if (byte != APU.DSP [APU_EON])
{
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP)
- {
- S9xTraceSoundDSP ("[%d] Echo:", ICPU.Scanline);
- uint8 mask = 1;
-
- for (int c = 0; c < 8; c++, mask <<= 1)
- {
- if (byte & mask)
-
- {
- if (APU.DSP [reg] & mask)
- S9xTraceSoundDSP ("%d", c);
- else
- S9xTraceSoundDSP ("%d(on),", c);
- }
- else
- {
- if (APU.DSP [reg] & mask)
- S9xTraceSoundDSP ("%d(off),", c);
- }
- }
- S9xTraceSoundDSP ("\n");
- }
-#endif
S9xSetEchoEnable (byte);
}
break;
diff --git a/src/asmout.sh b/src/asmout.sh deleted file mode 100644 index f8603ed..0000000 --- a/src/asmout.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -if [ "$2" == "caanoo" ]; then - echo Using Caanoo toolkit - ARCH="arm-gph-linux-gnueabi" - SDK="/opt/caanoo_sdk/tools/gcc-4.2.4-glibc-2.7-eabi/" - MACHINE="caanoo" -else - echo Using Wiz toolkit - ARCH="arm-open2x-linux" - SDK="/opt/open2x/gcc-4.1.1-glibc-2.3.6/" - MACHINE="wiz" -fi - -GCC="$SDK/bin/$ARCH-gcc" - -COPT="-mcpu=arm926ej-s -mtune=arm926ej-s -g -D__WIZ__" -COPT="$COPT -DASMCPU -DARM" -COPT="$COPT -Os" -COPT="$COPT -ffast-math -msoft-float" -COPT="$COPT -finline -finline-functions -fexpensive-optimizations" -COPT="$COPT -falign-functions=32 -falign-loops -falign-labels -falign-jumps" -COPT="$COPT -fomit-frame-pointer" -COPT="$COPT -fno-common -fno-builtin -fstrict-aliasing -mstructure-size-boundary=32" -#COPT="$COPT -O3" -#COPT="$COPT -ffast-math -msoft-float" -#COPT="$COPT -finline-functions" -#COPT="$COPT -finline -fexpensive-optimizations" -#COPT="$COPT -falign-functions=32 -falign-loops -falign-labels -falign-jumps" -#COPT="$COPT -fomit-frame-pointer" -COPT="$COPT -I$SDK/include" -COPT="$COPT -L$SDK/lib" - - -# -c -g -Wa,-a,-ad -$GCC -c -Wa,-ahl=$1.commented.$MACHINE.s $1.cpp $COPT -$GCC -S -c -o $1.generated.$MACHINE.s $1.cpp $COPT diff --git a/src/bsd_mem.h b/src/bsd_mem.h deleted file mode 100644 index 66f25d3..0000000 --- a/src/bsd_mem.h +++ /dev/null @@ -1,2 +0,0 @@ -extern "C" void *bsd_memmove(void *destination, const void *source, size_t num ); - @@ -79,7 +79,6 @@ #include <math.h>
#include "c4.h"
-#include "bsd_mem.h"
//#include "memmap.h"
extern "C" {
@@ -423,7 +422,7 @@ void C4Op0D() #ifdef ZSNES_C4
void C4LoaDMem(char *C4RAM)
{
- bsd_memmove(C4RAM+(READ_WORD(C4RAM+0x1f45)&0x1fff),
+ memmove(C4RAM+(READ_WORD(C4RAM+0x1f45)&0x1fff),
C4GetMemPointer(READ_3WORD(C4RAM+0x1f40)),
READ_WORD(C4RAM+0x1f43));
}
diff --git a/src/c4emu.cpp b/src/c4emu.cpp index 5e82222..efe8cb8 100644 --- a/src/c4emu.cpp +++ b/src/c4emu.cpp @@ -96,9 +96,6 @@ void S9xInitC4 () uint8 S9xGetC4 (uint16 Address) { -#ifdef DEBUGGER - if(Settings.BGLayering) printf("%02x from %04x\n", Memory.C4RAM[Address-0x6000], Address); -#endif if(Address==0x7f5e) return 0; return (Memory.C4RAM [Address-0x6000]); } @@ -137,12 +134,6 @@ static void C4ConvOAM(void){ globalY=READ_WORD(Memory.C4RAM+0x0623); OAMptr2=Memory.C4RAM+0x200+(Memory.C4RAM[0x626]>>2); -#ifdef DEBUGGER - if(Memory.C4RAM[0x625]!=0) printf("$6625=%02x, expected 00\n", Memory.C4RAM[0x625]); - if((Memory.C4RAM[0x626]>>2)!=Memory.C4RAM[0x629]) printf("$6629=%02x, expected %02x\n", Memory.C4RAM[0x629], (Memory.C4RAM[0x626]>>2)); - if(((uint16)Memory.C4RAM[0x626]<<2)!=READ_WORD(Memory.C4RAM+0x627)) printf("$6627=%04x, expected %04x\n", READ_WORD(Memory.C4RAM+0x627), ((uint16)Memory.C4RAM[0x626]<<2)); -#endif - if(Memory.C4RAM[0x0620]!=0){ SprCount=128-Memory.C4RAM[0x626]; uint8 offset=(Memory.C4RAM[0x626]&3)*2; @@ -258,11 +249,6 @@ static void C4DoScaleRotate(int row_padding){ int32 Cx=(int16)READ_WORD(Memory.C4RAM+0x1f83); int32 Cy=(int16)READ_WORD(Memory.C4RAM+0x1f86); -#ifdef DEBUGGER - if(Memory.C4RAM[0x1f97]!=0) printf("$7f97=%02x, expected 00\n", Memory.C4RAM[0x1f97]); - if((Cx&~1)!=w/2 || (Cy&~1)!=h/2) printf("Center is not middle of image! (%d, %d) != (%d, %d)\n", Cx, Cy, w/2, h/2); -#endif - // Calculate start position (i.e. (Ox, Oy) = (0, 0)) // The low 12 bits are fractional, so (Cx<<12) gives us the Cx we want in // the function. We do Cx*A etc normally because the matrix parameters @@ -369,11 +355,6 @@ static void C4DrawWireFrame(void) int16 X2, Y2, Z2; uint8 Color; -#ifdef DEBUGGER - if(READ_3WORD(Memory.C4RAM+0x1f8f)&0xff00ff) printf("wireframe: Unexpected value in $7f8f: %06x\n", READ_3WORD(Memory.C4RAM+0x1f8f)); - if(READ_3WORD(Memory.C4RAM+0x1fa4)!=0x001000) printf("wireframe: Unexpected value in $7fa4: %06x\n", READ_3WORD(Memory.C4RAM+0x1fa4)); -#endif - for(int i=Memory.C4RAM[0x0295]; i>0; i--, line+=5){ if(line[0]==0xff && line[1]==0xff){ uint8 *tmp=line-5; @@ -401,10 +382,6 @@ static void C4TransformLines(void){ C4WFDist=Memory.C4RAM[0x1f89]; C4WFScale=Memory.C4RAM[0x1f8c]; -#ifdef DEBUGGER - if(Memory.C4RAM[0x1f8a]!=0x90) printf("lines: $7f8a = %02x, expected 90\n", READ_WORD(Memory.C4RAM+0x1f8a)); -#endif - // transform vertices uint8 *ptr=Memory.C4RAM; { @@ -457,10 +434,6 @@ static void C4BitPlaneWave(){ uint16 mask1=0xc0c0; uint16 mask2=0x3f3f; -#ifdef DEBUGGER - if(READ_3WORD(Memory.C4RAM+0x1f80) != Memory.C4RAM[waveptr+0xb00]) printf("$7f80=%06x, expected %02x\n", READ_3WORD(Memory.C4RAM+0x1f80), Memory.C4RAM[waveptr+0xb00]); -#endif - for(int j=0; j<0x10; j++){ do { int16 height=-((int8)Memory.C4RAM[waveptr+0xb00])-16; @@ -517,10 +490,6 @@ static void C4SprDisintegrate() Cx=(int16)READ_WORD(Memory.C4RAM+0x1f80); Cy=(int16)READ_WORD(Memory.C4RAM+0x1f83); -#ifdef DEBUGGER - if((Cx&~1)!=width/2 || (Cy&~1)!=height/2) printf("Center is not middle of image for disintegrate! (%d, %d) != (%d, %d)\n", Cx, Cy, width/2, height/2); -#endif - scaleX=(int16)READ_WORD(Memory.C4RAM+0x1f86); scaleY=(int16)READ_WORD(Memory.C4RAM+0x1f8f); StartX=-Cx*scaleX+(Cx<<8); @@ -553,58 +522,34 @@ static void S9xC4ProcessSprites() switch(Memory.C4RAM[0x1f4d]) { case 0x00: // Build OAM -#ifdef DEBUGGER -// printf("00 00 Build OAM!\n"); -#endif C4ConvOAM(); break; case 0x03: // Scale/Rotate -#ifdef DEBUGGER -// printf("00 03 Scale/Rotate!\n"); -#endif C4DoScaleRotate(0); break; case 0x05: // Transform Lines -#ifdef DEBUGGER -// printf("00 05 Transform Lines!\n"); -#endif C4TransformLines(); break; case 0x07: // Scale/Rotate -#ifdef DEBUGGER -// printf("00 07 Scale/Rotate!\n"); -#endif C4DoScaleRotate(64); break; case 0x08: // Draw wireframe -#ifdef DEBUGGER -// printf("00 08 Draw wireframe!\n"); -#endif C4DrawWireFrame(); break; case 0x0b: // Disintegrate -#ifdef DEBUGGER - printf("00 0b Disintegrate!\n"); -#endif C4SprDisintegrate(); break; case 0x0c: // Wave -#ifdef DEBUGGER -// printf("00 0b Wave!\n"); -#endif C4BitPlaneWave(); break; default: -#ifdef DEBUGGER - printf ("Unknown C4 sprite command (%02x)\n", Memory.C4RAM [0x1f4d]); -#endif break; } } @@ -613,17 +558,11 @@ void S9xSetC4 (uint8 byte, uint16 Address) { int i; -#ifdef DEBUGGER - if(Settings.BGLayering) printf("%02x to %04x\n", byte, Address); -#endif Memory.C4RAM [Address-0x6000] = byte; if (Address == 0x7f4f) { if(Memory.C4RAM[0x1f4d]==0x0e && byte<0x40 && (byte&3)==0) { -#ifdef DEBUGGER - printf("Test command %02x 0e used!\n", byte); -#endif Memory.C4RAM[0x1f80]=byte>>2; } else @@ -635,19 +574,11 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x01: // Draw wireframe -#ifdef DEBUGGER - //printf("01 Draw wireframe used!\n"); - if(Memory.C4RAM[0x1f4d]!=8) printf("$7f4d=%02x, expected 08 for command 01 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif memset(Memory.C4RAM+0x300, 0, 16*12*3*4); C4DrawWireFrame(); break; case 0x05: // Propulsion (?) -#ifdef DEBUGGER - printf("05 Propulsion (?)!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 05 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif { int32 tmp=0x10000; if(READ_WORD(Memory.C4RAM+0x1f83)){ @@ -658,10 +589,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x0d: // Set vector length -#ifdef DEBUGGER - printf("0d Set vector length!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 0d %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif C41FXVal=READ_WORD(Memory.C4RAM+0x1f80); C41FYVal=READ_WORD(Memory.C4RAM+0x1f83); C41FDistVal=READ_WORD(Memory.C4RAM+0x1f86); @@ -671,10 +598,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x10: // Polar to rectangluar -#ifdef DEBUGGER -// printf("10 Polar->Rect!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 10 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif { int32 tmp=SAR((int32)READ_WORD(Memory.C4RAM+0x1f83)*C4CosTable[READ_WORD(Memory.C4RAM+0x1f80)&0x1ff]*2, 16); WRITE_3WORD(Memory.C4RAM+0x1f86, tmp); @@ -684,10 +607,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x13: // Polar to rectangluar -#ifdef DEBUGGER -// printf("13 Polar->Rect!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 13 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif { int32 tmp=SAR((int32)READ_WORD(Memory.C4RAM+0x1f83)*C4CosTable[READ_WORD(Memory.C4RAM+0x1f80)&0x1ff]*2, 8); WRITE_3WORD(Memory.C4RAM+0x1f86, tmp); @@ -697,10 +616,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x15: // Pythagorean -#ifdef DEBUGGER - printf("15 Pythagorean!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 15 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif C41FXVal=READ_WORD(Memory.C4RAM+0x1f80); C41FYVal=READ_WORD(Memory.C4RAM+0x1f83); C41FDist=(int16)sqrtf((float)C41FXVal*C41FXVal + (float)C41FYVal*C41FYVal); @@ -708,10 +623,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x1f: // atan -#ifdef DEBUGGER -// printf("1f atan!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 1f %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif C41FXVal=READ_WORD(Memory.C4RAM+0x1f80); C41FYVal=READ_WORD(Memory.C4RAM+0x1f83); C4Op1F(); @@ -720,16 +631,8 @@ void S9xSetC4 (uint8 byte, uint16 Address) case 0x22: // Trapezoid { -#ifdef DEBUGGER -// printf("22 Trapezoid!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 22 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif int16 angle1=READ_WORD(Memory.C4RAM+0x1f8c)&0x1ff; int16 angle2=READ_WORD(Memory.C4RAM+0x1f8f)&0x1ff; -#ifdef DEBUGGER - if(C4CosTable[angle1]==0) fprintf(stderr, "22 Trapezoid: Invalid tangent! angle1=%d\n", angle1); - if(C4CosTable[angle2]==0) fprintf(stderr, "22 Trapezoid: Invalid tangent! angle2=%d\n", angle2); -#endif int32 tan1=(C4CosTable[angle1]!=0)?((((int32)C4SinTable[angle1])<<16)/C4CosTable[angle1]):0x80000000; int32 tan2=(C4CosTable[angle2]!=0)?((((int32)C4SinTable[angle2])<<16)/C4CosTable[angle2]):0x80000000; int16 y = READ_WORD(Memory.C4RAM+0x1f83) - READ_WORD(Memory.C4RAM+0x1f89); @@ -776,10 +679,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x25: // Multiply -#ifdef DEBUGGER - printf("25 Multiply!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 25 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif { int32 foo=READ_3WORD(Memory.C4RAM+0x1f80); int32 bar=READ_3WORD(Memory.C4RAM+0x1f83); @@ -789,12 +688,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x2d: // Transform Coords -#ifdef DEBUGGER -// printf("2d Transform Coords!\n"); - if(Memory.C4RAM[0x1f4d]!=2) printf("$7f4d=%02x, expected 02 for command 2d %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); - if(READ_3WORD(Memory.C4RAM+0x1f8f)&0xff00ff) printf("2d transform coords: Unexpected value in $7f8f: %06x\n", READ_3WORD(Memory.C4RAM+0x1f8f)); - if(READ_3WORD(Memory.C4RAM+0x1f8c)!=0x001000) printf("0d transform coords: Unexpected value in $7f8c: %06x\n", READ_3WORD(Memory.C4RAM+0x1f8c)); -#endif C4WFXVal=READ_WORD(Memory.C4RAM+0x1f81); C4WFYVal=READ_WORD(Memory.C4RAM+0x1f84); C4WFZVal=READ_WORD(Memory.C4RAM+0x1f87); @@ -808,10 +701,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x40: // Sum -#ifdef DEBUGGER - printf("40 Sum!\n"); - if(Memory.C4RAM[0x1f4d]!=0x0e) printf("$7f4d=%02x, expected 0e for command 40 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif { uint16 sum=0; for(int i=0; i<0x800; sum+=Memory.C4RAM[i++]); @@ -820,10 +709,6 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x54: // Square -#ifdef DEBUGGER - printf("54 Square!\n"); - if(Memory.C4RAM[0x1f4d]!=0x0e) printf("$7f4d=%02x, expected 0e for command 54 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif { int64 a=SAR((int64)READ_3WORD(Memory.C4RAM+0x1f80)<<40, 40); // printf("%08X%08X\n", (uint32)(a>>32), (uint32)(a&0xFFFFFFFF)); @@ -835,37 +720,21 @@ void S9xSetC4 (uint8 byte, uint16 Address) break; case 0x5c: // Immediate Reg -#ifdef DEBUGGER - printf("5c Immediate Reg!\n"); - if(Memory.C4RAM[0x1f4d]!=0x0e) printf("$7f4d=%02x, expected 0e for command 5c %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif for (i = 0; i < 12 * 4; i++) Memory.C4RAM [i] = C4TestPattern [i]; break; case 0x89: // Immediate ROM -#ifdef DEBUGGER - printf("89 Immediate ROM!\n"); - if(Memory.C4RAM[0x1f4d]!=0x0e) printf("$7f4d=%02x, expected 0e for command 89 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]); -#endif Memory.C4RAM [0x1f80] = 0x36; Memory.C4RAM [0x1f81] = 0x43; Memory.C4RAM [0x1f82] = 0x05; break; default: -#ifdef DEBUGGER - printf ("Unknown C4 command (%02x)\n", byte); -#endif break; } } } else if (Address == 0x7f47) { -#ifdef DEBUGGER -// printf("C4 load memory %06x => %04x, %04x bytes\n", READ_3WORD(Memory.C4RAM+0x1f40), READ_WORD(Memory.C4RAM+0x1f45), READ_WORD(Memory.C4RAM+0x1f43)); - if(byte != 0) printf("C4 load: non-0 written to $7f47! Wrote %02x\n", byte); - if(READ_WORD(Memory.C4RAM+0x1f45) < 0x6000 || (READ_WORD(Memory.C4RAM+0x1f45) + READ_WORD(Memory.C4RAM+0x1f43)) > 0x6c00) printf("C4 load: Dest unusual! It's %04x\n", READ_WORD(Memory.C4RAM+0x1f45)); -#endif memmove(Memory.C4RAM+(READ_WORD(Memory.C4RAM+0x1f45)&0x1fff), C4GetMemPointer(READ_3WORD(Memory.C4RAM+0x1f40)), READ_WORD(Memory.C4RAM+0x1f43)); diff --git a/src/cpuops.cpp b/src/cpuops.cpp index 993087e..ce18e3c 100644 --- a/src/cpuops.cpp +++ b/src/cpuops.cpp @@ -3312,11 +3312,6 @@ static void OpFB (void) /* BRK *************************************************************************************** */
static void Op00 (void)
{
-#ifdef DEBUGGER
- if (CPU.Flags & TRACE_FLAG)
- S9xTraceMessage ("*** BRK");
-#endif
-
#ifndef SA1_OPCODES
CPU.BRKTriggered = TRUE;
#endif
@@ -3374,10 +3369,6 @@ static void Op82 (void) /* IRQ *************************************************************************************** */
void S9xOpcode_IRQ (void)
{
-#ifdef DEBUGGER
- if (CPU.Flags & TRACE_FLAG)
- S9xTraceMessage ("*** IRQ");
-#endif
if (!CheckEmulation())
{
PushB (Registers.PB);
@@ -3442,10 +3433,6 @@ void S9xOpcode_IRQ (void) /* NMI *************************************************************************************** */
void S9xOpcode_NMI (void)
{
-#ifdef DEBUGGER
- if (CPU.Flags & TRACE_FLAG)
- S9xTraceMessage ("*** NMI");
-#endif
if (!CheckEmulation())
{
PushB (Registers.PB);
@@ -3509,10 +3496,6 @@ void S9xOpcode_NMI (void) /* COP *************************************************************************************** */
static void Op02 (void)
{
-#ifdef DEBUGGER
- if (CPU.Flags & TRACE_FLAG)
- S9xTraceMessage ("*** COP");
-#endif
if (!CheckEmulation())
{
PushB (Registers.PB);
diff --git a/src/disk_img.c b/src/disk_img.c deleted file mode 100644 index a8495fd..0000000 --- a/src/disk_img.c +++ /dev/null @@ -1,103 +0,0 @@ -#define DISK_IMG_WIDTH 16 -#define DISK_IMG_HEIGHT 16 - -unsigned short int disk_img[] = { -0x3357, 0x3357, 0x3357, 0x3357, 0x3357, 0x3357, 0x3357, 0x3357, 0x3357, 0x3b77, 0x3b77, -0x3b77, 0x3b57, 0x3b97, 0x3356, 0x0000, 0x3357, 0xd71e, 0xd71e, 0xffdf, 0xf7df, 0xf7df, -0xf7bf, 0xef9f, 0xef9f, 0xf7df, 0xf7df, 0xef9f, 0xdf5f, 0xbe9d, 0x5c59, 0x3356, 0x3357, -0xd6fe, 0x855d, 0xf7df, 0xf7df, 0x6479, 0xef9f, 0xef9f, 0xf7bf, 0xffdf, 0xf7bf, 0xe77f, -0xdf3f, 0xbe9d, 0xbe9d, 0x3b97, 0x3357, 0xd6fe, 0x7d5d, 0xf7bf, 0xf7bf, 0x6479, 0xef9f, -0xefbf, 0xf7df, 0xf7df, 0xef9f, 0xdf5f, 0xdf3e, 0x7d1c, 0xc6bd, 0x3356, 0x3357, 0xcefe, -0x7d5c, 0xef9f, 0xef9f, 0x6479, 0xef9f, 0xf7df, 0xffdf, 0xefbf, 0xdf5f, 0xdf3e, 0xdf3e, -0x7d1c, 0xae1c, 0x3356, 0x3357, 0xcefe, 0x7d3c, 0xe77f, 0xe77f, 0xe77f, 0xefbf, 0xf7df, -0xf7bf, 0xe77f, 0xdf3e, 0xdf3e, 0xdf3e, 0x751b, 0xa5fc, 0x3336, 0x3357, 0xc6de, 0x7d3c, -0x6479, 0x6479, 0x6479, 0x6c99, 0x6c99, 0x6c99, 0x6479, 0x6479, 0x6479, 0x6479, 0x74fb, -0x9ddc, 0x3336, 0x3357, 0xc6de, 0x7d3c, 0x7d1c, 0x7d3c, 0x7d3c, 0x7d1c, 0x7d1c, 0x7d1c, -0x751b, 0x74fb, 0x74fb, 0x74fb, 0x74fb, 0x9dbb, 0x3336, 0x3357, 0xc6be, 0x7d1c, 0x7d1c, -0x7d1c, 0x7d1c, 0x7d3c, 0x7d1c, 0x7d1c, 0x751b, 0x74fb, 0x74fb, 0x74db, 0x74db, 0x959b, -0x3335, 0x3357, 0xbe9e, 0x7d1c, 0x7d1c, 0x7d1c, 0x7d1c, 0x7d1c, 0x7d1c, 0x74fb, 0x74fb, -0x74fb, 0x74db, 0x74db, 0x74da, 0x8d5a, 0x3315, 0x3357, 0xbe9d, 0x7d1c, 0xffdf, 0xffdf, -0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0x6cba, 0x8d3a, 0x3315, -0x3b57, 0xbe7d, 0x7d1c, 0xf7df, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, -0x8e0c, 0xf7df, 0x6c99, 0x8519, 0x3315, 0x3b77, 0xb67d, 0x7d1c, 0xf7df, 0xc6f7, 0xc6f7, -0xc6f7, 0xc6f7, 0xc6f7, 0xc6f7, 0xc6f7, 0xc6f7, 0xf7df, 0x6c99, 0x84f9, 0x3315, 0x3357, -0xb65d, 0x7d1c, 0xf7df, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, 0x8e0c, -0xf7df, 0x6479, 0x7cd9, 0x3314, 0x3357, 0xae3d, 0xae3d, 0xffdf, 0xffdf, 0xffdf, 0xffdf, -0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0xffdf, 0x7cd9, 0x7cd8, 0x3314, 0x3357, 0x3357, -0x3357, 0x3356, 0x3356, 0x3336, 0x3336, 0x3336, 0x3335, 0x3315, 0x3315, 0x3315, 0x3315, -0x3314, 0x3314, 0x3315}; - -void Draw16x16Image(unsigned short *Screen, int x, int y, unsigned short *Img) { - - Screen = &Screen[(320 * y) + x]; - - asm volatile ( - " mov r0, #16 \n" - "1: \n" - #define FN() \ - " ldr r1, [%[image]], #4 \n"\ - " str r1, [%[screen]], #4 \n" - - FN() - FN() - FN() - FN() - FN() - FN() - FN() - FN() - - // Loop - " add %[screen], %[screen], #(640 - (16 * 2)) \n" - " subs r0, r0, #1 \n" - " bne 1b" - // output - : // none - // input - : [screen] "r" (Screen), - [image] "r" (Img) - // clobbered - : "r0", "r1", "cc" // r8 & flags - ); -#undef FN - -} - -void Draw16x16Square(unsigned short *Screen, int x, int y, unsigned char r, unsigned char g, unsigned char b) { - - Screen = &Screen[(320 * y) + x]; - int color = (((((unsigned int )r) * 0x1f) >> 8) << 11) | - (((((unsigned int )g) * 0x3f) >> 8) << 5) | - ((((unsigned int )b) * 0x1f) >> 8); - color = color | (color << 16); - - asm volatile ( - " mov r0, #16 \n" - "1: \n" - #define FN() \ - " str %[color], [%[screen]], #4 \n" - - FN() - FN() - FN() - FN() - FN() - FN() - FN() - FN() - - // Loop - " add %[screen], %[screen], #(640 - (16 * 2)) \n" - " subs r0, r0, #1 \n" - " bne 1b" - // output - : // none - // input - : [screen] "r" (Screen), - [color] "r" (color) - // clobbered - : "r0", "cc" // r8 & flags - ); -#undef FN - -} diff --git a/src/disk_img.h b/src/disk_img.h deleted file mode 100644 index 3095af0..0000000 --- a/src/disk_img.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -extern unsigned short int disk_img[]; -void Draw16x16Image(unsigned short *Screen, int x, int y, unsigned short *Img); -void Draw16x16Square(unsigned short *Screen, int x, int y, unsigned char r, unsigned char g, unsigned char b); - - -#ifdef __cplusplus -} -#endif diff --git a/src/dma.cpp b/src/dma.cpp index 7a6af0f..5773a00 100644 --- a/src/dma.cpp +++ b/src/dma.cpp @@ -305,32 +305,6 @@ void S9xDoDMA (uint8 Channel) }
-#ifdef DEBUGGER
- if (Settings.TraceDMA)
- {
- sprintf (String, "DMA[%d]: %s Mode: %d 0x%02X%04X->0x21%02X Bytes: %d (%s) V-Line:%ld",
- Channel, d->TransferDirection ? "read" : "write",
- d->TransferMode, d->ABank, d->AAddress,
- d->BAddress, d->TransferBytes,
- d->AAddressFixed ? "fixed" :
- (d->AAddressDecrement ? "dec" : "inc"),
- CPU.V_Counter);
- if (d->BAddress == 0x18 || d->BAddress == 0x19)
- sprintf (String, "%s VRAM: %04X (%d,%d) %s", String,
- PPU.VMA.Address,
- PPU.VMA.Increment, PPU.VMA.FullGraphicCount,
- PPU.VMA.High ? "word" : "byte");
- else
- if (d->BAddress == 0x22)
- sprintf (String, "%s CGRAM: %02X (%x)", String, PPU.CGADD,
- PPU.CGFLIP);
- else
- if (d->BAddress == 0x04)
- sprintf (String, "%s OBJADDR: %04X", String, PPU.OAMAddr);
- S9xMessage (S9X_TRACE, S9X_DMA_TRACE, String);
- }
-#endif
-
if (!d->TransferDirection)
{
#ifdef VAR_CYCLES
@@ -585,17 +559,6 @@ void S9xDoDMA (uint8 Channel) count -= 4;
} while (count > 0);
}
- else
- {
-#ifdef DEBUGGER
-// if (Settings.TraceDMA)
- {
- sprintf (String, "Unknown DMA transfer mode: %d on channel %d\n",
- d->TransferMode, Channel);
- S9xMessage (S9X_TRACE, S9X_DMA_TRACE, String);
- }
-#endif
- }
}
else
{
@@ -688,14 +651,6 @@ void S9xDoDMA (uint8 Channel) break;
default:
-#ifdef DEBUGGER
- if (1) //Settings.TraceDMA)
- {
- sprintf (String, "Unknown DMA transfer mode: %d on channel %d\n",
- d->TransferMode, Channel);
- S9xMessage (S9X_TRACE, S9X_DMA_TRACE, String);
- }
-#endif
count = 0;
break;
}
@@ -750,12 +705,6 @@ void S9xStartHDMA () }
}
-#ifdef DEBUGGER
-void S9xTraceSoundDSP (const char *s, int i1 = 0, int i2 = 0, int i3 = 0,
- int i4 = 0, int i5 = 0, int i6 = 0, int i7 = 0);
-#endif
-
-
uint8 S9xDoHDMA (uint8 byte)
{
struct SDMA *p = &DMA [0];
@@ -833,25 +782,6 @@ uint8 S9xDoHDMA (uint8 byte) p->LineCount--;
continue;
}
-
-#ifdef DEBUGGER
- if (Settings.TraceSoundDSP && p->FirstLine &&
- p->BAddress >= 0x40 && p->BAddress <= 0x43)
- S9xTraceSoundDSP ("Spooling data!!!\n");
-
- if (Settings.TraceHDMA && p->FirstLine)
- {
- sprintf (String, "H-DMA[%d] (%d) 0x%02X%04X->0x21%02X %s, Count: %3d, Rep: %s, V-LINE: %3ld %02X%04X",
- p-DMA, p->TransferMode, p->IndirectBank,
- p->IndirectAddress,
- p->BAddress,
- p->HDMAIndirectAddressing ? "ind" : "abs",
- p->LineCount,
- p->Repeat ? "yes" : "no ", CPU.V_Counter,
- p->ABank, p->Address);
- S9xMessage (S9X_TRACE, S9X_HDMA_TRACE, String);
- }
-#endif
switch (p->TransferMode)
{
case 0:
diff --git a/src/soundux.cpp b/src/soundux.cpp index 3af6be4..d4b7cb9 100644 --- a/src/soundux.cpp +++ b/src/soundux.cpp @@ -38,10 +38,6 @@ * Super NES and Super Nintendo Entertainment System are trademarks of
* Nintendo Co., Limited and its subsidiary companies.
*/
-#ifdef __DJGPP__
-#include <allegro.h>
-#undef TRUE
-#endif
#include <stdint.h>
#include <stdlib.h>
diff --git a/src/sys_cacheflush.S b/src/sys_cacheflush.S deleted file mode 100644 index d26f81a..0000000 --- a/src/sys_cacheflush.S +++ /dev/null @@ -1,29 +0,0 @@ -@ vim:filetype=armasm -#include <sys/syscall.h> - - -.global sys_cacheflush @ void *start_addr, void *end_addr - -sys_cacheflush: - mov r2, #0 -#ifdef __ARM_EABI__ - /* EABI version */ - str r7, [sp, #-4]! - mov r7, #(__ARM_NR_cacheflush & 0xff) - orr r7, r7, #(__ARM_NR_cacheflush & 0x00ff00) - orr r7, r7, #(__ARM_NR_cacheflush & 0xff0000) - swi 0 - ldr r7, [sp], #4 -#else - /* OABI */ - swi __ARM_NR_cacheflush -#endif - bx lr - -.global spend_cycles -spend_cycles: - mov r0,r0,lsr #2 - 0:subs r0, r0, #1 - bne 0b - bx lr - diff --git a/src/sys_cacheflush.h b/src/sys_cacheflush.h deleted file mode 100644 index c18e312..0000000 --- a/src/sys_cacheflush.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _WIZ_CACHEFLUSH - -#ifdef __cplusplus -extern "C" { -#endif - -extern void sys_cacheflush(void *start_addr, void *end_addr); - -extern void spend_cycles(int c);
- -#ifdef __cplusplus -} /* End of extern "C" */ -#endif - -#endif diff --git a/src/warm.cpp b/src/warm.cpp deleted file mode 100644 index fa38b6e..0000000 --- a/src/warm.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* - * wARM - exporting ARM processor specific privileged services to userspace - * userspace part - * - * Copyright (c) Gražvydas "notaz" Ignotas, 2009 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <sys/utsname.h> -#include <errno.h> - -#define WARM_CODE -#include "warm.h" -#include "sys_cacheflush.h" - -static int warm_fd = -1; - -int warm_init(void) -{ - struct utsname unm; - char buff[128]; - - warm_fd = open("/proc/warm", O_RDWR); - if (warm_fd >= 0) - return 0; - - memset(&unm, 0, sizeof(unm)); - uname(&unm); - snprintf(buff, sizeof(buff), "/sbin/insmod warm_%s.ko", unm.release); - - /* try to insmod */ - system(buff); - warm_fd = open("/proc/warm", O_RDWR); - if (warm_fd >= 0) - return 0; - - fprintf(stderr, "wARM: can't init, acting as sys_cacheflush wrapper\n"); - return -1; -} - -void warm_finish(void) -{ - if (warm_fd >= 0) - close(warm_fd); - system("rmmod warm"); -} - -/* -int warm_cache_op_range(int op, void *addr, unsigned long size) -{ - struct warm_cache_op wop; - int ret; - - if (warm_fd < 0) { - sys_cacheflush(addr, (char *)addr + size); - return -1; - } - - wop.ops = op; - wop.addr = (unsigned long)addr; - wop.size = size; - - ret = ioctl(warm_fd, WARMC_CACHE_OP, &wop); - if (ret != 0) { - perror("WARMC_CACHE_OP failed"); - return -1; - } - - return 0; -} - -int warm_cache_op_all(int op) -{ - return warm_cache_op_range(op, NULL, (size_t)-1); -} -*/ - -int warm_change_cb_range(int cb, int is_set, void *addr, unsigned long size) -{ - struct warm_change_cb ccb; - int ret; - - if (warm_fd < 0) - return -1; - - ccb.addr = (unsigned long)addr; - ccb.size = size; - ccb.cb = cb; - ccb.is_set = is_set; - - ret = ioctl(warm_fd, WARMC_CHANGE_CB, &ccb); - if (ret != 0) { - perror("WARMC_CHANGE_CB failed"); - return -1; - } - - return 0; -} - -int warm_change_cb_upper(int cb, int is_set) -{ - return warm_change_cb_range(cb, is_set, 0, 0); -} - -unsigned long warm_virt2phys(const void *ptr) -{ - unsigned long ptrio; - int ret; - - ptrio = (unsigned long)ptr; - ret = ioctl(warm_fd, WARMC_VIRT2PHYS, &ptrio); - if (ret != 0) { - perror("WARMC_VIRT2PHYS failed"); - return (unsigned long)-1; - } - - return ptrio; -} - diff --git a/src/warm.h b/src/warm.h deleted file mode 100644 index a3fdd6b..0000000 --- a/src/warm.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * wARM - exporting ARM processor specific privileged services to userspace - * library functions - * - * Copyright (c) Gražvydas "notaz" Ignotas, 2009 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef __WARM_H__ -#define __WARM_H__ 1 - -/* cache operations (warm_cache_op_*): - * o clean - write dirty data to memory, but also leave in cache. - * o invalidate - throw away everything in cache, losing dirty data. - * - * Write buffer is always drained, no ops will only drain WB - */ -#define WOP_D_CLEAN (1 << 0) -#define WOP_D_INVALIDATE (1 << 1) -#define WOP_I_INVALIDATE (1 << 2) - -/* change C and B bits (warm_change_cb_*) - * if is_set in not zero, bits are set, else cleared. - * the address for range function is virtual address. - */ -#define WCB_C_BIT (1 << 0) -#define WCB_B_BIT (1 << 1) - -#ifndef __ASSEMBLER__ - -#ifdef __cplusplus -extern "C" -{ -#endif - -int warm_init(void); - -int warm_cache_op_range(int ops, void *virt_addr, unsigned long size); -int warm_cache_op_all(int ops); - -int warm_change_cb_upper(int cb, int is_set); -int warm_change_cb_range(int cb, int is_set, void *virt_addr, unsigned long size); - -unsigned long warm_virt2phys(const void *ptr); - -void warm_finish(void); - -#ifdef __cplusplus -} -#endif - -/* internal */ -#ifdef WARM_CODE - -#include <linux/ioctl.h> - -#define WARM_IOCTL_BASE 'A' - -struct warm_cache_op -{ - unsigned long addr; - unsigned long size; - int ops; -}; - -struct warm_change_cb -{ - unsigned long addr; - unsigned long size; - int cb; - int is_set; -}; - -#define WARMC_CACHE_OP _IOW(WARM_IOCTL_BASE, 0, struct warm_cache_op) -#define WARMC_CHANGE_CB _IOW(WARM_IOCTL_BASE, 1, struct warm_change_cb) -#define WARMC_VIRT2PHYS _IOWR(WARM_IOCTL_BASE, 2, unsigned long) - -#endif /* WARM_CODE */ -#endif /* !__ASSEMBLER__ */ -#endif /* __WARM_H__ */ |