Wow, thanks for this - that's an awesome bit of work!
As far as I know you're the first person that's used E.asm for serious work. Just wondering:
Which instructions did you try that weren't there - strh/ldrh? any others I should add?
Now there's support for multiline 'templated' strings, I could support that in the IDE, which would probably make using the assembler a lot more pleasant.
Also, I just added ~ to the compiler, and fixed another issue (it wasn't inlining the peek/poke because it wasn't sure the address was an integer).
You initial code:
function rclr2(addr,mask){
"compiled";
poke32( addr, peek32(addr) & ~mask);
}
Should be much better now. However it's not perfect because the argument still comes in as a JsVar and has to be converted in the code each time it's used.
This one's very slightly better, but again not great.
function rclr2(addr,mask){
"compiled";
var a = 0|addr;
poke32( a, peek32(a) & ~mask);
}
Honestly if you're happy with writing Assembler then that's definitely best :)
ufff - "compiled" is damn fast now. same benchmark as before, but now compiled is even 4ms (~2%) faster than my asm function! seems you implemented some quantum technology ;)
FYI: the a=0|addr does not improve anything (but when beeing faster than asm, thats ok ;)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Wow, thanks for this - that's an awesome bit of work!
As far as I know you're the first person that's used
E.asm
for serious work. Just wondering:strh/ldrh
? any others I should add?Also, I just added
~
to the compiler, and fixed another issue (it wasn't inlining the peek/poke because it wasn't sure the address was an integer).You initial code:
Should be much better now. However it's not perfect because the argument still comes in as a
JsVar
and has to be converted in the code each time it's used.This one's very slightly better, but again not great.
Honestly if you're happy with writing Assembler then that's definitely best :)