Recently I wrote an assembler routine which I successfully incorporated into an extension alongside both Typescript and C++, using a .asm file, a .ts file and a .cpp file.
For fun I thought I would attempt a couple of other functions using Assembler and made good progress, getting 10% faster than the compiled C++ code in a few places.
However, when I attempted to write another assembler function which would call one of my previous assembler functions as a subroutine, it refuses to compile. Can anyone explain what I might be doing wrong?
The assembler functions and certain points in the code for branches and loops are labelled in the .asm file like this, with a dot for branch points and no dots for the function labels:
myFunction:
push {r4,lr}
various code
bl pins::getPinAddress
.loopstart:
more code
bne .loopstart
.endpoint:
pop {r4,pc}
Note that the function can do things such as call pins.getPinAddress
. No problem
But if I create another function in the same .asm file something like this:
secondFunction:
push {r4,r5,r6,r7,lr}
cmp r0, #1
bne .out
more code....
bl myFunction
.out:
pop {r4,r5,r6,pc}
There appears to be no way of getting the subroutine call bl myFunction
to work. Does anyone know what I need to do to make it work?