logo

ibnjs

Unnamed repository; edit this file 'description' to name the repository.
commit: cae94a575c033838d7beb32b716a646dc36cc790
parent 169aa4d542f7ff8e50b98f9045980a938fadb9bf
Author: Adrian Siekierka <asiekierka@gmail.com>
Date:   Fri,  6 Jan 2012 00:05:56 +0100

example apps, other stuff

Diffstat:

Mibniz.html49+++++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 16 deletions(-)

diff --git a/ibniz.html b/ibniz.html @@ -9,10 +9,26 @@ Why u no canvas <input type="text" id="code" style="width: 256px"><br> <input type="checkbox" id="pause">Pause <input type="checkbox" id="simpleGetPut">Simple memory access<br> <input type="checkbox" id="useAudio">Audio (experimental, firefox/chrome/safari)<br> -<input type="checkbox" id="recalcAudio">More accurate audio (slightly slower) +<input type="checkbox" id="recalcAudio">More accurate audio (slightly slower)<br> +Load: <select id="example_apps"> +<option value=""></option> +<option value="^x7r+Md8r&">Munching squares</option> +<option value="sv5rvs--">Plasma</option> +<option value="v8rsdv*vv*^">XOR texture zoomer</option> +<option value="8rw10r%w18r%">FreeFull - opening gate</option> +<option value="sxsaxAr+waxBr+^">FreeFull - spinny</option> +<option value="axp wvvx3r40/&^^ wd*xd*+qq1x/sx8r++ 30FF|">FreeFull - rose</option> +<option value="8rw10raw8r+w18r^">FreeFull - xorwiggle</option> +<option value="v8rsdv*vv*^wpp8r-">Munching zoomer</option> +<option value="ax8r+3lwd*xd*+q1x/x5r+^">Texture tunnel</option> +<option value="v8rds4X3)Lx~2Xv*vv*+i!L1@2@^">Rotozoomer</option> +<option value="d4rr">asiekierka - 4-char demo</option> +<option value="6{^^ddd***1%}5{v8rsdv*vv*^wpp8r-}4{v8rdsx.6+s4X3)Lx~2Xv*vv*+i!L1@2@^}3{ax8r+3lwd*xd*+q1x/x6r+^}2)6r3&3+V55A9^Md6r|5*wdAr&+">viznut - ibnizdemo.ib</option> +<option value="axCr3ls3r+43lwd*xd*+q1x/x7r+^1%w^x20r8l+^M3*w5r&w5*w9r&w2*w6r&||">FreeFull - christmas demo</option> +</select> </form> <div id="fps"><b>FPS:</b> [loading...]</div> -<b>IBNIZ-js 0.A (Eval Edition)</b><br> +<b>IBNIZ-js 0.B (Eval Edition)</b><br> <a href="https://github.com/asiekierka/ibnjs">Github repository</a><br> <a href="mailto:asiekierka@gmail.com">Contact</a><br> <script type="text/javascript"> @@ -21,7 +37,6 @@ Why u no canvas * and/or modify it under the terms of the Do What The Fuck You Want * To Public License, Version 2, as published by Sam Hocevar. See * http://sam.zoy.org/wtfpl/COPYING for more details. */ - Array.prototype.clear = function(){ this.length=0; } @@ -461,8 +476,7 @@ function Parser(simpleGetPut,useAudio) var cmd; var a; tempCode += "var a; var stacka = me.stacka; var steps;"; - this.ip=startIP; - for(var i=startIP; i<this.parsedCode.length; i++) + for(this.ip=startIP; this.ip<this.parsedCode.length; this.ip++) { cmd = this.parsedCode[this.ip]; switch(cmd[0]) @@ -615,7 +629,8 @@ function Parser(simpleGetPut,useAudio) { case 123: tempCode += "me.put(" + cmd[1] + ","+this.rol16(this.ip+1)+");"; - tempCode += "return " + cmd[3] + ";"; + //tempCode += "return " + cmd[3] + ";"; + this.ip=cmd[3]; break; } break; @@ -624,13 +639,15 @@ function Parser(simpleGetPut,useAudio) { case 123: tempCode += "me.put(me.rol16(stacka.pop())&1048575,"+this.rol16(this.ip+1)+");"; - tempCode += "return " + cmd[2] + ";"; + //tempCode += "return " + cmd[2] + ";"; + this.ip=cmd[2]; break; case 63: tempCode += "if(stacka.pop()==0) return " + cmd[2] + ";"; break; case 58: - tempCode += "return " + cmd[2] + ";"; + //tempCode += "return " + cmd[2] + ";"; + this.ip=cmd[2]; break; } break; @@ -725,7 +742,6 @@ function Parser(simpleGetPut,useAudio) default: break; } - this.ip++; } eval("this.evalCode = function(me,x,y) {" + tempCode + " return -15498;};"); } @@ -755,14 +771,8 @@ function Parser(simpleGetPut,useAudio) } this.exec = function(x,y) { - var cmd; - var a; - var stacka = this.stacka; - while(this.ip>=0) - { + while(this.ip>=0 && this.ip<this.parsedCode.length) this.ip = this.evals[this.ip](this,x,y)+1; - if(this.ip>=this.parsedCode.length) this.ip=-15498; - } } this.useFFAudio = false; this.useChromeAudio = false; @@ -846,6 +856,8 @@ var pause = document.getElementById("pause"); var simpleGetPut = document.getElementById("simpleGetPut"); var useAudio = document.getElementById("useAudio"); var recalcAudio = document.getElementById("recalcAudio"); +var exampleApps = document.getElementById("example_apps"); +var exampleAppID = -1; function derp() { if(!pause.checked) @@ -859,6 +871,11 @@ function derp() p.configureStackmode(); p.config(simpleGetPut.checked,useAudio.checked,recalcAudio.checked); fpsField.childNodes[1].nodeValue=fps.toFixed(2) + " (about " + (fps*65536*p.parsedCode.length).toFixed(0) + " cycles)"; + if(exampleApps.selectedIndex!=exampleAppID) + { + exampleAppID=exampleApps.selectedIndex; + codeEdit.value = exampleApps.options[exampleAppID].value; + } if(runningCode!=codeEdit.value) { p.t=0;