2005-09-06 09:47 PM
2005-09-06 08:00 PM
Hello,
how do I have to realize a jump to a calculated address? exp. label_xyz ... jump to label_xyz + offset Regards, Cristian2005-09-06 09:47 PM
Cristian, in assembler you can use these instructions:
segment 'ram0' BYTES offset_L DS 1 offset_H DS 1 segment 'rom' WORDS LD A,#label_xyz.L ADD A,offset_L PUSH A LD A,#label_xyz.H ADC A,offset_H PUSH A RET Regards, EtaPhi BTW: the code fragment stores the offset in two bytes of ram. If it is smaller, or if the jump destinations are all in the same page, some instructions can be removed. However, I suggest you to use a function table: JumpTable.w DC.W Label_1 DC.W Label_2 DC.W Label_3 ; X holds the index of the label where you need to jump SLL X LD A,({JumpTable+1},X) PUSH A LD A,(JumpTable,X) PUSH A RET