did I miss something?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
User avatar
Roni
Posts: 114
Joined: Fri Sep 26, 2008 7:55 pm
Location: Montreal
Contact:

did I miss something?

Post by Roni »

I figure this is one of those questions that may or not be mentioned in the Wiki or the messageboards but is obscure enough to come out and ask. can I read the PPU pallette? I thought it was possible, but it seems this block of code

Code: Select all


	lda	$2002
	lda	#$3F
	sta	$2006
	ldx	#$01
	stx	$2006
	
	ldx	$2007
	ldx	$2007
	inx
	stx	$2007
has no effect on x. unless it's got something to do with the x register or my emulator (FCEUXd 1.0), am I correct in assuming that it's the palette region of the NES PPU that just can't be read?
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

Well I think you can read the palette, but that reads are NOT delayed like VRAM reads. I'm not exactly sure tough.
This code would have the effect to make palette color [3] = color [2] +1
Useless, lumbering half-wits don't scare us.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

+1 to what Bregalad said.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

What they said. While other parts of VRAM need two read instructions before the first byte of actual data is returned, the palette area doesn't have this delay.

Also, be sure to use more than one emulator to test your programs, specially when this one emulator is not particularly known for its accuracy.
User avatar
Roni
Posts: 114
Joined: Fri Sep 26, 2008 7:55 pm
Location: Montreal
Contact:

Post by Roni »

Got it. the Emulator was the problem affter all. I noticed after I ran the program in FCEUX 2.1.1

could it also have something to do with the mapper (ines 002) that I'm using, or the way the emulator handles it?
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Roni wrote:could it also have something to do with the mapper (ines 002) that I'm using, or the way the emulator handles it?
Not at all, mapper 2 is one of the simplest mappers around, and its functions have nothing to do with the video hardware (except for the fact that it uses CHR-RAM, but that's completely unrelated).

This is just how palette RAM works. Palette RAM stays inside the PPU chip (unlike the pattern, name and attribute tables), so maybe it can retrieve that data faster than data from other parts of video memory.
User avatar
Roni
Posts: 114
Joined: Fri Sep 26, 2008 7:55 pm
Location: Montreal
Contact:

Post by Roni »

tokumaru wrote:Palette RAM stays inside the PPU chip (unlike the pattern, name and attribute tables), so maybe it can retrieve that data faster than data from other parts of video memory.
I thought the nametable and attribute table as well as palette were stored in the PPU's internal RAM...if not then where are they held?
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Post by Bregalad »

There is no such a thing as PPU internal RAM. The RAM for nametable is a separate 2k chip inside the NES, and CHR-ROM or CHR-RAM is on cartridge (yeah technically the 2k chip inside the NES could also be used as CHR-RAM, as the cartridge can control it's higher adress line and enable line) but I don't think anyone ever did that.

The confusion comes because so many people here (as well as FCEU and Nintendulator emulators) MISTAKENLY call pattern table and name table RAM "PPU RAM" when this is a completely wrong name - the correct name should be VRAM (Video RAM), or "WRAM-that-is-acceded-by-the-PPU" (which sounds too long to me).

The only "RAM" that is inside the PPU is palette and OAM memory, and both of those are typically stored somewhere in RAM and transfered to the PPU every VBlank.
Useless, lumbering half-wits don't scare us.
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

har har
Bregalad wrote:There is no such a thing as PPU internal RAM.
[snip]
The only "RAM" that is inside the PPU is palette and OAM memory
=P
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Roni wrote:I thought the nametable and attribute table as well as palette were stored in the PPU's internal RAM...if not then where are they held?
If you look at the mainboard of a NES you'll see two 2KB RAM chips: one is the work RAM and the other is for the name and attribute tables. Even though that memory is only accessible by the PPU, it's not internal to the PPU (just like work RAM isn't internal to the CPU either).
Post Reply