It is currently Thu Dec 14, 2017 11:44 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: A question about the PPU
PostPosted: Mon Aug 29, 2005 7:23 pm 
Offline

Joined: Mon Jan 10, 2005 7:57 pm
Posts: 12
Location: Kentucky
I'm not sure exactly how to describe this but here goes. I'm working on translating a game (well, it's already translated, I'm just adding the final touches on the "hacking" side) and there's an issue with a certain string of text.

Now, the 1K of VROM that contains the number tiles (0-9) (I'll call this chip A) is swapped in and out with another 1K of VROM that contains other graphics (chip B) that needed to be displayed on-screen. Thing is, for some reason, the right 1K of VROM (chip A) is loaded into Pattern Table #1 where it's supposed to be while the vram-write routine is writing the numbered tile's data to vram. But, here's the problem, once the screen refreshes it isn't the tile that was on chip A that gets displayed, but the one chip B. It *is* the right tile number and all; it's just the wrong chip that it's getting it from.

I'm not sure why this is. I'm thinking it have something to do with how the PPU refreshes, but I'm not sure as I've never really studied the PPU beyond basic function. If someone could maybe shed some light on this, I'd be most appreciative. The game uses Mapper #16, by the way.

Thanks. :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 10:13 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1393
The PPU fetches the tile data as it renders - if you want a particular graphics bank to be used for a specific section of the screen, then you must swap it in (and out) mid-screen, using sprite 0 hit or IRQ timers (or a cycle-timed wait) to determine exactly when to do the switch.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 8:44 am 
And that happens during VBlank, right?


Top
  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 8:45 am 
Offline

Joined: Mon Jan 10, 2005 7:57 pm
Posts: 12
Location: Kentucky
That's me up there; I forgot to sign-in.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 8:52 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
"as it renders" means as it renders. Games often swap out CHR mid-frame (ie: not in vblank) to allow for more available graphics.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 8:53 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1393
The PPU does nothing during VBLANK - rendering is done, by definition, during the RENDERING time (i.e. during all 240 VISIBLE scanlines).

Also, the PPU is in no way aware of whatever bankswitching you may be doing in the mapper, and most mappers are likewise unaware of what area of the screen the PPU is currently rendering (the only known exception is the MMC5). Just because you wrote to your nametables with one CHR bank selected does NOT mean that the mapper will magically swap in that CHR bank when that section is rendered - it uses whichever one you selected most recently, meaning if you want to change banks mid-screen you have to do it manually.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 2:57 pm 
Ok. How do I know which scanline is being rendered?

(Sorry for the dumb questions. :p)


Top
  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 3:27 pm 
Online
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3487
Location: Indianapolis
The program has to time it. Either with delay loops, or a mapper's scanline counter. For example, you can write 88 to the mapper's register, and it'll interrupt the program after 88 scanlines have passed. Then you could switch the CHR bank in the IRQ routine.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 3:31 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
The following is meant to be humorous, please take no offense :).

Bob is walking from his house to the shop, which is 5 blocks away. He can walk one block in two minutes. He leaves and begins walking the first block. He reaches the second block at two minutes, the third at four minutes, etc. During the first two minutes, his feet touch the sidewalk of the first block. During the second two minutes, his feet touch the sidewalk of the second block.

Q: When are his feet touching the sidewalk of the fourth block?
A: During minutes 7 and 8.

Q: If I'm simulating Bob walking to the shop, when are his simulated feet touching the simulated sidewalk of the fourth block?
A: During simulated minutes 7 and 8.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 30, 2005 4:41 pm 
Offline

Joined: Mon Jan 10, 2005 7:57 pm
Posts: 12
Location: Kentucky
Ah, ok. I figured it out. Thanks guys.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group