Data Bank (B) register woes (attn: koitsu, byuu)

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
User avatar
Ramsis
Posts: 341
Joined: Sun Jul 01, 2012 6:44 am
Location: Lion's den :3
Contact:

Data Bank (B) register woes (attn: koitsu, byuu)

Post by Ramsis »

So whenever I attempt to change B, the Data Bank register, to a different value using code like this (assume A = 8 bit):

Code: Select all

lda #$XX
pha
plb
... then B apparently isn't updated to $XX immediately, unlike with Direct Page register changes. The tracelog tells me that several, even dozens of absolute (i.e., 16-bit operand) instructions that use the old data bank may pass before it switches to the new one.

Is this normal? Or what am I doing wrong?

Thanks for any advice! :)
Some of my projects:
Furry RPG!
Unofficial SNES PowerPak firmware
(See my GitHub profile for more)
Revenant
Posts: 455
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: Data Bank (B) register woes (attn: koitsu, byuu)

Post by Revenant »

plb definitely should be updating DB immediately. What are you using to generate the tracelog?
User avatar
Ramsis
Posts: 341
Joined: Sun Jul 01, 2012 6:44 am
Location: Lion's den :3
Contact:

Re: Data Bank (B) register woes (attn: koitsu, byuu)

Post by Ramsis »

... I'm a dumb**s. :lol:

Right after posting this, I realized that I was staring at DP (Direct Page) instructions instead of absolute ones like I thought I used in my code ... and DP is always in bank $00, right? So yeah, my mistake. Don't bother with it. :mrgreen:
Some of my projects:
Furry RPG!
Unofficial SNES PowerPak firmware
(See my GitHub profile for more)
User avatar
Drew Sebastino
Formerly Espozo
Posts: 3496
Joined: Mon Sep 15, 2014 4:35 pm
Location: Richmond, Virginia

Re: Data Bank (B) register woes (attn: koitsu, byuu)

Post by Drew Sebastino »

Ramsis wrote:DP is always in bank $00, right?
I've been using DP as an index register when I've ran out, so this is very good to know, because if anything I'm trying to point to isn't in bank $00 (which I don't think my object table with as many entries as I want will fit in the ram there) then I'm going to have a problem.
Post Reply