I understand how to call an assember routine from Javascript because there is a shim in a TS file that accompanies the assembler, such as the following, where one can also rename the function from myAssemberCode() to widget() for example.
That’s straightforward. Assembly code can be used for time-critical Microbit pin output, for example.
But if my extension has a .cpp file rather than a .ts - or perhaps it even has both - I can’t see how to let C++ call the routine. What do I do, please?
Thank you. I’ll try again in a minute. I thought I had already tried that with a //% shim=… in the cpp file but it didn’t work. It’s possible I might have made a typo in the shim that I simply failed to see. I’ve found previously that a consequence of things such as throwStickForMyDog() that you can miss the fact you’ve got a lowercase “f” by mistake despite staring at it for ten minutes.
I’ve got this extension with a TS file, a CPP file and an ASM file. There is one namespace for the extension. I’ve put the relevant functions right at the top of the namespace declarations in the TS and CPP files for clarity. I have a byte-send and a buffer-send function in the ASM file.
The important code is lines 68 and 69 of the nokialcd.ts file. One is commented out, the other not. Both should do exactly the same thing: they call an assembler function. One is via TS, the other supposedly via a C wrapper. But the C version doesn’t work.
I cannot see how I can get the assembler function to be called within the C code. How do you do this, please?
It’s rather disappointing that it’s not easy just to link to the assembler function in C as it is with TS. The documentaion for inline assembler makes it look rather restrictive.