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

Data Bank (B) register woes (attn: koitsu, byuu)
http://forums.nesdev.com/viewtopic.php?f=12&t=14650
Page 1 of 1

Author:  Ramsis [ Mon Aug 08, 2016 9:29 am ]
Post subject:  Data Bank (B) register woes (attn: koitsu, byuu)

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

Code:
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! :)

Author:  Revenant [ Mon Aug 08, 2016 10:08 am ]
Post subject:  Re: Data Bank (B) register woes (attn: koitsu, byuu)

plb definitely should be updating DB immediately. What are you using to generate the tracelog?

Author:  Ramsis [ Mon Aug 08, 2016 10:34 am ]
Post subject:  Re: Data Bank (B) register woes (attn: koitsu, byuu)

... 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:

Author:  Drew Sebastino [ Mon Aug 08, 2016 10:52 am ]
Post subject:  Re: Data Bank (B) register woes (attn: koitsu, byuu)

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.

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