nesdev.com
https://forums.nesdev.com/

What is WRONG with my PPU???
https://forums.nesdev.com/viewtopic.php?f=3&t=3585
Page 3 of 3

Author:  Disch [ Sat Sep 22, 2007 4:56 pm ]
Post subject: 

NerveGas wrote:
- Rad Racer 2 has a completely mangled background


Rad Racer 2 uses 4-screen mirroring. But ROMs floating around don't mark that in the header.

Try flipping that bit in the header on and see if it works.

Author:  NerveGas [ Sat Sep 22, 2007 5:01 pm ]
Post subject: 

nope something else is hosey.

mmc3 doesn't serve out of video ram right? that's just map 119?

Author:  hap [ Sun Sep 23, 2007 2:42 am ]
Post subject: 

NerveGas wrote:
nope something else is hosey.
Does Gauntlet (1) work then? If it doesn't, you've probably got a bug in your 4-screen-mirroring handling.

Quote:
mmc3 doesn't serve out of video ram right? that's just map 119?
some games, like Megaman 4.

Author:  NerveGas [ Mon Sep 24, 2007 5:30 am ]
Post subject: 

I was wrong, it looks like four-screen mirroring was set, but the mirror "type" was set to vertical. When I force it to four-screen it works fine.

I'm very close to getting Rad Racer 2 working. There's one scanline in the middle of my screen that is orange (presumably the background) and I'm wondering where it's coming from. These are my increments below... is there anything I'm missing?


Top of scanline:

Code:
    if (S.PPU_R1 & R1_SHOW_SCR)
          S.vAddr = S.vAddr_Latch & 0x7FFF;


Between scanlines:

Code:
    /* Veritcal Increment */
    S.vAddr = (S.vAddr + 0x1000) & 0x7FFF;
    if ((S.vAddr & 0x7000) == 0)
    {
        S.vAddr = (S.vAddr & 0x7C1F) | ((S.vAddr + 0x20) & 0x3E0);
        if ((S.vAddr & 0x3E0) == 0x3C0)
            S.vAddr = ((S.vAddr & 0x7C1F) ^ 0x800);
    }

    /* Horizontal Reset: PPU 257 */
    S.vAddr = (S.vAddr & 0xFBE0) | (S.vAddr_Latch & 0x41F);


Registers:

Code:
        case 0x2006: /* VRAM Address Register */   
          if (S.PPU_Latch_Flag) {
             S.vAddr_Latch = (S.vAddr_Latch & 0xFF00) | bData;
             S.vAddr = S.vAddr_Latch;
          }       
          else { 
             S.vAddr_Latch = ((bData & 0x3F) << 8) | (S.vAddr_Latch & 0xFF);
          }   
          S.PPU_Latch_Flag ^= 1;                   
          break;     


        {
            case (0x2007): /* VRAM Read */
                if (S.vAddr <0x3F00) {
                    wScratch = S.vAddr;
                    wScratch &= 0x3FFF;
                    bScratch = S.PPU_R7;
                    S.PPU_R7 = W.PPUBANK[ wScratch >> 10 ][ wScratch & 0x3FF ];
                } else {
                    bScratch = W.PPUBANK[ wScratch >> 10 ] [ wScratch & 0x3FF ];
                }

                S.vAddr += (S.PPU_R0 & R0_INC_ADDR) ? 0x20 : 0x01;
                S.vAddr &= 0x3FFF;

                return bScratch;
                break;


        case 0x2000: /* PPU Control Register 1 Write */
          S.PPU_R0 = bData;
          S.PPU_SP_Height = (S.PPU_R0 & R0_SP_SIZE) ? 0x10 : 0x08;
          W.PPU_BG = (S.PPU_R0 & R0_BG_ADDR) ? S.ChrBuf + 0x4000 : S.ChrBuf;
          W.PPU_SP = (S.PPU_R0 & R0_SP_ADDR) ? S.ChrBuf + 0x4000 : S.ChrBuf;
          S.vAddr_Latch = (S.vAddr_Latch & 0xF3FF) | ((word) (bData & 3) << 10);
          break;


        case 0x2005: /* Scroll Register */
          lowerBits = (bData & 7);
          upperBits = (bData >> 3);

          if (S.PPU_Latch_Flag) {
             S.vAddr_Latch = (S.vAddr_Latch & 0x8C1F) | (upperBits << 5) |
                (lowerBits << 12);
          }
          else {
             S.vAddr_Latch = (S.vAddr_Latch & 0xFFE0) | upperBits;
             S.FineX = lowerBits;
          }

          S.PPU_Latch_Flag ^= 1;
          break;


        case 0x2007: /* VRAM Data */
        {
            wScratch = S.vAddr;
            wScratch &= 0x3FFF;

            S.vAddr += (S.PPU_R0 & R0_INC_ADDR) ? 0x20 : 0x01;
            if (S.vAddr > 0x3FFF)
                S.vAddr &= 0x3FFF;



[/code]

Page 3 of 3 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/