• Another update. It now actually does stuff...

    function a(b) { 
      "compiled";
      return b+"World"; 
    }
    console.log(a("Hello "))
    

    Compiles to:

    var ASM_BASE=process.memory().stackEndAddres­s;
    var ASM_BASE1=ASM_BASE+1/*thumb*/;
    [0xb580,0xb401,0x9800,0xb401,0xa00b,0xbf­00,0x4f09,0x697f,0xf000,0xf80e,0xb401,0x­222b,0xbc02,0xbc01,0x4f05,0x68bf,0xf000,­0xf806,0xb401,0xbc01,0xe7ff,0xbc08,0xbd8­0,0x4770,0x4738,0xbf00,0x74,0x2000,0x6f5­7,0x6c72,0x64,0x0].forEach(function(v) { poke16((ASM_BASE+=2)-2,v); });
    
    var a = E.nativeCall(ASM_BASE1, "JsVar (JsVar)")
    console.log(a("Hello "))
    

    Which does:

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v72 Copyright 2014 G.Williams
    >echo(0);
    Hello World
    > 
    

    I doubt I'll get much more time to work on it over christmas, but it's looking very promising indeed. Needs a lot of tidying, and I've got to add calls to jsvUnLock and fake a 'frame pointer', but then I can start looking at things like control flow.

About

Avatar for Gordon @Gordon started