It is currently Wed May 24, 2017 9:55 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
PostPosted: Thu Mar 09, 2017 6:41 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1574
Location: DIGDUG
I don't want to be an ass, but...

I feel proper forum etiquette requires a follow up post.

Something along the the lines of "I got it to work, thanks", or "I'm still having issues with X", or "I'm too busy to work on this now, but I'm making slow progress"

When you have multiple people trying to help you, and you leave it hanging like this, it tends to generate bitter feelings, and people will likely be less enthusiastic about helping you in the future.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Thu Mar 09, 2017 9:16 pm 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 237
Location: Colorado USA
Sorry, I haven't had time to test it out. I'll get to that right now.


Top
 Profile  
 
PostPosted: Thu Mar 09, 2017 9:20 pm 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 237
Location: Colorado USA
Yep, it worked! thanks!


Top
 Profile  
 
PostPosted: Fri Mar 10, 2017 10:58 am 
Offline

Joined: Mon Jan 30, 2017 5:20 pm
Posts: 237
Location: Colorado USA
One question though, how would I know how many PRG banks I'm using? Would I type the code in a different text file, then see how big the binary file is and change the number of PRG banks in the iNES header accordingly, or is there another way.


Top
 Profile  
 
PostPosted: Fri Mar 10, 2017 11:51 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 579
Location: Sweden
No you should be able to see how big the file is even if the header doesn't match the ROM size. But emulators won't be able to run the game properly if the header is wrong.

If you are using NROM you can have only one or two PRG banks. Each PRG bank is 16 kB so if your game is bigger than that (minus the 8 kB CHR-ROM) you need two banks. If your PRG-ROM is bigger than 32 kB you need to consider using another mapper.
Tokumaru's templates automatically calculates the PRG-ROM start address ($C000 or $8000 for NROM) depending on what you set the PRG_COUNT define to (1 or 2 for NROM).

https://wiki.nesdev.com/w/index.php/Programming_NROM


Top
 Profile  
 
PostPosted: Fri Mar 10, 2017 12:04 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 9646
Location: Rio de Janeiro - Brazil
Well, banking is something you have to plan for, not something that happens automatically and you just change the header to match. An NES program needs to explicitly map the banks it needs to access, so a program can't just grow indefinitely without the programmer planning out *how* it's going to grow and how the interaction between all the different banks will happen.

You have to decide yourself how many and which banks will be dedicated to the main engine, the audio engine, level maps, graphics (in case of CHR-RAM), and so on, and design the code in a way that allows it to access all of this stuff. When you start a project, you need to know the mapper you're gonna use, since there are many different bank layouts across the different mappers, and estimate how much space you're gonna use. These things don't have to be set in stone, as it may be possible to switch to a similar mapper later on or increase the ROM size (as long as the mapper supports it), but more drastic changes may need a lot of refactoring.

Another important thing to note is that ROM sizes bust be powers of 2. you can't have 110KB of PRG-ROM, you have to round it up to the next multiple of 2, which is 128KB. For example, if you currently have 64KB of PRG-ROM that's completely full, and need to implement a new feature that only needs 1 extra byte, you have to double the ROM size to 128KB, even though you only need 1 extra byte, otherwise emulators won't know how to map you ROM file.

In ASM6 you can put the cointents of different banks in separate files, and include them all in a master file that will be assembled. Something like this:

Code:
;PRG-ROM bank 0
.base $8000
.include "bank0.asm"
.org $c000

;PRG-ROM bank 1
.base $8000
.include "bank1.asm"
.org $c000

;PRG-ROM bank 2
.base $8000
.include "bank2.asm"
.org $c000

;PRG-ROM bank 3
.base $c000
.include "bank3.asm"
.org $fffa

;interrupt vectors
.dw NMI
.dw Reset
.dw IRQ

This could be part of a master file for an UNROM program with 64KB of PRG-ROM (4 x 16KB).


Top
 Profile  
 
PostPosted: Fri Mar 10, 2017 12:28 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1574
Location: DIGDUG
Note. Number of banks should be a power of 2...

1, 2, 4, 8, 16

Don't worry about how many banks you need yet. Just stick to NROM128 (Donkey Kong, Pacman) or NROM256 (Super Mario Bros) sized right now.

If you have so much code that you overflow past FFFF, the assembler will give you an error. Until that happens, it's not a worry.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 7 hours


Who is online

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