Load external symbol into register

I am trying to jump to a C-function using the JR command. The reference manual states the following:
Example:
This is what I want to do, but it does not work, as "#" gets expectedly treated as a comment, as stated in the sdk manual.
For now, I am only trying to load the adress of a label into a register but it does not work.
My current code for testing is:
But the assembler always produces the following code:
What is the syntax to load the adress of a label?
Example:
- Code: Select all
MOV R0,#_labA ;move label into register
JR R0; ;jump to _labA
This is what I want to do, but it does not work, as "#" gets expectedly treated as a comment, as stated in the sdk manual.
Anything to the right of the character ‘#’ is a comment
For now, I am only trying to load the adress of a label into a register but it does not work.
My current code for testing is:
- Code: Select all
startit:
nop
b foo
nop
mov r0, foo
mov r1, #foo
mov r3, %high(foo)
mov r4, %low(high)
nop
nop
foo:
nop
nop
But the assembler always produces the following code:
- Code: Select all
Disassembly of section .text:
00000000 <startit>:
0: 01a2 nop
2: 0ce0 b 1a <foo>
4: 01a2 nop
6: 000b 0002 mov r0,0x0
a: 200b 0002 mov r1,0x0
e: 600b 0002 mov r3,0x0
12: 800b 0002 mov r4,0x0
16: 01a2 nop
18: 01a2 nop
0000001a <foo>:
1a: 01a2 nop
1c: 01a2 nop
What is the syntax to load the adress of a label?