It is currently Fri Nov 17, 2017 7:59 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Fri Nov 10, 2017 5:39 pm 
Offline

Joined: Fri Nov 10, 2017 5:18 pm
Posts: 4
I have been getting into NES programming using NESASM3 to better understand computers in a lower level.

Right now I'm having a hard time wrapping my head around games like Kirby and Battletoads that use multiple screens and yet hardly use nametables at all. Particularly Battletoads.

How is Battletoads able to display dozens of backgrounds even though the nametables show nothing but the status bar and the pattern tables don't have any of those background tiles either?!
I know for 4-screen data you need extra VRAM addresses in the ROM file, but even if thats how it works that doesn't explain how the tiles get on the screen.

With Kirby, it's a little different.
The tiles are loaded into the PPU and you can see the actual screen scroll in the nametable, but then the status bar tiles are not in the PPU, even though theres a bunch of garbage tiles that show the status bar is there! :?

I have google searched questions and looked at dozens of NES programming sites, but nobody seems to ask those questions or even talk about it in an official or satisfying way.

If anyone can PLEASE explain this or direct me to any mapper or site where I can read up on this, I will greatly appreciate it.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 5:49 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10112
Location: Rio de Janeiro - Brazil
YTisRW wrote:
How is Battletoads able to display dozens of backgrounds even though the nametables show nothing but the status bar and the pattern tables don't have any of those background tiles either?!

Which emulator are you using to visualize the name and pattern tables? IIRC, Battletoeads starts the frame with rendering disabled, and it switches name tables mid-screen to switch from the status bar to the gameplay graphics. These types of mid-screen changes only show in the final output, while the debug windows will only show the state of everything in a determined instant. By default, this instant is usually the start of the frame, but in FCEUX for example you can change the "Display on scanline" box to see the state of the video in other moments. If you set it to a scanline further down the screen (e.g. 50) you should be able to see Battletoads' backgrounds.

The issue with Kirby is similar. It uses CHR bankswitching mid-screen to switch in the status bar patterns, but since you're visualizing the state of the name tables on scanline 0, those patterns have not yet been switched then, so the status bar looks like garbage. Change the "Display on scanline" box to 220 or something and you should see the opposite: the status bar is displayed correctly but the playfield area is garbled.

EDIT: Mesen also lets you specify on which scanline (and cycle!) to sample the PPU, but Nintendulator doesn't.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 6:00 pm 
Offline

Joined: Fri Nov 10, 2017 5:18 pm
Posts: 4
tokumaru wrote:
YTisRW wrote:
How is Battletoads able to display dozens of backgrounds even though the nametables show nothing but the status bar and the pattern tables don't have any of those background tiles either?!

Which emulator are you using to visualize the name and pattern tables? IIRC, Battletoeads starts the frame with rendering disabled, and it switches name tables mid-screen to switch from the status bar to the gameplay graphics. These types of mid-screen changes only show in the final output, while the debug windows will only show the state of everything in a determined instant. By default, this instant is usually the start of the frame, but in FCEUX for example you can change the "Display on scanline" box to see the state of the video in other moments. If you set it to a scanline further down the screen (e.g. 50) you should be able to see Battletoads' backgrounds.

The issue with Kirby is similar. It uses CHR bankswitching mid-screen to switch in the status bar patterns, but since you're visualizing the state of the name tables on scanline 0, those patterns have not yet been switched then, so the status bar looks like garbage. Change the "Display on scanline" box to 220 or something and you should see the opposite: the status bar is displayed correctly but the playfield area is garbled.


Idk how to reply so I'm just gonna quote.
You don't know how happy I am that you replied.

I was using FCEUX to view this and better understand it.

If it switches the nametables mid-frame, does it also do that for the tiles in the pattern tables too?

EDIT: I just finished reading your entire comment and realized you answered that already, sorry.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 6:04 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10112
Location: Rio de Janeiro - Brazil
YTisRW wrote:
If it switches the nametables mid-frame, does it also do that for the tiles in the pattern tables too?

Battletoads doesn't, because it uses 8KB of CHR-RAM without bankswitching... The pattern tables are showing just fine for me though, they aren't blank. What version of FCEUX are you using?


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 6:06 pm 
Offline

Joined: Fri Nov 10, 2017 5:18 pm
Posts: 4
tokumaru wrote:
Battletoads doesn't, because it uses 8KB of CHR-RAM without bankswitching... The pattern tables are showing just fine for me though, they aren't blank. What version of FCEUX are you using?


I'm using 2.2.2.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 6:09 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 211
Battletoads uses 4-screen mirroring which means only one nametable is visible while the other is off-screen in memory. FCEUX doesn't show the off-screen nametable.

Also, understand that the PPU outputs scanline by scanline, starting at the top and working downwards. If you modify the PPU's state mid-frame, future scanlines will look different. Because of this, you can't always look at a single nametable and say "This is how the game will look!". Instead you have to think on a scanline-by-scanline basis.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 6:15 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10112
Location: Rio de Janeiro - Brazil
YTisRW wrote:
I'm using 2.2.2.


That's pretty old... But now I realized you didn't say the pattern tables were blank, just that the tiles visible on the screen aren't there. Well, from what I can see they're all there, they're just being displayed with the same palette, since the emulator doesn't know which tiles use which palettes (it could in theory be smart and get that information from the name/attribute tables, although it could get confused if the same tiles are displayed using different palettes in different places), so by default all tiles are using the first palette. You can right-click on the patterns to cycle through the palettes, but that changes the colors of all tiles. Also notice that each debug windows has its own "display on scanline" box.

pubby wrote:
Battletoads uses 4-screen mirroring which means only one nametable is visible while the other is off-screen in memory. FCEUX doesn't show the off-screen nametable.

That's 1-screen name table mirroring (1 name table mapped to all 4 slots), 4-screen is 4 unique nametables mapped to the 4 slots at all times.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 6:27 pm 
Offline

Joined: Fri Nov 10, 2017 5:18 pm
Posts: 4
I just downloaded Mesen and realized how much I have missed.

I see now, that the IRQ is used to draw the tiles at a different time.
Thanks.


Top
 Profile  
 
PostPosted: Fri Nov 10, 2017 6:44 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10112
Location: Rio de Janeiro - Brazil
Mesen has a ton of useful debug tools, probably more advanced than FCEUX. The only reason I don't use it more often is because it's a little too heavy for the old laptop I use for development.

Yes, Kirby uses IRQs to know when to change the scroll and the pattern table to display the status bar. Battletoads on the other hand uses timed code and sprite 0 hits to time its effects.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 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