mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-19 07:30:55 +00:00
optimized cc65 files; new cc65 test
This commit is contained in:
parent
a3c26ea1b4
commit
ab89dd8b47
55667
src/worker/ca65.js
55667
src/worker/ca65.js
File diff suppressed because one or more lines are too long
92926
src/worker/cc65.js
92926
src/worker/cc65.js
File diff suppressed because one or more lines are too long
18622
src/worker/co65.js
18622
src/worker/co65.js
File diff suppressed because one or more lines are too long
43877
src/worker/ld65.js
43877
src/worker/ld65.js
File diff suppressed because one or more lines are too long
@ -36,7 +36,7 @@ var fsMeta, fsBlob;
|
|||||||
xhr.open("GET", "fs65.js.metadata", false); // synchronous request
|
xhr.open("GET", "fs65.js.metadata", false); // synchronous request
|
||||||
xhr.send(null);
|
xhr.send(null);
|
||||||
fsMeta = xhr.response;
|
fsMeta = xhr.response;
|
||||||
console.log("Loaded filesystem", fsMeta.files.length, 'files', fsBlob.size||fsBlob.length, 'bytes');
|
console.log("Loaded filesystem", fsMeta.files.length, 'files', fsBlob.size, 'bytes');
|
||||||
}
|
}
|
||||||
|
|
||||||
// mount the filesystem at /share
|
// mount the filesystem at /share
|
||||||
@ -53,7 +53,10 @@ var DASM_MAIN_FILENAME = "main.a";
|
|||||||
var DASM_PREAMBLE = "\tprocessor 6502\n";
|
var DASM_PREAMBLE = "\tprocessor 6502\n";
|
||||||
var DASM_PREAMBLE_LINES = 1;
|
var DASM_PREAMBLE_LINES = 1;
|
||||||
|
|
||||||
var print_fn = function(s) { console.log(s); }
|
var print_fn = function(s) {
|
||||||
|
console.log(s);
|
||||||
|
//console.log(new Error().stack);
|
||||||
|
}
|
||||||
|
|
||||||
function parseDASMListing(code, unresolved) {
|
function parseDASMListing(code, unresolved) {
|
||||||
var errorMatch = /main.a [(](\d+)[)]: error: (.+)/;
|
var errorMatch = /main.a [(](\d+)[)]: error: (.+)/;
|
||||||
|
@ -13,15 +13,36 @@ global.importScripts = function(path) {
|
|||||||
includeInThisContext('src/worker/'+path);
|
includeInThisContext('src/worker/'+path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Blob(blob) {
|
||||||
|
this.size = blob.length;
|
||||||
|
this.length = blob.length;
|
||||||
|
this.slice = function(a,b) {
|
||||||
|
var data = blob.slice(a,b);
|
||||||
|
var b = new Blob(data);
|
||||||
|
//console.log(a, b, data.length, data.slice(0,64));
|
||||||
|
//console.log(new Error().stack);
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
this.asArrayBuffer = function() {
|
||||||
|
var buf = new ArrayBuffer(blob.length);
|
||||||
|
var arr = new Uint8Array(buf);
|
||||||
|
for (var i=0; i<blob.length; i++)
|
||||||
|
arr[i] = blob[i].charCodeAt(0);
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
global.XMLHttpRequest = function() {
|
global.XMLHttpRequest = function() {
|
||||||
var txt;
|
|
||||||
this.open = function(a,b,c) {
|
this.open = function(a,b,c) {
|
||||||
txt = fs.readFileSync('src/worker/'+b);
|
|
||||||
if (this.responseType == 'json') {
|
if (this.responseType == 'json') {
|
||||||
|
var txt = fs.readFileSync('src/worker/'+b);
|
||||||
this.response = JSON.parse(txt);
|
this.response = JSON.parse(txt);
|
||||||
} else if (this.responseType == 'blob') {
|
} else if (this.responseType == 'blob') {
|
||||||
this.response = txt; //new Uint8Array(txt);
|
var data = fs.readFileSync('src/worker/'+b, {encoding:'binary'});
|
||||||
//console.log(this.response.slice(0,100));
|
//var buf = new ArrayBuffer(data.length);
|
||||||
|
//var blob = new Uint8Array(buf);
|
||||||
|
//blob.set(data);
|
||||||
|
this.response = new Blob(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.send = function() { }
|
this.send = function() { }
|
||||||
@ -29,7 +50,7 @@ global.XMLHttpRequest = function() {
|
|||||||
|
|
||||||
global.FileReaderSync = function() {
|
global.FileReaderSync = function() {
|
||||||
this.readAsArrayBuffer = function(blob) {
|
this.readAsArrayBuffer = function(blob) {
|
||||||
return blob.slice(0);
|
return blob.asArrayBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +61,7 @@ includeInThisContext("src/worker/workermain.js");
|
|||||||
|
|
||||||
function compile(tool, code, callback, outlen) {
|
function compile(tool, code, callback, outlen) {
|
||||||
global.postMessage = function(msg) {
|
global.postMessage = function(msg) {
|
||||||
//console.log(msg);
|
if (msg.listing.errors.length) console.log(msg.listing.errors);
|
||||||
assert.ok(msg.listing.lines);
|
assert.ok(msg.listing.lines);
|
||||||
assert.equal(msg.listing.errors.length, msg.listing.errors);
|
assert.equal(msg.listing.errors.length, msg.listing.errors);
|
||||||
assert.equal(msg.output.length, outlen);
|
assert.equal(msg.output.length, outlen);
|
||||||
@ -58,9 +79,7 @@ describe('Worker', function() {
|
|||||||
it('should compile PLASMA', function(done) {
|
it('should compile PLASMA', function(done) {
|
||||||
compile('plasm', 'word x = 0', done, 5);
|
compile('plasm', 'word x = 0', done, 5);
|
||||||
});
|
});
|
||||||
/*
|
|
||||||
it('should compile CC65', function(done) {
|
it('should compile CC65', function(done) {
|
||||||
compile('cc65', '#include <stdio.h>\nint main() {\nint x=1;\nreturn x+2;\n}', done, 5);
|
compile('cc65', '#include <stdio.h>\nint main() {\nint x=1;\nprintf("%d",x);\nreturn x+2;\n}', done, 2947);
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user