PPU RAM not including cartridge
Moderator: Moderators
- battagline
- Posts: 152
- Joined: Wed Sep 05, 2018 11:13 am
- Location: Colorado
- Contact:
PPU RAM not including cartridge
I've been looking through the PPU documentation and I'm trying to figure out how much Memory the PPU has if you don't add any additional memory that it uses on the cartridge.
I know it can address 16K. If you remove the space dedicated to mirrors from the PPU Memory map it looks like it has about 12K of memory, but I seem to recall having read on one of the pages that the NES has 10K of PPU memory.
Would someone mind setting me straight?
Thanks
I know it can address 16K. If you remove the space dedicated to mirrors from the PPU Memory map it looks like it has about 12K of memory, but I seem to recall having read on one of the pages that the NES has 10K of PPU memory.
Would someone mind setting me straight?
Thanks
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
Re: PPU RAM not including cartridge
If there isn't CHR-RAM on the cartridge, and there's no CHR-ROM on the cartridge, then your pattern table (PPU $0000-1FFF) will be most likely gibberish/trash/gobbledegook.
Otherwise, the NES *natively* has memory for two nametables (1024 bytes each, which includes the attribute table), 16 bytes for palette, and an internal 256 bytes for OAM. (1024*2)+16+256 = $910 = 2320 bytes. This does not include internal buffers (say, a couple bytes) for latches and whatever else.
https://wiki.nesdev.com/w/index.php/PPU_memory_map is pretty clear (bottom part of the page).
I'm wondering why you're wondering this?
Edit: add mention of attribute tables.
Otherwise, the NES *natively* has memory for two nametables (1024 bytes each, which includes the attribute table), 16 bytes for palette, and an internal 256 bytes for OAM. (1024*2)+16+256 = $910 = 2320 bytes. This does not include internal buffers (say, a couple bytes) for latches and whatever else.
https://wiki.nesdev.com/w/index.php/PPU_memory_map is pretty clear (bottom part of the page).
I'm wondering why you're wondering this?
Edit: add mention of attribute tables.
Last edited by koitsu on Wed Nov 14, 2018 9:46 pm, edited 1 time in total.
Re: PPU RAM not including cartridge
If the cartridge provides no memory, the PPU is limited to 2 KiB (apart from OAM for sprite positions and CGRAM for palette). The only game I know of that's designed for this configuration (mapper 218) is nocash's Magic Floor, which allocates 1 KiB for a single nametable (single-screen mirroring) and 1 KiB for a 64-tile pattern table at $0000-$03FF (mirrored to $0400-$1FFF).
The 10 KiB figure probably comes from the smallest practical CHR ROM or CHR RAM on the cartridge (8 KiB) plus using the 2 KiB of PPU memory in the Control Deck for two nametables.
The 10 KiB figure probably comes from the smallest practical CHR ROM or CHR RAM on the cartridge (8 KiB) plus using the 2 KiB of PPU memory in the Control Deck for two nametables.
Re: PPU RAM not including cartridge
Yeah, there's no way to produce real NES graphics without *something* inserted into the cartridge slot. In order to use the the internal VRAM for patterns, you need to some pins in the cartridge port connected together.koitsu wrote:If there isn't CHR-RAM on the cartridge, and there's no CHR-ROM on the cartridge, then your pattern table (PPU $0000-1FFF) will be most likely gibberish/trash/gobbledegook.
Just to be a little pedantic: The palette actually has 28 physical entries (16 for the background, out of which only 13 are normally displayable, and 12 for sprites), but AFAIK the PPU doesn't store the upper 2 bits of a color entry (NES colors are only 6 bits after all), so the palette is more like 168 bits, the equivalent to 21 bytes. The same goes for the OAM: unimplemented bits in the sprite attribute byte are not kept, so the OAM is actually 1856 bits, the equivalent to 232 bytes. And there's more memory worth of other stuff we don't have direct access to, like secondary OAM, which the wiki says is 32 bytes.Otherwise, the NES *natively* has memory for two nametables (1024 bytes each, which includes the attribute table), 16 bytes for palette, and an internal 256 bytes for OAM. (1024*2)+16+256 = $910 = 2320 bytes. This does not include internal buffers (say, a couple bytes) for latches and whatever else.
Anyway, while 2KB of VRAM sounds really pitiful compared to the 10KB the NES normally has access to, I still think it's a fun setup to develop simpler games for. If you use 1KB for the background, you get 1KB for patterns, enough for 64 tiles, shared between sprites and the background. If you dynamically allocate tiles for active sprites and animate them by rewriting their patterns, and keep the backgrounds simple, it might be possible to make a game that doesn't feel too far off from earlier NES titles. You could also sacrifice some screen space in the single name table you have in order to get some extra tiles, depending on the kind of scrolling you're doing.
- rainwarrior
- Posts: 8734
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: PPU RAM not including cartridge
Aside from the question of what goes into a cartridge...
Under most circumstances, if you put 0 in the CHR size field in the iNES header, you get 8k of CHR-RAM for just the pattern tables.
The nametables and palette are separate internal RAM. (2k nametable + 32 more bytes for palette.)
There are exceptions to this, and there's the iNES 2 thing that lets you specify CHR-RAM of any size, but that's the basic case.
Under most circumstances, if you put 0 in the CHR size field in the iNES header, you get 8k of CHR-RAM for just the pattern tables.
The nametables and palette are separate internal RAM. (2k nametable + 32 more bytes for palette.)
There are exceptions to this, and there's the iNES 2 thing that lets you specify CHR-RAM of any size, but that's the basic case.
Re: PPU RAM not including cartridge
The PPU has memory for OAM and the palettes. That's 256 bytes andbattagline wrote:I've been looking through the PPU documentation and I'm trying to figure out how much Memory the PPU has if you don't add any additional memory that it uses on the cartridge.
The console has a 2k generic SRAM chip that the cartridge can use as VRAM anywhere in the PPU adress range. This chips is NOT part of the PPU itself. 99% of the time it is used at $2000-$3fff for name/attribute tables. Even though the chip is inside the console, it's control lines from the cartridges that determines how this chip is used.
Last edited by Bregalad on Thu Nov 15, 2018 1:22 am, edited 3 times in total.
Re: PPU RAM not including cartridge
Addressing this, specifically:
However, the cartridge connector on the NES is versatile enough that you can tweak the PPU memory mapping quite a bit. You can redirect pattern table access back to the console's built-in RAM, you can redirect name table access to the cartridge, you can map cartridge RAM/ROM to the entire $2000-$3F00 range in multiple configurations, including bankswitching, and even have the NES make do with just the internal 2KB, like mentioned in previous posts.
One thing to keep in mind is that even though the PPU can see almost 16KB of external memory at a time (i.e. ignoring bankswitching), only the lower 12KB are used by the PPU to generate a picture. The PPU itself doesn't do anything with whatever is mapped to $3000-$3FFF. If you have RAM there, great, you can write to it, read from it, but the PPU will not use that data for anything.
You're right, the PPU can address 16KB of external memory (minus the 256 bytes in the $3F00-$3FFF range, which is used to access the internal palette RAM). The NES itself only has 2KB of VRAM built-in, which are normally used for name tables, mapped to the upper half of the PPU's address space (the 2KB are mirrored to fill the 8KB space). Cartridges are responsible for filling the bottom half with patterns. That's 10KB of video memory, the most common setup.battagline wrote:I know it can address 16K. If you remove the space dedicated to mirrors from the PPU Memory map it looks like it has about 12K of memory, but I seem to recall having read on one of the pages that the NES has 10K of PPU memory.
However, the cartridge connector on the NES is versatile enough that you can tweak the PPU memory mapping quite a bit. You can redirect pattern table access back to the console's built-in RAM, you can redirect name table access to the cartridge, you can map cartridge RAM/ROM to the entire $2000-$3F00 range in multiple configurations, including bankswitching, and even have the NES make do with just the internal 2KB, like mentioned in previous posts.
One thing to keep in mind is that even though the PPU can see almost 16KB of external memory at a time (i.e. ignoring bankswitching), only the lower 12KB are used by the PPU to generate a picture. The PPU itself doesn't do anything with whatever is mapped to $3000-$3FFF. If you have RAM there, great, you can write to it, read from it, but the PPU will not use that data for anything.
- battagline
- Posts: 152
- Joined: Wed Sep 05, 2018 11:13 am
- Location: Colorado
- Contact:
Re: PPU RAM not including cartridge
Ok, so to make sure I understand, the bottom 8K (Pattern Table) is basically the CHR ROM chip that's on the cartridge.
The 2K of PPU RAM is used for 2 Nametables that are either horizontally or vertically mirrored.
That's a total of 10K
So where does the sprite data from the DMA go? Does it get copied into somewhere in the PPU's memory space?
Also, are the 32 bytes of palette data, is that on a separate chip somewhere or is the amout of RAM actually 2K + 32 bytes?
Thanks for the help
The 2K of PPU RAM is used for 2 Nametables that are either horizontally or vertically mirrored.
That's a total of 10K
So where does the sprite data from the DMA go? Does it get copied into somewhere in the PPU's memory space?
Also, are the 32 bytes of palette data, is that on a separate chip somewhere or is the amout of RAM actually 2K + 32 bytes?
Thanks for the help
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
Re: PPU RAM not including cartridge
OAM and palette memory are internal to the PPU. The palette is mapped into the same address space as name tables and pattern tables, but it is not the same physical memory. OAM has its own address space, which is why OAMADDR exists.
Re: PPU RAM not including cartridge
Both Koitsu and I mentioned palette and OAM already, I guess you weren't paying attention. Like I said before, even though palette RAM maps to a 32-byte range of memory ($3F00-$3F1F), there are only 28 physical palette entries inside the PPU (color 0 inesch of the 4 sprite palettes are mirrors of the respective color 0 in the background palettes). Also, since each bit of memory adds to the cost, the PPU doesn't store unused bits, so it only holds 6 bits per color, not a full byte.
- battagline
- Posts: 152
- Joined: Wed Sep 05, 2018 11:13 am
- Location: Colorado
- Contact:
Re: PPU RAM not including cartridge
I'm always paying attention. I'm just a little slow, so I don't always understand everythingtokumaru wrote:I guess you weren't paying attention.
Anyway, I'm not trying to annoy you. I really do appreciate the help.
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
Re: PPU RAM not including cartridge
I didn't mean to be rude, it's just that you did ask something that had already been answered.
- battagline
- Posts: 152
- Joined: Wed Sep 05, 2018 11:13 am
- Location: Colorado
- Contact:
Re: PPU RAM not including cartridge
I know... sometimes I read through the responses and I don't pick up on everything mentioned.tokumaru wrote:I didn't mean to be rude, it's just that you did ask something that had already been answered.
What usually happens is I read, then I ponder, then I think of new questions. I probably should have a re-read step because this happens more often than it should. Sometimes you guys answer more questions than I ask, and if my mind isn't ready for that question at the time I read it, it just kind of goes over my head. If I re-read everything a second time, I would probably do a lot better at this.
Anyway, this community has been great and I'm sorry if I sometimes ask questions that have already been answered.
Thanks again,
Rick
A few of my web games
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
https://www.embed.com
Or if you're bored at work
https://www.classicsolitaire.com
Re: PPU RAM not including cartridge
I mentionned it too, so you're not paying attention either :ptokumaru wrote:Both Koitsu and I mentioned palette and OAM already, I guess you weren't paying attention.