1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-05-28 23:41:32 +00:00

Merge branch 'master' of github.com:sehugg/8bitworkshop

This commit is contained in:
Steven Hugg 2018-06-25 17:51:07 -04:00
commit 95a0eeca44
7 changed files with 559 additions and 329 deletions

1
dasm

@ -1 +0,0 @@
Subproject commit a938feeae106c7097882d4ad1581c06e91ef4b72

View File

@ -16,13 +16,38 @@ TODO:
- case sensisitvity looking for mismatch variables
- remove pulldown when no preset?
- can't step after reset (or when funky frame; TIA frame is out of sync)
- break on BRK/illegal opcode? (or warnings?)
- skeleton for each platform/tool (check?)
- disassembler/debugger
- break on BRK/illegal opcode?
- multiple breakpoints, expression breakpoints
- current exec. pos in gutter
- cc65: parse listing
- faster Z80 compile (maybe split up files?)
- projects w/ multiple files, navigation (need refactor UI, backend)
- nes: tools (nesst, tiled) https://shiru.untergrund.net/software.shtml
- use localForage (https://github.com/localForage/localForage)
- cc65 listing file parsing
- better disasm/listing selection
- disasm for z80
- projects w/ include files
- watchpoints
- breakpoints
- debug inspector
- MAME single step (?)
- step over
- slowdown beam for all platforms?
- kbd shortcuts
WEB WORKER FORMAT
{code,platform,tool,dependencies}
{preload}
new:
{infiles,buildsteps}
[{filepath,platform,tool}]
implicit rules
- push/shift build steps
- preprocessor, compile, assemble, link
- access to intermediate files
only build files that have changed
build options

View File

@ -471,6 +471,7 @@ function invertMap(m) {
}
function setCompileOutput(data) {
if (data.unchanged) return;
// TODO: kills current selection
sourcefile = new SourceFile(data.lines);
if (data.asmlines) {

View File

@ -34,7 +34,7 @@ function Blob(blob) {
global.XMLHttpRequest = function() {
this.open = function(a,b,c) {
if (this.responseType == 'json') {
var txt = fs.readFileSync(',/'+b);
var txt = fs.readFileSync('./'+b);
this.response = JSON.parse(txt);
} else if (this.responseType == 'blob') {
var data = fs.readFileSync('./'+b, {encoding:'binary'});
@ -66,6 +66,9 @@ global.ab2str = function(buf) {
if (require.main == module) {
var data = fs.readFileSync(process.argv[2]);
var result = handleMessage(JSON.parse(data));
console.log(result);
var msgs = JSON.parse(data);
for (var i=0; i<msgs.length; i++) {
var result = handleMessage(msgs[i]);
console.log(result);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,14 @@ global.onmessage({data:{preload:'sdcc'}});
//
function compile(tool, code, platform, callback, outlen, nlines, nerrors) {
var msgs = [{code:code, platform:platform, tool:tool}];
doBuild(msgs, callback, outlen, nlines, nerrors);
}
function doBuild(msgs, callback, outlen, nlines, nerrors) {
var msgcount = msgs.length;
global.postMessage = function(msg) {
if (!msg.unchanged) {
if (msg.errors && msg.errors.length) {
console.log(msg.errors);
assert.equal(nerrors, msg.errors.length, "errors");
@ -18,11 +25,16 @@ function compile(tool, code, platform, callback, outlen, nlines, nerrors) {
assert.equal(msg.output.code?msg.output.code.length:msg.output.length, outlen, "output binary");
assert.equal(msg.lines.length, nlines, "listing lines");
}
}
if (--msgcount == 0)
callback(null, msg);
else
console.log(msgcount + ' msgs left');
};
global.onmessage({
data:{code:code, platform:platform, tool:tool}
});
global.onmessage({data:{reset:true}});
for (var i=0; i<msgs.length; i++) {
global.onmessage({data:msgs[i]});
}
}
describe('Worker', function() {
@ -32,13 +44,13 @@ describe('Worker', function() {
it('should NOT assemble DASM', function(done) {
compile('dasm', '\tprocessor 6502\n\torg $f000\nfoo xxx #0\n', 'vcs', done, 0, 0, 1);
});
/*
it('should assemble ACME', function(done) {
compile('acme', 'foo: lda #0\n', 'vcs', done, 2, 0); // TODO
});
it('should NOT assemble ACME', function(done) {
compile('acme', 'foo: xxx #0\n', 'vcs', done, 0, 0, 2); // TODO
});
/*
it('should compile PLASMA', function(done) {
compile('plasm', 'word x = 0', 'apple2', done, 5, 0);
});
@ -52,12 +64,14 @@ describe('Worker', function() {
it('should NOT compile CC65', function(done) {
compile('cc65', 'int main() {\nint x=1;\nprintf("%d",x);\nreturn x+2;\n}', 'nes-conio', done, 0, 0, 1);
});
/*
it('should assemble Z80ASM', function(done) {
compile('z80asm', '\tMODULE test\n\tEXTERN _puts\n\tld hl,$0000\n\tret\n', 'mw8080bw', done, 4, 2, 0);
});
it('should NOT assemble Z80ASM', function(done) {
compile('z80asm', 'ddwiuweq', 'mw8080bw', done, 0, 0, 1);
});
*/
it('should assemble SDASZ80', function(done) {
compile('sdasz80', '\tld hl,#0\n\tret\n', 'mw8080bw', done, 8192, 2);
});
@ -118,4 +132,66 @@ describe('Worker', function() {
compile('xasm6809', '\tasld\n\tasld\n', 'mw8080bw', done, 4, 2, 0);
});
*/
it('should link two files with SDCC', function(done) {
var msgs = [
{
"updates":[
{"path":"main.c", "data":"extern int mul2(int x);\nint main() { return mul2(2); }\n"},
{"path":"fn.c", "data":"int mul2(int x) { return x*x; }\n"}
],
"buildsteps":[
{"path":"main.c", "platform":"mw8080bw", "tool":"sdcc"},
{"path":"fn.c", "platform":"mw8080bw", "tool":"sdcc"}
]
}
];
doBuild(msgs, done, 8192, 1, 0);
});
it('should not build unchanged files with CC65', function(done) {
var m = {
"updates":[
{"path":"main.c", "data":"extern int mul2(int x);\n int main() { return mul2(2); }\n"},
{"path":"fn.c", "data":"int mul2(int x) { return x*x; }\n"}
],
"buildsteps":[
{"path":"main.c", "platform":"nes-conio", "tool":"cc65"},
{"path":"fn.c", "platform":"nes-conio", "tool":"cc65"}
]
};
var m2 = {
"updates":[
{"path":"main.c", "data":"extern int mul2(int x); \nint main() { return mul2(2); }\n"}
],
"buildsteps":[
{"path":"main.c", "platform":"nes-conio", "tool":"cc65"},
{"path":"fn.c", "platform":"nes-conio", "tool":"cc65"}
]
};
var msgs = [m, m, m2];
doBuild(msgs, done, 40976, 1, 0);
});
it('should not build unchanged files with SDCC', function(done) {
var m = {
"updates":[
{"path":"main.c", "data":"extern int mul2(int x);\n int main() { return mul2(2); }\n"},
{"path":"fn.c", "data":"int mul2(int x) { return x*x; }\n"}
],
"buildsteps":[
{"path":"main.c", "platform":"mw8080bw", "tool":"sdcc"},
{"path":"fn.c", "platform":"mw8080bw", "tool":"sdcc"}
]
};
var m2 = {
"updates":[
{"path":"main.c", "data":"extern int mul2(int x); \nint main() { return mul2(2); }\n"}
],
"buildsteps":[
{"path":"main.c", "platform":"mw8080bw", "tool":"sdcc"},
{"path":"fn.c", "platform":"mw8080bw", "tool":"sdcc"}
]
};
var msgs = [m, m, m2];
doBuild(msgs, done, 8192, 1, 0);
});
});

View File

@ -40,10 +40,10 @@ global.XMLHttpRequest = function() {
this.response = JSON.parse(txt);
} else if (this.responseType == 'blob') {
var data = fs.readFileSync('src/worker/'+b, {encoding:'binary'});
//var buf = new ArrayBuffer(data.length);
//var blob = new Uint8Array(buf);
//blob.set(data);
this.response = new Blob(data);
} else if (this.responseType == 'arraybuffer') {
var data = fs.readFileSync('src/worker/'+b, {encoding:'binary'});
this.response = new Blob(data).asArrayBuffer();
}
}
this.send = function() { }