mirror of
https://github.com/bdnugget/jor1k.git
synced 2026-11-07 04:27:27 +00:00
move demos to demo folder
This commit is contained in:
1 parent
01f072aefa
commit
3ba172d65f
18 files changed
+338
-299
No files matched your search
@@ -9,8 +9,8 @@ More information can be found on the [Wiki][project wiki] pages.
|
||||
### Demos
|
||||
|
||||
* Main [demo][project demo] page
|
||||
* [Edit, compile and run](http://s-macke.github.io/jor1k/compile.html) C code in your browser
|
||||
* Symmetric multiprocessing with [2 cores](http://s-macke.github.io/jor1k/index.html?cpu=smp&n=2), [4 cores](http://s-macke.github.io/jor1k/index.html?cpu=smp&n=4), [8 cores](http://s-macke.github.io/jor1k/index.html?cpu=smp&n=8), [16 cores](http://s-macke.github.io/jor1k/index.html?cpu=smp&n=16) (unstable with inreasing cores)
|
||||
* [Edit, compile and run](http://s-macke.github.io/jor1k/demos/compile.html) C code in your browser
|
||||
* Symmetric multiprocessing with [2 cores](http://s-macke.github.io/jor1k/demos/main.html?cpu=smp&n=2), [4 cores](http://s-macke.github.io/jor1k/demos/main.html?cpu=smp&n=4), [8 cores](http://s-macke.github.io/jor1k/demos/main.html?cpu=smp&n=8), [16 cores](http://s-macke.github.io/jor1k/demos/main/index.html?cpu=smp&n=16) (unstable with inreasing cores)
|
||||
* Simple [demo](http://s-macke.github.io/jor1k/demos/simple.html)
|
||||
|
||||
|
||||
@@ -35,6 +35,6 @@ Neelabh Gupta [github.com/neelabhg](http://github.com/neelabhg)
|
||||
|
||||
|
||||
[or1k specification]: http://opencores.org/or1k/Main_Page
|
||||
[project demo]: http://s-macke.github.com/jor1k/
|
||||
[project demo]: http://s-macke.github.com/jor1k/demos/main.html
|
||||
[project issues]: https://github.com/s-macke/jor1k/issues
|
||||
[project wiki]: https://github.com/s-macke/jor1k/wiki
|
||||
@@ -1,4 +1,4 @@
|
||||
<FS src='bin/sysroot'>
|
||||
<FS src='sysroot'>
|
||||
<Dir name='bin' mode='40755'>
|
||||
<Link name='login' mode='120777' path='busybox' />
|
||||
<Link name='kbd_mode' mode='120777' path='busybox' />
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
<FS src='bin/sysroot'>
|
||||
<FS src='sysroot'>
|
||||
<Dir name='bin' mode='40755'>
|
||||
<Link name='login' mode='120777' path='busybox' />
|
||||
<Link name='kbd_mode' mode='120777' path='busybox' />
|
||||
|
||||
+50
-24
@@ -1467,6 +1467,8 @@ var download = require('../lib/download');
|
||||
var utils = require('./utils');
|
||||
var message = require('./messagehandler');
|
||||
|
||||
var TERMINAL = 0xDEADBEEF;
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
@@ -1478,14 +1480,16 @@ function jor1kGUI(parameters)
|
||||
// --- parameters parsing ---
|
||||
this.params.system = this.params.system || {};
|
||||
|
||||
this.params.system.kernelURL = this.params.system.kernelURL || "bin/vmlinux.bin.bz2";
|
||||
this.params.path = this.params.path || "";
|
||||
|
||||
this.params.system.kernelURL = this.params.system.kernelURL || "vmlinux.bin.bz2";
|
||||
this.params.system.memorysize = this.params.system.memorysize || 32;
|
||||
this.params.system.cpu = this.params.system.cpu || "asm";
|
||||
this.params.system.ncores = this.params.system.ncores || 1;
|
||||
|
||||
this.params.fs = this.params.fs || {};
|
||||
this.params.fs.basefsURL = this.params.fs.basefsURL || "bin/basefs.xml";
|
||||
this.params.fs.extendedfsURL = this.params.fs.extendedfsURL || "../jor1k-sysroot/fs.xml";
|
||||
this.params.fs.basefsURL = this.params.fs.basefsURL || "basefs.xml";
|
||||
// this.params.fs.extendedfsURL = this.params.fs.extendedfsURL || "";
|
||||
this.params.fs.earlyload = this.params.fs.earlyload || [];
|
||||
this.params.fs.lazyloadimages = this.params.fs.lazyloadimages || [];
|
||||
|
||||
@@ -1512,19 +1516,9 @@ function jor1kGUI(parameters)
|
||||
message.Register("GetFB", this.framebuffer.Update.bind(this.framebuffer));
|
||||
}
|
||||
|
||||
if (this.params.termid) {
|
||||
this.term = new Terminal(24, 80, this.params.termid);
|
||||
message.Register("tty0", function(d) {
|
||||
d.forEach(function(c) {
|
||||
this.term.PutChar(c&0xFF);
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
this.terminalcanvas = document.getElementById(this.params.termid);
|
||||
this.terminalcanvas.onmousedown = function(event) {
|
||||
if (!this.framebuffer) return;
|
||||
this.framebuffer.fbcanvas.style.border = "2px solid #000000";
|
||||
}.bind(this);
|
||||
if (this.params.term) {
|
||||
this.term = this.params.term;
|
||||
this.term.Init(this);
|
||||
}
|
||||
|
||||
this.terminput = new TerminalInput(this.SendChars.bind(this));
|
||||
@@ -1555,15 +1549,15 @@ function jor1kGUI(parameters)
|
||||
|
||||
this.IgnoreKeys = function() {
|
||||
return (
|
||||
(this.lastMouseDownTarget != this.terminalcanvas) &&
|
||||
(this.lastMouseDownTarget != TERMINAL) &&
|
||||
(this.lastMouseDownTarget != this.framebuffer.fbcanvas) &&
|
||||
(this.lastMouseDownTarget != this.clipboard)
|
||||
);
|
||||
}
|
||||
|
||||
var recordTarget = function(event) {
|
||||
if (this.terminalcanvas.contains(event.target))
|
||||
this.lastMouseDownTarget = this.terminalcanvas;
|
||||
if (this.term.WasHitByEvent(event))
|
||||
this.lastMouseDownTarget = TERMINAL;
|
||||
else
|
||||
this.lastMouseDownTarget = event.target;
|
||||
}.bind(this);
|
||||
@@ -1576,7 +1570,7 @@ function jor1kGUI(parameters)
|
||||
|
||||
document.onkeypress = function(event) {
|
||||
if(this.IgnoreKeys()) return true;
|
||||
if ((this.lastMouseDownTarget == this.terminalcanvas) || (this.lastMouseDownTarget == this.clipboard)) {
|
||||
if ((this.lastMouseDownTarget == TERMINAL) || (this.lastMouseDownTarget == this.clipboard)) {
|
||||
return this.terminput.OnKeyPress(event);
|
||||
}
|
||||
message.Send("keypress", {keyCode:event.keyCode, charCode:event.charCode});
|
||||
@@ -1585,7 +1579,7 @@ function jor1kGUI(parameters)
|
||||
|
||||
document.onkeydown = function(event) {
|
||||
if(this.IgnoreKeys()) return true;
|
||||
if ((this.lastMouseDownTarget == this.terminalcanvas) || (this.lastMouseDownTarget == this.clipboard)) {
|
||||
if ((this.lastMouseDownTarget == TERMINAL) || (this.lastMouseDownTarget == this.clipboard)) {
|
||||
return this.terminput.OnKeyDown(event);
|
||||
}
|
||||
message.Send("keydown", {keyCode:event.keyCode, charCode:event.charCode});
|
||||
@@ -1594,7 +1588,7 @@ function jor1kGUI(parameters)
|
||||
|
||||
document.onkeyup = function(event) {
|
||||
if(this.IgnoreKeys()) return true;
|
||||
if ((this.lastMouseDownTarget == this.terminalcanvas) || (this.lastMouseDownTarget == this.clipboard)) {
|
||||
if ((this.lastMouseDownTarget == TERMINAL) || (this.lastMouseDownTarget == this.clipboard)) {
|
||||
return this.terminput.OnKeyUp(event);
|
||||
}
|
||||
message.Send("keyup", {keyCode:event.keyCode, charCode:event.charCode});
|
||||
@@ -1660,7 +1654,7 @@ jor1kGUI.prototype.Reset = function () {
|
||||
message.Send("LoadFilesystem", this.params.fs);
|
||||
if (this.term) {
|
||||
this.term.PauseBlink(false);
|
||||
message.lastMouseDownTarget = this.terminalcanvas;
|
||||
message.lastMouseDownTarget = TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1775,4 +1769,36 @@ var Jor1k = require('./system');
|
||||
|
||||
module.exports = Jor1k;
|
||||
|
||||
},{"./system":9}]},{},[]);
|
||||
},{"./system":9}],"MackeTerm":[function(require,module,exports){
|
||||
var Terminal = require("../master/dev/terminal");
|
||||
|
||||
function MackeTerm(termid) {
|
||||
this.termid = termid;
|
||||
}
|
||||
|
||||
MackeTerm.prototype.Init = function(jor1kGUI) {
|
||||
this.term = new Terminal(24, 80, this.termid);
|
||||
jor1kGUI.message.Register("tty0", function(d) {
|
||||
d.forEach(function(c) {
|
||||
this.term.PutChar(c&0xFF);
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
this.terminalcanvas = document.getElementById(this.termid);
|
||||
this.terminalcanvas.onmousedown = function(event) {
|
||||
if (!jor1kGUI.framebuffer) return;
|
||||
jor1kGUI.framebuffer.fbcanvas.style.border = "2px solid #000000";
|
||||
}.bind(this);
|
||||
}
|
||||
|
||||
MackeTerm.prototype.WasHitByEvent = function(evt) {
|
||||
return this.terminalcanvas.contains(evt.target);
|
||||
}
|
||||
|
||||
MackeTerm.prototype.PauseBlink = function(pause) {
|
||||
this.term.PauseBlink(pause);
|
||||
}
|
||||
|
||||
module.exports = MackeTerm;
|
||||
|
||||
},{"../master/dev/terminal":7}]},{},[]);
|
||||
+4
-2
@@ -8630,7 +8630,9 @@ FS.prototype.LoadFilesystem = function(userinfo)
|
||||
this.userinfo = userinfo;
|
||||
this.fsloader.LoadXML(this.userinfo.basefsURL);
|
||||
this.OnLoaded = function() { // the basic filesystem is loaded, so download the rest
|
||||
this.fsloader.LoadXML(this.userinfo.extendedfsURL);
|
||||
if (this.userinfo.extendedfsURL) {
|
||||
this.fsloader.LoadXML(this.userinfo.extendedfsURL);
|
||||
}
|
||||
for(var i=0; i<this.userinfo.lazyloadimages.length; i++) {
|
||||
this.LoadImage(this.userinfo.lazyloadimages[i]);
|
||||
}
|
||||
@@ -9661,7 +9663,7 @@ function Debug(message) {
|
||||
}
|
||||
|
||||
function Abort() {
|
||||
DebugMessage("Abort execution.");
|
||||
Debug("Abort execution.");
|
||||
Send("Stop", {});
|
||||
throw new Error('Kill worker');
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
browserify -r ./js/plugins/terminal-macke.js:MackeTerm -r ./js/plugins/terminal-termjs.js:TermJSTerm -r ./js/master/master.js:Jor1k -o jor1k-master-min.js
|
||||
browserify js/worker/worker.js -o jor1k-worker-min.js
|
||||
browserify -r ./js/plugins/terminal-macke.js:MackeTerm -r ./js/master/master.js:Jor1k -o bin/jor1k-master-min.js
|
||||
browserify js/worker/worker.js -o bin/jor1k-worker-min.js
|
||||
|
||||
#browserify -r ./js/plugins/terminal-macke.js:MackeTerm -r ./js/plugins/terminal-termjs.js:TermJSTerm -r ./js/master/master.js:Jor1k -o bin/jor1k-master-min.js
|
||||
|
||||
@@ -97,8 +97,8 @@ Theme<select onchange='editor.setTheme("ace/theme/"+this.options[this.selectedIn
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<script src="js/lib/ace-editor-src-min-noconflict/ace.js"></script>
|
||||
<script src="jor1k-master-min.js"></script>
|
||||
<script src="../js/lib/ace-editor-src-min-noconflict/ace.js"></script>
|
||||
<script src="../bin/jor1k-master-min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -126,15 +126,15 @@ function Start() {
|
||||
|
||||
jor1kparameters = {
|
||||
system: {
|
||||
kernelURL: "bin/vmlinux.bin.bz2", // kernel image
|
||||
kernelURL: "vmlinux.bin.bz2", // kernel image
|
||||
memorysize: 32, // in MB, must be a power of two
|
||||
cpu: "asm", // short name for the cpu to use
|
||||
ncores: 1,
|
||||
},
|
||||
|
||||
fs: {
|
||||
basefsURL: "bin/basefs-compile.xml", // xml file with the basic filesystem configuration.
|
||||
extendedfsURL: "../jor1k-sysroot/fs.xml", // xml file with extended filesystem informations. Loaded after the basic filesystem has been loaded.
|
||||
basefsURL: "basefs-compile.xml", // xml file with the basic filesystem configuration.
|
||||
extendedfsURL: "../../jor1k-sysroot/fs.xml", // xml file with extended filesystem informations. Loaded after the basic filesystem has been loaded.
|
||||
earlyload: [
|
||||
"usr/bin/gcc",
|
||||
"usr/libexec/gcc/or1k-linux-musl/4.9.0/cc1",
|
||||
@@ -155,7 +155,8 @@ function Start() {
|
||||
userid: userid, // unique user id string. Empty, choosen randomly, from a url, or from a cookie.
|
||||
syncURL: "http://jor1k.com/sync/upload.php", // url to sync a certain folder
|
||||
fps: 10, // update interval of framebuffer
|
||||
memorysize: 32 // in MB, must be a power of two
|
||||
memorysize: 32, // in MB, must be a power of two
|
||||
path: "../bin/",
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+256
@@ -0,0 +1,256 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jor1k: OpenRISC OR1K Javascript Emulator Running Linux With Network Support</title>
|
||||
<meta name="keywords" content="opencore, emulation, or1000, javascript, linux">
|
||||
<meta name="author" content="Sebastian Macke">
|
||||
<link rel="stylesheet" href="css/default.css">
|
||||
</head>
|
||||
<body onload="Start()">
|
||||
<canvas id="fbfullscreen" width="640" height="400" style="width: 0px; height: 0px;">
|
||||
Framebuffer uses canvas
|
||||
</canvas>
|
||||
<div class="heading">
|
||||
<a href="http://opencores.org/or1k/"><img src="images/globe.png"/></a>
|
||||
<h1>jor1k: OpenRISC OR1K Javascript Emulator Running Linux With Network Support</h1>
|
||||
</div>
|
||||
<div class="windows">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align: top">
|
||||
<table>
|
||||
<tr><td>
|
||||
<canvas id="tty" class="screen" width="640" height="384">
|
||||
Terminal uses canvas
|
||||
</canvas>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
<span style="float: left" >
|
||||
<form style="display: inline;">
|
||||
<select id="coreselect" onchange='jor1kgui.ChangeCore(this.options[this.selectedIndex].value)'>
|
||||
<option value="asm">asm.js Core</option>
|
||||
<option value="safe">Safe Core (Slow)</option>
|
||||
</select>
|
||||
<select id="fpsselect" onchange='jor1kgui.framebuffer.SetFPS(this.options[this.selectedIndex].value)'>
|
||||
<option value="0">0 FPS</option>
|
||||
<option value="5"> 5 FPS</option>
|
||||
<option value="10" selected>10 FPS </option>
|
||||
<option value="20">20 FPS</option>
|
||||
<option value="30">30 FPS</option>
|
||||
</select>
|
||||
</form>
|
||||
<label>
|
||||
<img src="images/upload.png" width="20px" height="20px" title="Upload to home folder" />
|
||||
<input type="file" id="files" style="visibility:hidden;width:0; height:0;" name="files[]" onchange='OnUploadFiles(this.files)' multiple />
|
||||
</label>
|
||||
<img src="images/tar.png" width="20px" height="20px" onclick='jor1kgui.TAR("home/user")' title="Download of home folder" />
|
||||
<img src="images/sync.png" width="20px" height="20px" onclick='jor1kgui.Sync("home/user")' title="Sync with server" />
|
||||
<img src="images/fullscreen.png" width="20px" height="20px" onclick='Fullscreen()' title="Windowed fullscreen of framebuffer" />
|
||||
<textarea style="height: 20px;" type=text cols="5" rows="1" id="clipboard">clipb</textarea>
|
||||
<input type="checkbox" onclick='jor1kgui.sound.Enabled(this.checked)'>Sound
|
||||
</span>
|
||||
<span id="stats" style="float: right"></span>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
<td style="vertical-align: top">
|
||||
<canvas id="fb" class="screen" width="640" height="400">
|
||||
Framebuffer uses canvas
|
||||
</canvas>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="infobox">
|
||||
<h3>Links</h3>
|
||||
<ul>
|
||||
<li><a href="compile.html">Edit, compile and run</a> C code in your browser</li>
|
||||
<li><a href="https://github.com/s-macke/jor1k/wiki/Explore-the-emulator">Explore the emulator</a> wiki page</li>
|
||||
<li><a href="http://www.benjamincburns.com/2013/11/10/jor1k-ethmac-support.html">Ben's blog post about network support</a></li>
|
||||
<li><a href="https://github.com/s-macke/jor1k/">Project</a> page at github</li>
|
||||
<li><a href="https://github.com/s-macke/jor1k/issues">Bugtracker</a> to report any issues or feature requests</li>
|
||||
<li><a href="https://github.com/s-macke/jor1k/wiki">Wiki</a> containing more detailed descriptions</li>
|
||||
<li><a href="http://opencores.org/or1k/">Official site</a> of the openrisc project</li>
|
||||
</ul>
|
||||
|
||||
<h3>Developer and contributors</h3>
|
||||
<ul>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Main developer - Sebastian Macke <a href="http://simulationcorner.net/">simulationcorner.net</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Network support - Ben Burns <a href="http://www.benjamincburns.com">benjamincburns.com</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Gerard Braad <a href="http://gbraad.nl">gbraad.nl</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Compilation Demo - Neelabh Gupta</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Compilation Demo and UART support - Lawrence Angrave</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3>Donate</h3>
|
||||
|
||||
<ul>
|
||||
<li>If you like the project, please support it</li>
|
||||
<li class="donate">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||
<input type="hidden" name="cmd" value="_s-xclick">
|
||||
<input type="hidden" name="hosted_button_id" value="YNEZT8JALL7VS">
|
||||
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script src="../bin/jor1k-master-min.js"></script>
|
||||
|
||||
<script>
|
||||
var Jor1k = require("Jor1k");
|
||||
|
||||
|
||||
function Fullscreen()
|
||||
{
|
||||
document.body.style.margin = '0px';
|
||||
window.onresize = function(event) {
|
||||
var w = window,
|
||||
d = document,
|
||||
e = d.documentElement,
|
||||
g = d.getElementsByTagName('body')[0],
|
||||
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
||||
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
|
||||
|
||||
var d = x/y;
|
||||
if (d > 1.6) x = y*1.6; else y = x/1.6;
|
||||
|
||||
var fb = document.getElementById("fbfullscreen");
|
||||
fb.style.width = "" + x + "px";
|
||||
fb.style.height = "" + y + "px";
|
||||
};
|
||||
window.onresize();
|
||||
jor1kgui.framebuffer.Init("fbfullscreen");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function OnUploadFiles(files)
|
||||
{
|
||||
for (var i = 0, f; f = files[i]; i++) {
|
||||
jor1kgui.UploadExternalFile(f);
|
||||
}
|
||||
}
|
||||
|
||||
function RandomString(length) {
|
||||
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
var result = '';
|
||||
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
|
||||
return result;
|
||||
}
|
||||
|
||||
function Start() {
|
||||
|
||||
var userid = RandomString(10);
|
||||
|
||||
var MackeTerm = require("MackeTerm");
|
||||
|
||||
jor1kparameters = {
|
||||
system: {
|
||||
kernelURL: "vmlinux.bin.bz2", // kernel image
|
||||
memorysize: 32, // in MB, must be a power of two
|
||||
cpu: "asm", // short name for the cpu to use
|
||||
ncores: 1,
|
||||
},
|
||||
fs: {
|
||||
basefsURL: "basefs.xml", // xml file with the basic filesystem configuration.
|
||||
extendedfsURL: "../../jor1k-sysroot/fs.xml", // xml file with extended filesystem informations. Loaded after the basic filesystem has been loaded.
|
||||
earlyload: [], // list of files which should be loaded immediately after they appear in the filesystem
|
||||
lazyloadimages: [
|
||||
] // list of automatically loaded images after the basic filesystem has been loaded
|
||||
},
|
||||
|
||||
term: new MackeTerm("tty"), // canvas id for the terminal
|
||||
fbid: "fb", // canvas id for the framebuffer
|
||||
clipboardid: "clipboard", // input id for the clipboard
|
||||
statsid: "stats", // object id for the statistics test
|
||||
fps: 10, // update interval of framebuffer
|
||||
relayURL: "ws://relay.widgetry.org/", // relay url for the network
|
||||
userid: userid, // unique user id string. Empty, choosen randomly, from a url, or from a cookie.
|
||||
syncURL: "http://jor1k.com/sync/upload.php", // url to sync a certain folder
|
||||
path: "../bin/",
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// parse URL
|
||||
var loc = document.URL.split('?');
|
||||
userid = "";
|
||||
if (loc[1]) {
|
||||
var params = loc[1].split('&');
|
||||
for(var i=0; i<params.length; i++) {
|
||||
if (params[i].substr(0,4) == "user") {
|
||||
userid = params[i].split('=')[1];
|
||||
jor1kparameters.userid = userid;
|
||||
jor1kparameters.fs.lazyloadimages.push("http://jor1k.com/sync/tarballs/"+userid+".tar.bz2");
|
||||
}
|
||||
if (params[i].substr(0,3) == "cpu") {
|
||||
jor1kparameters.system.cpu = params[i].split('=')[1];
|
||||
if (jor1kparameters.system.cpu == "smp") {
|
||||
console.log("Load smp kernel");
|
||||
jor1kparameters.system.kernelURL = "bin/vmlinuxsmp.bin.bz2";
|
||||
jor1kparameters.system.ncores = 4;
|
||||
}
|
||||
}
|
||||
if (params[i].substr(0,1) == "n") {
|
||||
jor1kparameters.system.ncores = params[i].split('=')[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userid == "") {
|
||||
if (loc[1])
|
||||
window.history.pushState([], "", location + "&user="+jor1kparameters.userid);
|
||||
else
|
||||
window.history.pushState([], "", location + "?user="+jor1kparameters.userid);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
jor1kgui = new Jor1k(jor1kparameters);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-44129312-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
|
||||
<div id="console">
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+2
-2
@@ -6,14 +6,14 @@
|
||||
Terminal uses canvas
|
||||
</canvas>
|
||||
|
||||
<script src="../jor1k-master-min.js"></script>
|
||||
<script src="../bin/jor1k-master-min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
var Jor1k = require("Jor1k");
|
||||
var MackeTerm = require("MackeTerm");
|
||||
|
||||
jor1kgui = new Jor1k({term: new MackeTerm("tty"), path: "../"});
|
||||
jor1kgui = new Jor1k({term: new MackeTerm("tty"), path: "../bin/"});
|
||||
|
||||
</script>
|
||||
|
||||
+2
-254
@@ -1,255 +1,3 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>jor1k: OpenRISC OR1K Javascript Emulator Running Linux With Network Support</title>
|
||||
<meta name="keywords" content="opencore, emulation, or1000, javascript, linux">
|
||||
<meta name="author" content="Sebastian Macke">
|
||||
<link rel="stylesheet" href="css/default.css">
|
||||
</head>
|
||||
<body onload="Start()">
|
||||
<canvas id="fbfullscreen" width="640" height="400" style="width: 0px; height: 0px;">
|
||||
Framebuffer uses canvas
|
||||
</canvas>
|
||||
<div class="heading">
|
||||
<a href="http://opencores.org/or1k/"><img src="images/globe.png"/></a>
|
||||
<h1>jor1k: OpenRISC OR1K Javascript Emulator Running Linux With Network Support</h1>
|
||||
</div>
|
||||
<div class="windows">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="vertical-align: top">
|
||||
<table>
|
||||
<tr><td>
|
||||
<canvas id="tty" class="screen" width="640" height="384">
|
||||
Terminal uses canvas
|
||||
</canvas>
|
||||
</td></tr>
|
||||
<tr><td>
|
||||
<span style="float: left" >
|
||||
<form style="display: inline;">
|
||||
<select id="coreselect" onchange='jor1kgui.ChangeCore(this.options[this.selectedIndex].value)'>
|
||||
<option value="asm">asm.js Core</option>
|
||||
<option value="safe">Safe Core (Slow)</option>
|
||||
</select>
|
||||
<select id="fpsselect" onchange='jor1kgui.framebuffer.SetFPS(this.options[this.selectedIndex].value)'>
|
||||
<option value="0">0 FPS</option>
|
||||
<option value="5"> 5 FPS</option>
|
||||
<option value="10" selected>10 FPS </option>
|
||||
<option value="20">20 FPS</option>
|
||||
<option value="30">30 FPS</option>
|
||||
</select>
|
||||
</form>
|
||||
<label>
|
||||
<img src="images/upload.png" width="20px" height="20px" title="Upload to home folder" />
|
||||
<input type="file" id="files" style="visibility:hidden;width:0; height:0;" name="files[]" onchange='OnUploadFiles(this.files)' multiple />
|
||||
</label>
|
||||
<img src="images/tar.png" width="20px" height="20px" onclick='jor1kgui.TAR("home/user")' title="Download of home folder" />
|
||||
<img src="images/sync.png" width="20px" height="20px" onclick='jor1kgui.Sync("home/user")' title="Sync with server" />
|
||||
<img src="images/fullscreen.png" width="20px" height="20px" onclick='Fullscreen()' title="Windowed fullscreen of framebuffer" />
|
||||
<textarea style="height: 20px;" type=text cols="5" rows="1" id="clipboard">clipb</textarea>
|
||||
<input type="checkbox" onclick='jor1kgui.sound.Enabled(this.checked)'>Sound
|
||||
</span>
|
||||
<span id="stats" style="float: right"></span>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
<td style="vertical-align: top">
|
||||
<canvas id="fb" class="screen" width="640" height="400">
|
||||
Framebuffer uses canvas
|
||||
</canvas>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="infobox">
|
||||
<h3>Links</h3>
|
||||
<ul>
|
||||
<li><a href="compile.html">Edit, compile and run</a> C code in your browser</li>
|
||||
<li><a href="https://github.com/s-macke/jor1k/wiki/Explore-the-emulator">Explore the emulator</a> wiki page</li>
|
||||
<li><a href="http://www.benjamincburns.com/2013/11/10/jor1k-ethmac-support.html">Ben's blog post about network support</a></li>
|
||||
<li><a href="https://github.com/s-macke/jor1k/">Project</a> page at github</li>
|
||||
<li><a href="https://github.com/s-macke/jor1k/issues">Bugtracker</a> to report any issues or feature requests</li>
|
||||
<li><a href="https://github.com/s-macke/jor1k/wiki">Wiki</a> containing more detailed descriptions</li>
|
||||
<li><a href="http://opencores.org/or1k/">Official site</a> of the openrisc project</li>
|
||||
</ul>
|
||||
|
||||
<h3>Developer and contributors</h3>
|
||||
<ul>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Main developer - Sebastian Macke <a href="http://simulationcorner.net/">simulationcorner.net</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Network support - Ben Burns <a href="http://www.benjamincburns.com">benjamincburns.com</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Gerard Braad <a href="http://gbraad.nl">gbraad.nl</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Compilation Demo - Neelabh Gupta</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="contributor">
|
||||
<ul>
|
||||
<li class="contributor-info">Compilation Demo and UART support - Lawrence Angrave</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3>Donate</h3>
|
||||
|
||||
<ul>
|
||||
<li>If you like the project, please support it</li>
|
||||
<li class="donate">
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||
<input type="hidden" name="cmd" value="_s-xclick">
|
||||
<input type="hidden" name="hosted_button_id" value="YNEZT8JALL7VS">
|
||||
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
||||
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script src="jor1k-master-min.js"></script>
|
||||
|
||||
<script>
|
||||
var Jor1k = require("Jor1k");
|
||||
|
||||
|
||||
function Fullscreen()
|
||||
{
|
||||
document.body.style.margin = '0px';
|
||||
window.onresize = function(event) {
|
||||
var w = window,
|
||||
d = document,
|
||||
e = d.documentElement,
|
||||
g = d.getElementsByTagName('body')[0],
|
||||
x = w.innerWidth || e.clientWidth || g.clientWidth,
|
||||
y = w.innerHeight|| e.clientHeight|| g.clientHeight;
|
||||
|
||||
var d = x/y;
|
||||
if (d > 1.6) x = y*1.6; else y = x/1.6;
|
||||
|
||||
var fb = document.getElementById("fbfullscreen");
|
||||
fb.style.width = "" + x + "px";
|
||||
fb.style.height = "" + y + "px";
|
||||
};
|
||||
window.onresize();
|
||||
jor1kgui.framebuffer.Init("fbfullscreen");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function OnUploadFiles(files)
|
||||
{
|
||||
for (var i = 0, f; f = files[i]; i++) {
|
||||
jor1kgui.UploadExternalFile(f);
|
||||
}
|
||||
}
|
||||
|
||||
function RandomString(length) {
|
||||
var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
var result = '';
|
||||
for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
|
||||
return result;
|
||||
}
|
||||
|
||||
function Start() {
|
||||
|
||||
var userid = RandomString(10);
|
||||
|
||||
var MackeTerm = require("MackeTerm");
|
||||
|
||||
jor1kparameters = {
|
||||
system: {
|
||||
kernelURL: "bin/vmlinux.bin.bz2", // kernel image
|
||||
memorysize: 32, // in MB, must be a power of two
|
||||
cpu: "asm", // short name for the cpu to use
|
||||
ncores: 1,
|
||||
},
|
||||
fs: {
|
||||
basefsURL: "bin/basefs.xml", // xml file with the basic filesystem configuration.
|
||||
extendedfsURL: "../jor1k-sysroot/fs.xml", // xml file with extended filesystem informations. Loaded after the basic filesystem has been loaded.
|
||||
earlyload: [], // list of files which should be loaded immediately after they appear in the filesystem
|
||||
lazyloadimages: [
|
||||
] // list of automatically loaded images after the basic filesystem has been loaded
|
||||
},
|
||||
|
||||
term: new MackeTerm("tty"), // canvas id for the terminal
|
||||
fbid: "fb", // canvas id for the framebuffer
|
||||
clipboardid: "clipboard", // input id for the clipboard
|
||||
statsid: "stats", // object id for the statistics test
|
||||
fps: 10, // update interval of framebuffer
|
||||
relayURL: "ws://relay.widgetry.org/", // relay url for the network
|
||||
userid: userid, // unique user id string. Empty, choosen randomly, from a url, or from a cookie.
|
||||
syncURL: "http://jor1k.com/sync/upload.php", // url to sync a certain folder
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// parse URL
|
||||
var loc = document.URL.split('?');
|
||||
userid = "";
|
||||
if (loc[1]) {
|
||||
var params = loc[1].split('&');
|
||||
for(var i=0; i<params.length; i++) {
|
||||
if (params[i].substr(0,4) == "user") {
|
||||
userid = params[i].split('=')[1];
|
||||
jor1kparameters.userid = userid;
|
||||
jor1kparameters.fs.lazyloadimages.push("http://jor1k.com/sync/tarballs/"+userid+".tar.bz2");
|
||||
}
|
||||
if (params[i].substr(0,3) == "cpu") {
|
||||
jor1kparameters.system.cpu = params[i].split('=')[1];
|
||||
if (jor1kparameters.system.cpu == "smp") {
|
||||
console.log("Load smp kernel");
|
||||
jor1kparameters.system.kernelURL = "bin/vmlinuxsmp.bin.bz2";
|
||||
jor1kparameters.system.ncores = 4;
|
||||
}
|
||||
}
|
||||
if (params[i].substr(0,1) == "n") {
|
||||
jor1kparameters.system.ncores = params[i].split('=')[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (userid == "") {
|
||||
if (loc[1])
|
||||
window.history.pushState([], "", location + "&user="+jor1kparameters.userid);
|
||||
else
|
||||
window.history.pushState([], "", location + "?user="+jor1kparameters.userid);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
jor1kgui = new Jor1k(jor1kparameters);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
ga('create', 'UA-44129312-1', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
|
||||
|
||||
<div id="console">
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<META HTTP-EQUIV="Refresh"
|
||||
CONTENT="0; URL=demos/main.html">
|
||||
+5
-3
@@ -24,14 +24,16 @@ function jor1kGUI(parameters)
|
||||
// --- parameters parsing ---
|
||||
this.params.system = this.params.system || {};
|
||||
|
||||
this.params.system.kernelURL = this.params.system.kernelURL || "bin/vmlinux.bin.bz2";
|
||||
this.params.path = this.params.path || "";
|
||||
|
||||
this.params.system.kernelURL = this.params.system.kernelURL || "vmlinux.bin.bz2";
|
||||
this.params.system.memorysize = this.params.system.memorysize || 32;
|
||||
this.params.system.cpu = this.params.system.cpu || "asm";
|
||||
this.params.system.ncores = this.params.system.ncores || 1;
|
||||
|
||||
this.params.fs = this.params.fs || {};
|
||||
this.params.fs.basefsURL = this.params.fs.basefsURL || "bin/basefs.xml";
|
||||
this.params.fs.extendedfsURL = this.params.fs.extendedfsURL || "../jor1k-sysroot/fs.xml";
|
||||
this.params.fs.basefsURL = this.params.fs.basefsURL || "basefs.xml";
|
||||
// this.params.fs.extendedfsURL = this.params.fs.extendedfsURL || "";
|
||||
this.params.fs.earlyload = this.params.fs.earlyload || [];
|
||||
this.params.fs.lazyloadimages = this.params.fs.lazyloadimages || [];
|
||||
|
||||
|
||||
@@ -76,7 +76,9 @@ FS.prototype.LoadFilesystem = function(userinfo)
|
||||
this.userinfo = userinfo;
|
||||
this.fsloader.LoadXML(this.userinfo.basefsURL);
|
||||
this.OnLoaded = function() { // the basic filesystem is loaded, so download the rest
|
||||
this.fsloader.LoadXML(this.userinfo.extendedfsURL);
|
||||
if (this.userinfo.extendedfsURL) {
|
||||
this.fsloader.LoadXML(this.userinfo.extendedfsURL);
|
||||
}
|
||||
for(var i=0; i<this.userinfo.lazyloadimages.length; i++) {
|
||||
this.LoadImage(this.userinfo.lazyloadimages[i]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user