mmc5 - fix oldppu 2007 reads, and tidy

This commit is contained in:
zeromus 2017-04-30 00:16:33 +00:00
parent 9f104fc38c
commit a57d8b9583
2 changed files with 16 additions and 11 deletions

View File

@ -119,7 +119,7 @@ uint8* MMC5BGVRAMADR(uint32 A)
{
if(Sprite16)
{
bool isPattern = PPUON;
bool isPattern = !!PPUON;
if (ppuphase == PPUPHASE_OBJ && isPattern)
return &ABANKS[(A) >> 10][(A)];
if (ppuphase == PPUPHASE_BG && isPattern)
@ -129,7 +129,7 @@ uint8* MMC5BGVRAMADR(uint32 A)
else
return &BBANKS[(A) >> 10][(A)];
}
else return &ABANKS[(A) >> 10][(A)];;
else return &ABANKS[(A) >> 10][(A)];
}
static void mmc5_PPUWrite(uint32 A, uint8 V) {
@ -177,7 +177,7 @@ uint8 FASTCALL mmc5_PPURead(uint32 A)
{
if(Sprite16)
{
bool isPattern = PPUON;
bool isPattern = !!PPUON;
if (ppuphase == PPUPHASE_OBJ && isPattern)
return ABANKS[(A) >> 10][(A)];
if (ppuphase == PPUPHASE_BG && isPattern)
@ -242,15 +242,11 @@ uint8 FASTCALL mmc5_PPURead(uint32 A)
if((A&0x3FF)>=0x3C0)
{
uint8 byte = ExRAM[NTRefreshAddr & 0x3ff];
//get attribute part
//get attribute part and paste it 4x across the byte
byte >>= 6;
//adjust it to the right position within the byte
int x = NTRefreshAddr&31;
int y = NTRefreshAddr>>5;
if(y&2) byte <<= 4;
if(x&2) byte <<= 2;
byte *= 0x55;
return byte;
}
}
}
return vnapage[(A >> 10) & 0x3][A & 0x3FF];

View File

@ -706,6 +706,8 @@ static DECLFR(A2007) {
RefreshAddr = ppur.get_2007access();
return ret;
} else {
//OLDPPU
FCEUPPU_LineUpdate();
if (tmp >= 0x3F00) { // Palette RAM tied directly to the output data, without VRAM buffer
@ -735,9 +737,16 @@ static DECLFR(A2007) {
if (PPU_hook) PPU_hook(tmp);
PPUGenLatch = VRAMBuffer;
if (tmp < 0x2000) {
if (debug_loggingCD)
LogAddress = GetCHRAddress(tmp);
VRAMBuffer = VPage[tmp >> 10][tmp];
if(MMC5Hack)
{
//probably wrong CD logging in this case...
VRAMBuffer = *MMC5BGVRAMADR(tmp);
}
else VRAMBuffer = VPage[tmp >> 10][tmp];
} else if (tmp < 0x3F00)
VRAMBuffer = vnapage[(tmp >> 10) & 0x3][tmp & 0x3FF];
}