Commit e57c78c1 authored by Alexander Shabarshin's avatar Alexander Shabarshin

Moving from Weberta to Rgrid

parent 3cd55835
In order to compile circuits.rw1 you need latest RW1C compiler (v2.2.0 or above).
Currenlty you may compile RW1C from source code taken from http://sf.net/projects/nedopc
In order to compile circuits.rw1 you need RW1C compiler (at least v2.2.0)
cvs -d:pserver:anonymous@nedopc.cvs.sourceforge.net:/cvsroot/nedopc login
cvs -z3 -d:pserver:anonymous@nedopc.cvs.sourceforge.net:/cvsroot/nedopc co -P src
In order to compile TERNARO.R you need ROBBYC compiler (rebranded RW1C)
\ No newline at end of file
......@@ -2,8 +2,7 @@
<HEAD><TITLE>TERNARO PLAYGROUND</TITLE>
<META HTTP-EQUIV="Content-Language" content="en">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8">
<SCRIPT type="text/javascript" src="webitable.js"></SCRIPT>
<SCRIPT type="text/javascript" src="weberta.js"></SCRIPT>
<SCRIPT type="text/javascript" src="Rgrid.js"></SCRIPT>
<SCRIPT type="text/javascript" src="robot.js"></SCRIPT>
<SCRIPT type="text/javascript" src="ternaro.js"></SCRIPT>
</HEAD>
......@@ -12,60 +11,34 @@
<h3>TERNARO PLAYGROUND</h3>
</center>
<p id="tut" align=center>TERNARO.COM requires a modern web-browser to work properly...</p>
<p align=center>
<font size=-4>
<p id="pow" align=center>Powered...</p>
<p align=center>
Click <a href="https://hackaday.io/project/159905-ternaro">here</a> for more info about TERNARO FPGA
</font>
</p>
</font>
</BODY>
<script type="text/javascript">
var dx=90;
var dy=45;
$R.files = library;
$R.prefix = "www/pcb/";
function rob_get(x,y) {
return [ $R.table_get(x,y,0), $R.table_get(x,y,1) ];
}
function rob_set(x,y,n) {
var i = arguments[3];
$R.table_set(x,y,n);
if(i!=null) {
$R.table_set(x,y,i,1);
}
}
function rob_setc(x,y,c,o) {
rob_set(x,y,c.charCodeAt(0)+(o<<8));
}
function rob_sets(x,y,s,o) {
var i,l=s.length;
for(i=0;i<l;i++) {
rob_set(x+i,y,s.charCodeAt(i)+(o<<8));
}
return x+i;
}
function rob_seth(x,y,o) {
var c = rob_get(x,y)[0]&255;
rob_set(x,y,c+(o<<8));
return c;
}
$_("pow","Powered by " + $R.powered());
function tab_act(x,y) {
function action(x,y) {
$R.event(0,-1,1,x,y);
}
if($R.init('tut',dx,dy,tab_act)>0) {
var i,j,k=0,c=1;
if($R.grid('tut',dx,dy,action)>0) {
var i,j;
for(j=0;j<dy;j++){
for(i=0;i<dx;i++){
rob_set(i,j,32);
$R.set(i,j,32);
}}
$R.add(robot);
$W.start();
$R.start();
}
</script>
......
/* http://webitable.sourceforge.net (E-mail: shaos@users.sourceforge.net)
Webitable System - easily editable web pages for everyone
Copyright (C) 2012 Alexander Shabarshin (ashabarshin@gmail.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
var $W = {
lib_name: "Webitable",
ver_major: 0,
ver_minor: 2,
copyright: "(c) 2012 Alexander Shabarshin",
cache: {},
threads: [],
started: 0
};
$W.version = function() {
return "v" + this.ver_major +
"." + this.ver_minor;
};
$W.powered = function() {
return this.lib_name + " " + this.version() + " " + this.copyright;
};
$W.clear = function() {
this.cache = {};
};
$W.iterate = function(node) {
var base = this.cache["*"];
$map(node.childNodes,
function(e) {
if(e.id!=null && e.id!="") {
base.push(e);
}
$W.iterate(e);
return null;
}
);
}
$W.select = function(s) {
if(this.cache["*"]==null) {
this.cache["*"] = [];
this.iterate(document.body);
}
if(this.cache[s]==null) {
var w = s.replace(/\./g,"\\.").replace(/\*/g,".*");
this.cache[s] = $filter(this.cache["*"],
function(e) {
return e.id.search(w)==0;
}
);
}
return this.cache[s];
};
$W.create = function(p,t,s) {
if($(s)!=null) return 0;
var e = $(p);
if(e==null) return 0;
var n = document.createElement(t);
if(n==null) return 0;
n.id = s;
e.appendChild(n);
this.clear();
return 1;
}
$W.remove = function(s) {
var e = $(s);
if(e==null) return 0;
var p = e.parentNode;
p.removeChild(e);
this.clear();
return 1;
}
$W.table = function(p,h,w,s) {
var d = arguments[4];
var ts = s+"~";
if($(p)==null) return 0;
if($(s)!=null) return 0;
if($(ts)!=null) return 0;
if($$(s+'.*').lendth > 0) return 0;
$(p).innerHTML = "";
var r = this.create(p,"table",ts);
var t = $(ts);
t.setAttribute("cellPadding","0");
t.setAttribute("cellSpacing","0");
t.setAttribute("border","0");
r += this.create(ts,"tbody",s);
var i,j;
for(j=0;j<h;j++) {
var tr = s+"."+j;
r += this.create(s,"tr",tr);
for(i=0;i<w;i++) {
var td = tr+"."+i;
r += this.create(tr,"td",td);
if(d!=null) $_(td,d);
else $_(td,"&nbsp;");
}
}
return r;
}
$W.thread = function(obj) {
var m = this.threads.length;
this.threads[m] = {o:obj,c:[],a:0,p:1};
return m;
}
$W.stop = function() {
if(this.started!=0) {
clearInterval(this.started);
this.started = 0;
}
}
$W.start = function() {
var p = arguments[0]; // percentage
if(p==null) p=16; // 0.8 duty
else p=p/5; // for 20 ms
this.stop();
var sf = "";
for(var t in $W.threads) {
sf += "var t"+t+"=$W.threads["+t+"];if(t"+t+".f) t"+t+".a=t"+t+".f(t"+t+".o);";
}
sf += "var t=+new Date;while(+ new Date-t<"+p+"){";
var i,j=0;
while(j<100) {
for(var t in $W.threads) {
for(i=0;i<$W.threads[t].p;i++) {
sf += "t"+t+".a=t"+t+".c[t"+t+".a](t"+t+".o);";
j++;
}
}
}
sf += "}";
this.started = setInterval(new Function(sf),20);
}
function $(s) {
return document.getElementById(s);
}
function $_(s) {
var e = $(s);
var v = arguments[1];
if(e!=null)
{
if(v==null) {
if(e.value==null) {
return e.innerHTML;
} else {
return e.value;
}
} else {
if(e.value==null) {
e.innerHTML = v;
} else {
e.value = v;
}
return v;
}
}
}
function $__(s,u) {
var r = null;
var p = arguments[2];
try {
r = new XMLHttpRequest();
} catch(e) {
r = null;
}
if(r!=null)
{
r.onreadystatechange = function() {
if(r.readyState==4 && r.status==200) {
if(typeof s == 'string') {
$_(s,r.responseText);
}
if(typeof s == 'function') {
s(r.responseText);
}
}
}
if(p==null) {
r.open("GET",u,true);
r.send(null);
} else {
r.open("POST",u,true);
r.send(p);
}
}
}
function $$(s) {
return $W.select(s);
}
function $$_(s) {
return $map($$(s),function(e){return e.id;});
}
function $time() {
return Math.floor(+new Date/1000);
}
function $random(r) {
return Math.floor(r*Math.random());
}
function $map(a,f) {
var r = [];
for(var i in a) {
r.push(f(a[i]));
}
return r;
}
function $reduce(a,b,f) {
for(var i in a) {
b = f(b,a[i]);
}
return b;
}
function $filter(a,f) {
var r = [];
for(var i in a) {
if(f(a[i])) {
r.push(a[i]);
}
}
return r;
}
function $hex(i,j) {
var k,l,m=1,s="",r=i,g=1;
var h=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];
if(r<0) {
g = -1;
r = -i;
}
for(k=1;k<j;k++) {
m = m*16;
}
if(r >= m*16) {
g = 0;
r = r&(m*16-1);
}
for(k=0;k<j;k++) {
l = Math.floor(r/m);
r = r-l*m;
m = m/16;
s += h[l];
}
if(g<0) {
return "-" + s;
}
if(g==0) {
return "~" + s;
}
return s;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment