X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=fceu.git;a=blobdiff_plain;f=ppu098.c;h=023975b7723363674c66d3a584f54ca68d06b1e7;hp=62f78c5e04dc75fdaee0cfe385e535fd507bbfaf;hb=cd9a6b519c9c465d6781d4a6636d715542e6e0f6;hpb=6244011fd85a10400accd6d8e7d941144f92aa5b diff --git a/ppu098.c b/ppu098.c index 62f78c5..023975b 100644 --- a/ppu098.c +++ b/ppu098.c @@ -26,7 +26,7 @@ #include "fce.h" #include "ppu098.h" #include "nsf.h" -#include "sound.h" // TODO 098? +#include "sound.h" #include "memory.h" #include "cart.h" @@ -34,6 +34,10 @@ #include "video.h" #include "input.h" +#ifdef GP2X +#include "drivers/gp2x/asmutils.h" +#endif + #define Pal (PALRAM) static void FetchSpriteData098(void); @@ -82,8 +86,7 @@ static void makeppulut(void) } } -// TODO: make this compatible with the new sound code -#ifdef ASM_6502 +#if defined(ASM_6502) && !defined(DEBUG_ASM_6502) static void asmcpu_update(int32 cycles) { // some code from x6502.c @@ -216,7 +219,7 @@ static DECLFW(B2000) { // FCEU_printf("Trigger NMI, %d, %d\n",timestamp,ppudead); // TriggerNMI2(); - TriggerNMI(); + TriggerNMI(); // TODO? } PPU[0]=V; TempAddr&=0xF3FF; @@ -361,7 +364,7 @@ static int tofix=0; static void ResetRL(uint8 *target) { - memset(target,0xFF,256); + FCEU_dwmemset(target,0xffffffff,256); if(InputScanlineHook) InputScanlineHook(0,0,0,0); Plinef=target; @@ -692,7 +695,9 @@ static void Fixit1(void) void MMC5_hb(int); /* Ugh ugh ugh. */ static void DoLine(void) { +#ifndef GP2X int x; +#endif uint8 *target=XBuf+scanline*320+32; if(MMC5Hack && (ScreenON || SpriteON)) MMC5_hb(scanline); @@ -711,6 +716,19 @@ static void DoLine(void) if(SpriteON) CopySprites098(target); +#ifdef GP2X + if(ScreenON || SpriteON) // Yes, very el-cheapo. + { + if(PPU[1]&0x01) + block_and(target, 256, 0x30); + } + if((PPU[1]>>5)==0x7) + block_or(target, 256, 0xc0); + else if(PPU[1]&0xE0) + block_or(target, 256, 0x40); + else + block_andor(target, 256, 0x3f, 0x80); +#else if(ScreenON || SpriteON) // Yes, very el-cheapo. { if(PPU[1]&0x01) @@ -730,6 +748,7 @@ static void DoLine(void) else for(x=63;x>=0;x--) *(uint32 *)&target[x<<2]=((*(uint32*)&target[x<<2])&0x3f3f3f3f)|0x80808080; +#endif sphitx=0x100; @@ -1193,7 +1212,10 @@ void FCEUPPU_Loop(int skip) if(ppudead) /* Needed for Knight Rider, possibly others. */ { //memset(XBuf, 0x80, 256*240); - X6502_Run(scanlines_per_frame*(256+85)); + //X6502_Run(scanlines_per_frame*(256+85)); + int lines; + for (lines=scanlines_per_frame;lines;lines--) + X6502_Run(256+85); ppudead--; } else @@ -1215,7 +1237,13 @@ void FCEUPPU_Loop(int skip) if(VBlankON) TriggerNMI(); } - X6502_Run((scanlines_per_frame-242)*(256+85)-12); //-12); + // Note: this is needed for asm core + { + int lines; + X6502_Run(256+85-12); + for (lines=scanlines_per_frame-242-1;lines;lines--) + X6502_Run(256+85); + } PPU_status&=0x1f; X6502_Run(256); @@ -1247,12 +1275,14 @@ void FCEUPPU_Loop(int skip) } if(FCEUGameInfo.type==GIT_NSF) { - X6502_Run((256+85)*240); + // run scanlines for asm core to fuction + for(scanline=0;scanline<240;scanline++) + X6502_Run(256+85); } #ifdef FRAMESKIP else if(skip) { - int y; + int y, lines; y=SPRAM[0]; y++; @@ -1271,12 +1301,17 @@ void FCEUPPU_Loop(int skip) } else if(y<240) { - X6502_Run((256+85)*y); + for (lines=y;lines;lines--) + X6502_Run(256+85); if(SpriteON) PPU_status|=0x40; // Quick and very dirty hack. - X6502_Run((256+85)*(240-y)); + for (lines=240-y;lines;lines--) + X6502_Run(256+85); } else - X6502_Run((256+85)*240); + { + for (lines=240;lines;lines--) + X6502_Run(256+85); + } } #endif else