It is currently Fri Dec 15, 2017 8:41 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Jan 26, 2017 5:17 pm 
Offline
User avatar

Joined: Mon Jun 20, 2016 7:56 am
Posts: 18
Hi all!

I have a question for you, if I may:

My goal is to have a 128K PRG / 16K CHR game made, with 16K banked at $8000-$BFFF ($C000-$FFFF is fixed).

I have the Mapper control byte at #%00001100. This is my RESET VECTOR:
Code:
RESET:
   SEI                                 ; DISABLE IRQS
   CLD                                 ; DISABLE DECIMAL MODE

   LDA #$80                           ; THIS LOCKS THE PRG ROM AT $C000-$FFFF TO THE LAST BANK.
   STA $8000
 
   LDX #$40
   STX $4017                           ; DISABLE APU FRAME IRQ
   LDX #$FF
   TXS                                 ; SET UP STACK
   INX                                 ; NOW X = 0
   STX $2000                           ; DISABLE NMI
   STX $2001                           ; DISABLE RENDERING
   STX $4010                           ; DISABLE DMC IRQS


What I don't know, is how to arrange the .BANKs in my source file.
Do I start this way:
Code:
.BANK 0
.ORG $C000
(program code & data)

.BANK 1
.ORG $E000
(program code & data)

.BANK 2
.ORG $8000
(data)

.BANK 3
.ORG $A000
(data)

.BANK 4
.ORG $8000
(data)

.BANK 5
.ORG $A000
(data)

(etc.)

(which doesn't make sense to me because it is out of order)

Or like this:
Code:
.BANK 0
.ORG $8000
(data)

.BANK 1
.ORG $A000
(data)

.BANK 2
.ORG $C000
(program code & data)

.BANK 3
.ORG $E000
(program code & data)

.BANK 4
.ORG $8000
(data)

.BANK 5
.ORG $A000
(data)

(etc.)


I have this link that gives an example on how to do the actual bank switch: https://wiki.nesdev.com/w/index.php/Programming_MMC1
Seems simple enough.

I have to say, bank switching on the Atari 7800 is so simple. You just write the bank number to any address from $8000-$BFFF. That's all. :(

Thank you for your help!
Bob


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 5:24 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19348
Location: NE Indiana, USA (NTSC)
Bank switching on UNROM is almost as simple as on the 7800. But because you're using both CHR ROM larger than 8K and PRG ROM larger than 32K, you need to switch both PRG ROM and CHR ROM. Can you reduce your game's PRG size to about 104K so that you can decompress CHR data from PRG ROM to CHR RAM at runtime and thus not have to switch CHR ROM?


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 5:30 pm 
Offline
User avatar

Joined: Mon Jun 20, 2016 7:56 am
Posts: 18
tepples wrote:
Bank switching on UNROM is almost as simple as on the 7800. But because you're using both CHR ROM larger than 8K and PRG ROM larger than 32K, you need to switch both PRG ROM and CHR ROM. Can you reduce your game's PRG size to about 104K so that you can decompress CHR data from PRG ROM to CHR RAM at runtime and thus not have to switch CHR ROM?


Absolutely, as the extra banks are just for tile/sound data and I overestimated what I needed just to be on the safe side...
But I've never had to work with CHR data like that on the NES and have no idea how to do it. :( Is there a 'name' for that so I know what to search for?

Also, which order do I put the banks in (using my examples from above)?

Thank you, thank you.
Bob


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 6:11 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10165
Location: Rio de Janeiro - Brazil
PacManPlus wrote:
Also, which order do I put the banks in (using my examples from above)?

Alternate $8000 and $A000 banks as many times as needed, and make the last two $C000 and $E000, which will be the fixed ones.


Top
 Profile  
 
PostPosted: Thu Jan 26, 2017 6:46 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19348
Location: NE Indiana, USA (NTSC)
PacManPlus wrote:
tepples wrote:
Bank switching on UNROM is almost as simple as on the 7800. [...] Can you reduce your game's PRG size to about 104K so that you can decompress CHR data from PRG ROM to CHR RAM at runtime and thus not have to switch CHR ROM?

I've never had to work with CHR data like that on the NES and have no idea how to do it. :( Is there a 'name' for that so I know what to search for?

See Tile compression, Programming UNROM, and CHR ROM vs. CHR RAM.


Top
 Profile  
 
PostPosted: Fri Jan 27, 2017 4:18 am 
Offline
User avatar

Joined: Mon Jun 20, 2016 7:56 am
Posts: 18
Thank you!

You've given me something to go on. :)


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google Adsense [Bot] 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