Question about bankswitched memory from a layman

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Question about bankswitched memory from a layman
by on (#125816)
Hey guys,

I have to apologize because I have no idea if this question is really a newbie-level question. Rather, I'm posting here because I myself am very new to NES tech and dev.

My name is SuperDerek, and I review videogames. I've been working on a video in defense of a somewhat notorious NES game. I've been trying to do my research well, but I seem to have run into a brick wall, and I think that if anybody can answer my questions, it's probably you guys.

The game I'm going to be reviewing doesn't use bankswitched memory. Since it was one of only two games released on the NES that did not use that technique, you might already know to which game I am referring.

Initially, I though that this meant that the game had to be much smaller than a normal NES title, to verify this I downloaded a ROM file of the game and compared it to Super Mario Bros for a little perspective. To my surprise the file sizes were actually the same. Am I missing something , or just wrong about what bankswitching actually does?

The second question that I have is if there is a physical difference in the NES cartridges that used and didn't use bankswitching? I know that NES cartridges came in all kinds of different configurations, so I guess this question boils down to, looking at the circuit board, can you tell if a game uses bankswitching, and how? Or is this a purely software-based technique?

The final question I have about bankswitching is if there is a reason that a NES game released well into the NES life cycle would choose not to use this technique? Is bankswitching costly? Or is this more likely related to the fact that this game is a port of an older PC-6001/8801 title, and that programming the game to utilize bankswitching would require substantial rewriting of the entire game's code?

Thank you for your time, and any light you might be able to help shed on these questions for me.

-Derek

Edit:
Looks like that bit about it being one of only 2 games that used bankswitching was completely wrong -- I misread an article which stated it was one of only 2 RPGs that used bankswitching. Big difference there, and I thank you guys for helping to clear that up! :)
Re: Question about bankswitched memory from a layman
by on (#125818)
A lot of NES games, including Super Mario Bros. did not use any bankswitching in the cartridge. Here is a partial list: http://bootgod.dyndns.org:7777/search.php?ines=0

Assuming the game is in iNES format, and was not dumped incorrectly, the byte size of the file will be less than or equal to 40,976 bytes if no bankswitching is used. The converse is partially true; if an iNES file is less than or equal to 40,976 bytes in size, it probably did not use bankswitching, but there are exceptions.
Re: Question about bankswitched memory from a layman
by on (#125819)
SuperDerek wrote:
The game I'm going to be reviewing doesn't use bankswitched memory. Since it was one of only two games released on the NES that did not use that technique, you might already know to which game I am referring.

What do you mean "only 2 games don't use banswitching"? Tons of games don't use memory bankswitching (according to Bootgod's database, 247 games). EDIT: Ninja'd!

Quote:
Initially, I though that this meant that the game had to be much smaller than a normal NES title, to verify this I downloaded a ROM file of the game and compared it to Super Mario Bros for a little perspective. To my surprise the file sizes were actually the same. Am I missing something , or just wrong about what bankswitching actually does?

SMB is one of the 247 games that doesn't use bankswitching, so it's no surprise that the size is the same. Games that don't have a mapper (chip that bankswitches memory) use a board named NROM. This board supports up to 32KB of Program ROM and 8KB of Character ROM, so 40KB is the largest you'll see that doesn't use a mapper.

Quote:
The second question that I have is if there is a physical difference in the NES cartridges that used and didn't use bankswitching? I know that NES cartridges came in all kinds of different configurations, so I guess this question boils down to, looking at the circuit board, can you tell if a game uses bankswitching, and how? Or is this a purely software-based technique?

Yes, boards are very different. The bare minimum number of chips in an NES PCB is 3: Program ROM, Character ROM/RAM and the lockout chip. If that's all you see, there's no bankswitching. Any more than that, there's most likely a mapper present (extra chips could also be extra RAM though).

Quote:
The final question I have about bankswitching is if there is a reason that a NES game released well into the NES life cycle would choose not to use this technique? Is bankswitching costly?

There shouldn't be such a big difference during the later NES years. In the early days though, both the mapper and the larger ROM would've made a significant difference.

Quote:
Or is this more likely related to the fact that this game is a port of an older PC-6001/8801 title, and that programming the game to utilize bankswitching would require substantial rewriting of the entire game's code?

They probably didn't need the extra space. Do you know how large the original game is? There'd no point in expanding the game just for the heck of it.
Re: Question about bankswitched memory from a layman
by on (#125820)
D'oh!

Looks like I failed at reading comprehension. Apparently it's one of only 2 RPGs that didn't use bankswitching! Well that cleared up my misconception right quick, so thank you both for your quick replies! You've both given me a lot to chew on, and have been a huge help. And thanks for being so welcoming. :)

Quote:
They probably didn't need the extra space. Do you know how large the original game is? There'd no point in expanding the game just for the heck of it.


@tokumaru,
The original game had several music tracks for different environments. However, when ported to the NES (in 1988) they dropped all but 3 15-second loops of music, one of which is all that you hear for the vast majority of the game, which is one of the major gripes.

Apparently the only other NES RPG not to use bankswitching just resolved the problem by omitting music altogether. I'm guessing that the only reason they didn't expand the game was because at the time, it must have still been expensive to get the extra chips.

I'm not sure how large the original PC88 version of the game would be, but I think I'll take a crack at finding out. Thanks again!
Re: Question about bankswitched memory from a layman
by on (#125821)
It isn't legendary crapgame Stargazer, is it?
Re: Question about bankswitched memory from a layman
by on (#125823)
Nope... Honestly I'm not sure why I'm beating around the bush so much. If someone finds out early it's no big deal.

I'm going to be putting together a defense for Hydlide, which was ripped apart by the AVGN as well as ProJared.
Re: Question about bankswitched memory from a layman
by on (#125824)
I have never played Hydlide, but from looking at it I see something very peculiar: it doesn't use the hardware registers for scrolling, instead it redraws the entire gameplay area to simulate scrolling. This is most likely replicated from the original version, which probably ran on a video chip that didn't have hardware scrolling.

Software scrolling isn't common on the NES, because programs only have a small portion of a frame's time for screen updates, and that time is not enough to update an entire screen, so the effect looks very choppy, while hardware scrolling can be perfectly smooth (but can't be done with those bricks around the gameplay area).

EDIT: Looks like I was wrong. I looked at the PC-88 version and it doesn't have scrolling at all. There's actually a pretty long black screen between screens. Maybe the NES version is based on the MSX one?
Re: Question about bankswitched memory from a layman
by on (#125826)
Ahh, Hydlide. Packing an RPG game into an NROM is certainly a feat, but I agree with tokumaru. From a technical perspective, I think that the nametable and scrolling setup is what makes this game peculiar.

Scrolling is done fully in software, and is quite slow and choppy as a result. In order to use hardware scrolling though, the status bar on the right would have to have been eliminated, or an MMC5 would be needed ($$$$$).

Image

Even given all that, it seems like they should have been able to improve the performance by a sort of "double buffer" strategy, where one nametable is on screen and one is being drawn to. It doesn't speed things up because you can still only edit the "backbuffer" during vblank, but it would have eliminated the tearing that is so obvious in the game when you scroll.
Re: Question about bankswitched memory from a layman
by on (#125827)
tokumaru wrote:
Software scrolling isn't common on the NES, because programs only have a small portion of a frame's time for screen updates, and that time is not enough to update an entire screen, so the effect looks very choppy

There's a difference between choppy and very choppy. One of my older games would scroll two 10x20 tile windows at 30 fps using a bit of early blanking. The Bad Apple demo updates the nametable at 15 fps using double buffering. But games during the NROM era had the double disadvantage of A. programmers not yet having discovered efficient display update methods for the NES PPU and B. the NES possibly not having built-in RAM to buffer a big nametable update transaction.
Re: Question about bankswitched memory from a layman
by on (#125828)
Yeah, I can verify that Hydlide had scrolling added to it when it was ported to the MSX, so you're most likely right that this was the version the port was based off of. Additionally, it sounds like the music for the NES game came straight from Hydlide 2. Probably because, while Hidlyde had some different tracks, they were composed of nothing but short chirps and beeps.

The points you bring up about scrolling are also very interesting. I noticed that scrolling within Hydlide was pretty awkward, but assumed that sort of scrolling was improved as devs got a better hold of the NES hardware. It's interesting that the NES had hardware based scrolling available. I wonder how much better Hydlide could have been if they had redesigned the game from the ground up for the NES?
Re: Question about bankswitched memory from a layman
by on (#125829)
Quote:
It isn't legendary crapgame Stargazer, is it?

Looks like this game uses UNROM. It also has the interesting properties to use the only non-prototype Nintendo made board with SRAM in a surface mounted package instead of the more traditional DIP-28 package (either narrow or wide).

I can't think of another RPG that don't use a mapper. There is Portopia who has no mapper and no music, but it's clearly not an RPG. But because it was made by Chunsoft/Enix some people might confuse it for an RPG ?

Dragon Quest doesn't use PRG bankswitching, but it uses CHR bankswitching.

Then there is all the FDS games that don't use bankswitching, but they use disk access instead.
Re: Question about bankswitched memory from a layman
by on (#125831)
Yeah, Portopia was the other alleged RPG not to use bankswitching. So I would guess that would make Hydlide one of a kind, huh?

I've been looking up the MMC5 chip that Matt mentioned to get a good idea of what kind of bang developers could get for their buck, which coincidentally took me to another thread on this forum, here. I have to say, I'm certainly learning a lot as I go, thanks to you guys! It really gives me a new found appreciation for the considerations that went, (and still does,) into programming games for the NES. I only hope I can get even half of this to translate into an entertaining and informative review of Hydlide. :)
Re: Question about bankswitched memory from a layman
by on (#126041)
Yeah Portopia is definitely an adventure game. But it has this 3D maze that was inspired by Wizardry and I heard the game was like an experiment before they dared to make their first RPG, Dragon Quest. Ironically the 3D maze is the worst part of the game IMHO. lol

MMC5 is like the most advanced Nintendo made mapper there is and not too many games used it as you can see.

SuperDerek wrote:
game is a port of an older PC-6001/8801 title, and that programming the game to utilize bankswitching would require substantial rewriting of the entire game's code

You would have to rewrite the code anyway. PC-6001, PC-88 and MSX are all using a CPU called Z80 while NES/FAMICOM is using one based on 6502.