Bank Switching
Moderator: Moderators
Re: Bank Switching
bank switching in MMC1 is nothing like bankswitching in UNROM. You have to write the bits sequentially. Check the wiki!
Re: Bank Switching
I can not write the working code for NESASM3 example (cyoammc1)... Could you help with the working code? It is for this example.
I beg you to help, I almost made my game. And I lack only the correct code for switching banks of graphics. I can not write the code myself. I've already tried it ..
I beg you to help, I almost made my game. And I lack only the correct code for switching banks of graphics. I can not write the code myself. I've already tried it ..
Re: Bank Switching
Have you tried the code snippets? there's nothing more to it, I mean, it's pretty straightforward, it's just:
Where <REG> is the register address you want to write <VALUE> to. You can check the port addresses and what to write to them here http://wiki.nesdev.com/w/index.php/MMC1
You first set up everything writing to port $8000 (mirroring a bank mode). You can change your CHR ROM banks individually using $A000 and $C000, and you can set your PRG bank writing to port $E000.
Code: Select all
lda #<VALUE> ; vertical mirroring, fixed $C000, 8 KB CHR pages
sta <REG> ; (use $0F instead for horizontal mirroring)
lsr a
sta <REG>
lsr a
sta <REG>
lsr a
sta <REG>
lsr a
sta <REG>
You first set up everything writing to port $8000 (mirroring a bank mode). You can change your CHR ROM banks individually using $A000 and $C000, and you can set your PRG bank writing to port $E000.
Re: Bank Switching
Help me to insert the code here:
download/file.php?id=9998
It will take you 1 minute. (You will spend more time if you try to explain to me how to do it).
Do you think I have not tried to do this? I can not do it. Help me please not by advice, but by working example. I wrote - I can not do anything on my own. (Forgive me if I do not write clearly, I know English very badly ...)
I could give my own project, but there all the comments are in Russian. I built my game based on the example from NESASM3.
download/file.php?id=9998
It will take you 1 minute. (You will spend more time if you try to explain to me how to do it).
Do you think I have not tried to do this? I can not do it. Help me please not by advice, but by working example. I wrote - I can not do anything on my own. (Forgive me if I do not write clearly, I know English very badly ...)
I could give my own project, but there all the comments are in Russian. I built my game based on the example from NESASM3.
Re: Bank Switching
Sorry, I don't use NESASM3, nor really code in assembly, nor have the time to try and understand a whole bunch of assembly code written by somebody else
I understood you want to page in bank 13 to copy CHR data to CHR-RAM, so paging in bank 13 of PRG in MMC1:
I understood you want to page in bank 13 to copy CHR data to CHR-RAM, so paging in bank 13 of PRG in MMC1:
Code: Select all
lda #13 ; Set bank 13
sta $E000 ; $E000 = set PRG bank.
lsr a
sta $E000
lsr a
sta $E000
lsr a
sta $E000
lsr a
sta $E000
Re: Bank Switching
Alas ... This code does not work for me in this rom.
In my example:
Graphics are taken from the penultimate bank. And I do not know how to change the bank of graphics to another one or add one more and switch him.
In my example:
Code: Select all
.inesprg 8 ; 8x 16KB PRG code = 128KB
.ineschr 0 ; 0x 8KB CHR data = CHR RAM
.inesmap 1 ; mapper 1 = MMC1
Re: Bank Switching
This is a CHR-RAM board, so you have to page in the bank with the graphics and copy them to VRAM via $2006/$2007 writes. The code I posted is for the first part (page in a PRG-ROM bank). You have then top copy the pattern data to the VRAM.
Learn about CHR-RAM here http://wiki.nesdev.com/w/index.php/CHR_ ... to_CHR_RAM
Learn about CHR-RAM here http://wiki.nesdev.com/w/index.php/CHR_ ... to_CHR_RAM