RTS after branching possible?
Posted: Tue Oct 15, 2019 3:21 am
Very new to assembler and 6502. I've been choosing various simple algorithms to implement in order to learn. I keep assuming that I can use RTS to return from a sub routine after branching to it. But from what I'm reading, I can only do that after using JSR. So I'm wondering if there's a common way to branch to a subroutine so that I can use RTS? I'm not just interested in how to do this, but if its good programming practice or not. In other words, if I run into this situation, is it a sign I should be rethinking my flow control?
Here's an example. I'm currently working on implementing a multiplication add/shift method. Here's a code snippet of where I test for whether or not I need to add before shifting:
Advice is appreciated, thanks!
Here's an example. I'm currently working on implementing a multiplication add/shift method. Here's a code snippet of where I test for whether or not I need to add before shifting:
Code: Select all
LDA #1
BIT _Q ; Is bit 0 set on address labeled _Q?
BNE add ; Need to add before shifting if so.
JSR shift ;Shift _A and _Q