Hi,
I'm having a problem with a Branch instruction in a program i'm trying to write for a Freescale HC05 micro.
Basically, in the HC05, when a branch instruction is executed, an 8-bit signed integer value is calculated and used to adjust the program counter (PC) forward or backwards so it continues execution at the correct location.
As an example i've just written a simple bit of code which loops back to the label 'HERE' until the value of PORTA = zero:
so the relative offset is calculated by how much the PC needs to be adjusted by in order to continue at 'HERE'. So the offset in this case will be negative.
My problem is that I have more than 127 bytes of code between 'HERE' and the branch instruction which is more than can be represented by an 8-bit signed integer which results in a compiler error.
What can I do about this? I'm surprised at this limitation, and I wonder why Freescale didn't use a 16-bit signed integer value for relative addressing offsets instead.
I'm having a problem with a Branch instruction in a program i'm trying to write for a Freescale HC05 micro.
Basically, in the HC05, when a branch instruction is executed, an 8-bit signed integer value is calculated and used to adjust the program counter (PC) forward or backwards so it continues execution at the correct location.
As an example i've just written a simple bit of code which loops back to the label 'HERE' until the value of PORTA = zero:
Rich (BB code):
HERE LDA PORTA
BNE HERE
My problem is that I have more than 127 bytes of code between 'HERE' and the branch instruction which is more than can be represented by an 8-bit signed integer which results in a compiler error.
What can I do about this? I'm surprised at this limitation, and I wonder why Freescale didn't use a 16-bit signed integer value for relative addressing offsets instead.