How much does your program take?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
Wave
Posts: 110
Joined: Mon Nov 16, 2009 5:59 am

How much does your program take?

Post by Wave »

I was wondering if all game code fits on 16KB for example, my framework already takes ~4.5KB
How big are your programs?
How big are commercial NES programs?
Shiru
Posts: 1161
Joined: Sat Jan 23, 2010 11:41 pm

Post by Shiru »

This definitely depends from a game, its complexity, and quality of the code. It is difficult to measure the size of the code in my own projects, as it often interleaved with all kinds of data. Anyway, so far all my games were NROM, one of them 24K even, other was 40K but with compiled C code, and had some empty room. So I think I can say that it never was more than 16KB of code for me.

I think that large, complex games could easily have more than 16K of code.
User avatar
MottZilla
Posts: 2835
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

Some games certainly have all of their primary/main thread code under 16K. But they will probably put the music engine in a swappable bank, as well as most of the data. The majority of your PRG-ROM will be data anyway. Not unless you have crazy bloated code or something strange.

I've not even sure what you mean by your framework. You shouldn't worry really unless you can't fit into your chosen hardware. Since UNROM/MMC1 where you have a 16k/16k fixed setup is common, you'd want to be sure if using those to keep your main code under that much. Plenty of commercial games do exactly this.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

SMB1 has (comparatively) a lot of code and not a lot of map data because it's crazy compressed, unless you count the CHR ROM as data too.
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

I expect my game to have more than 16KB of code. For this reason I have tried to put most of the code that doesn't need access to other banks in a switchable bank. That way the hardwired bank can be mostly dedicated to the main engine, which does access data all over the ROM. Music code and data are in a separate bank as well.

Although I hope that the main engine will fit in the 16KB of the hardwired bank, I'm prepared to move parts of it to a switchable bank (such as the AI for objects that don't need to collide with the background).
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Post by Kasumi »

My game used 3.95 KB for the main character's routine alone. This included movement and jumping, slope detection, updating and scaling velocity, detecting collision points, multiple direction shooting etc.

I'm currently rewriting it, but I bet it will end up even larger once I add object-object collision detection and the grabbing and throwing of objects.

If your NMI/code makes your game scroll/update attributes is 4.5 kb, I don't think that's that bad.
Post Reply