Hey all! Project is winding down. Starting to add some unplanned *flair*. Figured I'd try my hand at injecting some animated background tiles, since I'm using UnRom512 and the mapper supports chr ram bankswitching.
But I'm running against a void in my conceptual understanding, I guess. The game uses CHR-Ram - I have a few banks full of background graphic data that routines load in chunks whenever and wherever needed. No problem.
My conceptual understanding is that I can set up multiple banks (when I load that graphic data, load it's *animated* frame to a different bank location), and then with an easy write to two bits in 8000, I can determine which bank is being pointed to to populate the pattern tables. I have that right? I mean - I get bankswitching fine...obviously, I bankswitch PRG data all over the place.
But I suppose I'm confused how/where to set up these banks in memory. I tried to sort of follow how PRG banks are established, but nothing I tried seemed to work right (most attempts led to gray screen).
Anyone want to give me an easy breakdown of how to set this up so I can test it out? Ultimately, I'm not sure the game needs it, but...might be nice, and now I want to understand it!
Thanks!
Switch to CHR bank 0
Load pattern table
Switch to CHR bank 1
Load pattern table
Switch to CHR bank 2
Load pattern table
Switch to CHR bank 3
Load pattern table
Load nametable
Load palette
Turn on display
Switch to CHR bank 0
Wait a few frames
Switch to CHR bank 1
Wait a few frames
Switch to CHR bank 2
Wait a few frames
Switch to CHR bank 3
Wait a few frames
Does this still give a gray screen?
If so, you might have forgotten that a write to the mapper port switches both the PRG bank (bits 4-0) and the CHR bank (bits 6-5). Try doing this from the fixed bank ($C000-$FFFF). And if that doesn't work, try making a
minimal, complete, and verifiable example (MCVE), source code that builds yet is short enough for us to look at.
Yeah, I figure it's that simple. I'm a step before that, though. Where in memory are the CHR banks to set up in the first place? I guess that was the crux of my question.
Thanks, friend!
To write to CHR RAM bank 0, switch to CHR RAM bank 0 with a mapper write and then write to video memory $0000-$1FFF.
To write to CHR RAM bank 1, switch to CHR RAM bank 1 with a mapper write and then write to video memory $0000-$1FFF.
To write to CHR RAM bank 2, switch to CHR RAM bank 2 with a mapper write and then write to video memory $0000-$1FFF.
To write to CHR RAM bank 3, switch to CHR RAM bank 3 with a mapper write and then write to video memory $0000-$1FFF.
Ok cool...that's what I thought. I figured it was that easy.
I wonder if it's my emulator not emulating this. Hm.
Does your emulator correctly emulate
Videomation? Or an
Action 53 build including Sinking Feeling?
I have made CHR RAM bankswitching test ROMs for
MMC3 and
Action 53, but not UNROM 512.
Can't check right now, but essentially - what I'm trying is simply updating my bankswitch routine, or-ing in writes to bits 5 and 6 and storing them into the currentBank variable prior to the switch. It seems straight forward enough. But any time I make the bits anything other than 0, game freezes.
Without this ORA, the bankswitching routine works fine for PRG bankswitching.
If you're using a board that's not self-flashable, you need to avoid bus conflicts when changing the CHR bank. This makes your identity table for bus conflict avoidance four times as large, expanding it from 32 bytes to 128 bytes.
tepples wrote:
Does your emulator correctly emulate
Videomation? Or an
Action 53 build including Sinking Feeling?
I have made CHR RAM bankswitching test ROMs for
MMC3 and
Action 53, but not UNROM 512.
Funny, I just made an UNROM 512 / mapper 30 test ROM today !
Hope it helps anyone ...
edit : it uses 1-screen arrangement though
Attachment:
File comment: UNROM 512 / mapper 30 test ROM
mapper30-testROM-20170608.nes [512.02 KiB]
Downloaded 106 times
Drat. Curses. I was hoping it was the emulator, however, that test file seems to work fine (cycles through chr banks just dandy).
Huh.
Glutock - what does your bankswitch routine look like?
Disregard the whole thread. The problem was super simple. I didn't have the battery flag checked in the header, which ended up causing bus conflicts (Tepples, you mentioned this, and I didn't even think of it as a header issue! Good call)
Works fine now, and as expected.
Need NES game maker tools now....
NES homebrews for the rest of us non-programmers.
Improving on them every day
And the intent for them is absolutely to give new devs some confidence to eventually start getting deeper into the code and going crazy with it