nesdev.com
http://forums.nesdev.com/

Question about implementing MMC1 in NESDEV...
http://forums.nesdev.com/viewtopic.php?f=2&t=15450
Page 1 of 1

Author:  PacManPlus [ Thu Jan 26, 2017 5:17 pm ]
Post subject:  Question about implementing MMC1 in NESDEV...

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

Author:  tepples [ Thu Jan 26, 2017 5:24 pm ]
Post subject:  Re: Question about implementing MMC1 in NESDEV...

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?

Author:  PacManPlus [ Thu Jan 26, 2017 5:30 pm ]
Post subject:  Re: Question about implementing MMC1 in NESDEV...

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

Author:  tokumaru [ Thu Jan 26, 2017 6:11 pm ]
Post subject:  Re: Question about implementing MMC1 in NESDEV...

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.

Author:  tepples [ Thu Jan 26, 2017 6:46 pm ]
Post subject:  Re: Question about implementing MMC1 in NESDEV...

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.

Author:  PacManPlus [ Fri Jan 27, 2017 4:18 am ]
Post subject:  Re: Question about implementing MMC1 in NESDEV...

Thank you!

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

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/