Use all 24 bits address bus on shifts and rotate?

Let's talk about anything related to the 6502 microprocessor.
Post Reply
Bryan Parkoff
Posts: 109
Joined: 25 Dec 2007

Use all 24 bits address bus on shifts and rotate?

Post by Bryan Parkoff »

I talk about 65816 microprocessor. ASL, LSR, ROL, ROR, INC, and DEC do not have long absolute addressing. Can you please provide me an example of your code how they can use 24 bits address bus instead of 16 bits address bus. The only alternative option is to load data bank value into accumulator before accumulator is pushed into stack and then pull it out of stack into data bank register. This will add more code length taking more memory space than four bytes on long absolute addressing.

Bryan
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Use all 24 bits address bus on shifts and rotate?

Post by GARTHWILSON »

I've only used the '802 version, so I can't speak from experience there; but I think the need to do those things would mostly be in the current data bank, not all over the map requiring constantly changing the data bank register. For the others, you can do for example LDA_long, INA, STA_long, and since they're not needed that often, the penalty isn't much. As kc5tja used to say, you have to make the banking work for you, not against you. He's a forum member but no longer active. He was extremely knowledgeable in programming, and worked as a software engineer at one of the social-media sites (but not facebook, if I understood correctly).
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
satpro
Posts: 47
Joined: 27 Nov 2014
Location: Ocala, Fl, USA

Re: Use all 24 bits address bus on shifts and rotate?

Post by satpro »

Bryan Parkoff wrote:
I talk about 65816 microprocessor. ASL, LSR, ROL, ROR, INC, and DEC do not have long absolute addressing. Can you please provide me an example of your code how they can use 24 bits address bus instead of 16 bits address bus. The only alternative option is to load data bank value into accumulator before accumulator is pushed into stack and then pull it out of stack into data bank register. This will add more code length taking more memory space than four bytes on long absolute addressing.

Bryan
Hi Bryan,
Would this work for you?

Code: Select all

lda [dp]     ;7 cycles, 2 bytes
asl a        ;2 cycles, 1 byte
sta [dp]     ;7 cycles, 2 bytes
You're looking at a cost of 16 cycles and 5 bytes in a 16-bit environment, assuming your Direct Page ptr (and data width) is set up ahead of time. The nice thing in this case is that you will not have to worry about data bank manipulation. You can also index with .Y for no extra charge.

Outside of that, your choice is probably limited to pushing/pulling a new data bank (as you suggest), but performing shifts/rotates on data in memory is really cycle/memory-intensive, regardless of where or how it's done. An ASL absolute will consume 8 cycles and 3 bytes all by itself, and that's in the same bank, so it's easy to see the advantage of using the accumulator for these types of things.
Post Reply