It is currently Sat Dec 16, 2017 2:30 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Wed Dec 14, 2005 6:26 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
That is correct.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 7:31 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10165
Location: Rio de Janeiro - Brazil
OK, Disch, thanks for clarifying this. I thought that maybe $5130 was sort of "active" on the loaded CHR banks. It is a very good thing it works the way you said. Not that it would be so bad if it was the other way around, though. 256 KB at a time would be more than enough on most cases!

So, I can use $5130 when bankswitching small (1 or 2 KB) banks, and then set it to the 256 KB bank I want the BG with extended attributes to use, before rendering starts. It should cause problems if you try to bankswitch CHR midframe, right? Would BG rendering be disturbed if you changed $5130 midframe?

Oh, one more thing: If you're bankswitching larger banks (4 or 8 KB) does the value at $5130 matter at all? I mean, do you have to clear the 2 bits before switching or is the mapper smart enough to know you'll not be using those bits?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 8:55 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
tokumaru wrote:
So, I can use $5130 when bankswitching small (1 or 2 KB) banks, and then set it to the 256 KB bank I want the BG with extended attributes to use, before rendering starts. It should cause problems if you try to bankswitch CHR midframe, right? Would BG rendering be disturbed if you changed $5130 midframe?


If you're using ExAttribute mode, you'd have no reason to swap CHR mid-frame... since it's hardly needed for sprites and the CHR registers are not used at all by the BG when in ExAttribute mode (except for $5130)

But yes, changing $5130 during rendering in ExAttr mode would mess with the display.

Quote:
Oh, one more thing: If you're bankswitching larger banks (4 or 8 KB) does the value at $5130 matter at all? I mean, do you have to clear the 2 bits before switching or is the mapper smart enough to know you'll not be using those bits?


The short answer: no, $5130 doesn't really matter when swapping 4k/8k banks.

The long answer: kind of. The CHR regs are all always 10 bit regardless of what swap mode you're in... however how the bits get used changes depending on the mode.

for example:
Code:
LDA #$03
STA $5101  ; enter 1k swap mode

LDA #$01
STA $5130
LDA #$04
STA $5127  ; swap in $104 * 1k .. CHR offset $41000

LDA #$00
STA $5101  ; enter 8k swap mode

; here, $5127 still contains $104, however since we're now in 8k swap
; mode, it swaps in $104 * 8k .. CHR offset $8000 (due
; to 1MB max)

LDA #$00
STA $5130
LDA #$04
STA $5127  ; swap in $004

; here, since we're in 8k swap mode, that write didn't APPEAR to do
; anything because it's still swapped to CHR offset $8000

LDA #$03
STA $5101  ; re-enter 1k swap mode

; here... since we're now in 1k mode and $5127 contains $004, it swaps
; to CHR offset $1000


So as that example tries to demonstrate... the high bits written to the regs are not completely ignored when in coarse swapping modes... however they aren't really used in swapping due to the 1MB limit.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 9:41 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10165
Location: Rio de Janeiro - Brazil
Disch wrote:
If you're using ExAttribute mode, you'd have no reason to swap CHR mid-frame...

Yeah, you're right. With 512 tiles avaliable for sprites why would anyone want to swap... It isn't very usefull anyway. It's just that everytime I'm trying to figure out the logic on something, all kinds of weird questions start to show up for some reason! =)

I think I understand the example on the higher 2 bits thing. Apparently they don't matter because if you go over the 1 MB limit (wich you may if the bits are set and you're using 4 or 8 KB mode) it just wraps around... But when you change the swap mode to smaller chunks you may not get the correct banks if you're not carefull with what's on $5130.

Thank you really much for the help. I know I can be a little annoying on the details sometimes!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 9:58 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
no problem at all... glad I could be of help


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 10:21 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7317
Location: Chexbres, VD, Switzerland
Wait, no known MMC5 games write more than once at reset to $5100-$5103. I didn't check that myself, but if I remember right J2 told me that, meaning that change PRG bankwitching or CHR bankwitching size any time *may* not work fine. This was just a notice, I'd recomend to make test on hardware to make sure changing CHR banks size cause no problems before doing that.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 11:48 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10165
Location: Rio de Janeiro - Brazil
You mean games will most likely set the bank sizes at startup and never change it through the rest of the program? Well, there is no BIG advantage in doing this anyway...

ExRAM mode ($5104) can be changed at will though, right?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 12:10 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10165
Location: Rio de Janeiro - Brazil
Quietust wrote:
Interestingly enough, ExRAM, while in mode 1, can only be written (via $5C00-$5FFF) while rendering - if you try to write during VBLANK (or while rendering is disabled), the data won't make it through properly.

Can we just do a quick review of ExRAM modes? In mode 0 it works exactly as an extra name table/attribute table, accessed through PPU writes and all, right?

In mode 1 (ExAttribute mode), only writes at rendering time work. But that's if you write through CPU memory only, right? Is it still writable through PPU during vblank?

In mode 2 it works as regular RAM, is that it? What about mode 3? What's the use of it?

Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 16, 2005 9:43 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7317
Location: Chexbres, VD, Switzerland
$5104 can be changed as will, and maybe $5100-$5103 also can, but (probably) all known games does change it only on startup, that doesn't mean that it isn't allowed, that means that it could not be allowed.
I'm not totally sure about mode 0 and what it does, but I think that $5c00-$5ffff will just be used as a third nametable, swappable in via $5105 by written logic 2 to one of the four nametable spcace. In that mode, write trough $5c00-$5fff must be done during rendering, but you can also write to it via normal nametable writes via $2006/7 out of rendering. Mode 0 is the most obsure one for me at least, so I'm not very sure about everything.

In mode 1, nametable 2 can also be swapped in for use, but the result isn't usefull, scince the attributes/high 14-bits index will be read from the same loction as the low 8-bit index, so this isn't of any use (exept if you want to write to EXGrafix RAM via $2007 in VBlank, I'm not even sure that would work, but it probably would).
In practice, you'll most probably want to use mode 1 to only have one-screen miroring, and the low values would be done trough one of the normal values, and the high values trough ExGraphix RAM via $5c00-$5ffff.

Mode 2 works for regular RAM, but it can be usefull if you want to write to EXRAM during VBlank, because the PPU cannot acess it it will work, unlike mode 0 and 1.

Mode 3 is read-only RAM, writing to it has no effect. I have no idea about how it could be used in practice, maybe just for read content of EXRam during rendering without risk of corruption with the PPU ?

_________________
Life is complex: it has both real and imaginary components.


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

All times are UTC - 7 hours


Who is online

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