mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-23 18:31:08 +00:00
try to fix upload bug, retired TODOs, fixed tests for new node
This commit is contained in:
parent
d73e9963ce
commit
05f4d43d1e
@ -168,6 +168,7 @@ TODO:
|
|||||||
- re-publish repo (bug: doesn't put all files in local repo after publishing)
|
- re-publish repo (bug: doesn't put all files in local repo after publishing)
|
||||||
- allow text/binary change
|
- allow text/binary change
|
||||||
- importing from subtree commits to root anyway
|
- importing from subtree commits to root anyway
|
||||||
|
- publishing Markdown file loads default file?
|
||||||
- astrocade
|
- astrocade
|
||||||
- keyboard shortcuts
|
- keyboard shortcuts
|
||||||
- ctrl+alt+l on ubuntu locks screen
|
- ctrl+alt+l on ubuntu locks screen
|
||||||
|
@ -162,7 +162,6 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||||||
<a tabindex="-1" href="#">Computers</a>
|
<a tabindex="-1" href="#">Computers</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="?platform=apple2">Apple ][+</a></li>
|
<li><a class="dropdown-item" href="?platform=apple2">Apple ][+</a></li>
|
||||||
<li><a class="dropdown-item" href="?platform=c64">Commodore 64</a></li>
|
|
||||||
<li><a class="dropdown-item" href="?platform=msx">MSX (BIOS)</a></li>
|
<li><a class="dropdown-item" href="?platform=msx">MSX (BIOS)</a></li>
|
||||||
<li><a class="dropdown-item" href="?platform=msx-libcv">MSX (libCV)</a></li>
|
<li><a class="dropdown-item" href="?platform=msx-libcv">MSX (libCV)</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
26
src/ui.ts
26
src/ui.ts
@ -214,11 +214,13 @@ function refreshWindowList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addEditorItem(id:string) {
|
function addEditorItem(id:string) {
|
||||||
var data = current_project.getFile(id);
|
addWindowItem(id, getFilenameForPath(id), () => {
|
||||||
if (typeof data === 'string')
|
var data = current_project.getFile(id);
|
||||||
addWindowItem(id, getFilenameForPath(id), loadEditor);
|
if (typeof data === 'string')
|
||||||
else if (data instanceof Uint8Array)
|
return loadEditor(id);
|
||||||
addWindowItem(id, getFilenameForPath(id), () => { return new Views.BinaryFileView(id, data as Uint8Array); });
|
else if (data instanceof Uint8Array)
|
||||||
|
return new Views.BinaryFileView(id, data as Uint8Array);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// add main file editor
|
// add main file editor
|
||||||
@ -231,7 +233,6 @@ function refreshWindowList() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// add listings
|
// add listings
|
||||||
// TODO: update listing when recompiling
|
|
||||||
separate = true;
|
separate = true;
|
||||||
var listings = current_project.getListings();
|
var listings = current_project.getListings();
|
||||||
if (listings) {
|
if (listings) {
|
||||||
@ -276,9 +277,11 @@ function refreshWindowList() {
|
|||||||
addWindowItem("#crtheatmap", "CRT Probe", () => {
|
addWindowItem("#crtheatmap", "CRT Probe", () => {
|
||||||
return new Views.RasterPCHeatMapView();
|
return new Views.RasterPCHeatMapView();
|
||||||
});
|
});
|
||||||
|
/*
|
||||||
addWindowItem("#spheatmap", "Stack Probe", () => {
|
addWindowItem("#spheatmap", "Stack Probe", () => {
|
||||||
return new Views.RasterStackMapView();
|
return new Views.RasterStackMapView();
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
addWindowItem('#asseteditor', 'Asset Editor', () => {
|
addWindowItem('#asseteditor', 'Asset Editor', () => {
|
||||||
return new Views.AssetEditorView();
|
return new Views.AssetEditorView();
|
||||||
@ -391,7 +394,7 @@ function handleFileUpload(files: File[]) {
|
|||||||
if (confirm("Open '" + qs['file'] + "' as project?")) {
|
if (confirm("Open '" + qs['file'] + "' as project?")) {
|
||||||
gotoNewLocation();
|
gotoNewLocation();
|
||||||
} else {
|
} else {
|
||||||
updateSelector();
|
setTimeout(updateSelector, 1000); // TODO: wait for files to upload
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gaEvent('workspace', 'file', 'upload');
|
gaEvent('workspace', 'file', 'upload');
|
||||||
@ -688,7 +691,7 @@ function deleteRepository() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _shareEmbedLink(e) {
|
function _shareEmbedLink(e) {
|
||||||
if (current_output == null) { // TODO
|
if (current_output == null) {
|
||||||
alertError("Please fix errors before sharing.");
|
alertError("Please fix errors before sharing.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1011,7 +1014,7 @@ function setCompileOutput(data: WorkerResult) {
|
|||||||
compparams = data.params;
|
compparams = data.params;
|
||||||
// load ROM
|
// load ROM
|
||||||
var rom = data.output;
|
var rom = data.output;
|
||||||
if (rom) { // TODO instanceof Uint8Array) {
|
if (rom) {
|
||||||
try {
|
try {
|
||||||
clearBreakpoint(); // so we can replace memory (TODO: change toolbar btn)
|
clearBreakpoint(); // so we can replace memory (TODO: change toolbar btn)
|
||||||
_resetRecording();
|
_resetRecording();
|
||||||
@ -1019,7 +1022,6 @@ function setCompileOutput(data: WorkerResult) {
|
|||||||
current_output = rom;
|
current_output = rom;
|
||||||
if (!userPaused) _resume();
|
if (!userPaused) _resume();
|
||||||
measureBuildTime();
|
measureBuildTime();
|
||||||
// TODO: reset profiler etc? (Tell views?)
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
toolbar.addClass("has-errors");
|
toolbar.addClass("has-errors");
|
||||||
@ -1860,7 +1862,6 @@ function startPlatform() {
|
|||||||
// start platform and load file
|
// start platform and load file
|
||||||
replaceURLState();
|
replaceURLState();
|
||||||
platform.start();
|
platform.start();
|
||||||
// TODO: ordering of loads?
|
|
||||||
installGAHooks();
|
installGAHooks();
|
||||||
loadBIOSFromProject();
|
loadBIOSFromProject();
|
||||||
initProject();
|
initProject();
|
||||||
@ -1907,8 +1908,7 @@ function loadImportedURL(url : string) {
|
|||||||
setWaitDialog(true);
|
setWaitDialog(true);
|
||||||
getWithBinary(url, (data) => {
|
getWithBinary(url, (data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
var path = 'shared/' + getFilenameForPath(url); // TODO: shared prefix?
|
var path = 'shared/' + getFilenameForPath(url);
|
||||||
// TODO: progress dialog
|
|
||||||
console.log("Importing " + data.length + " bytes as " + path);
|
console.log("Importing " + data.length + " bytes as " + path);
|
||||||
store.getItem(path, (err, olddata) => {
|
store.getItem(path, (err, olddata) => {
|
||||||
setWaitDialog(false);
|
setWaitDialog(false);
|
||||||
|
@ -11,7 +11,7 @@ import * as pixed from "./pixed/pixeleditor";
|
|||||||
declare var Mousetrap;
|
declare var Mousetrap;
|
||||||
|
|
||||||
export interface ProjectView {
|
export interface ProjectView {
|
||||||
createDiv(parent:HTMLElement, text:string) : HTMLElement;
|
createDiv(parent:HTMLElement) : HTMLElement;
|
||||||
setVisible?(showing : boolean) : void;
|
setVisible?(showing : boolean) : void;
|
||||||
refresh(moveCursor:boolean) : void;
|
refresh(moveCursor:boolean) : void;
|
||||||
tick?() : void;
|
tick?() : void;
|
||||||
@ -77,10 +77,11 @@ export class SourceEditor implements ProjectView {
|
|||||||
errorwidgets = [];
|
errorwidgets = [];
|
||||||
inspectWidget;
|
inspectWidget;
|
||||||
|
|
||||||
createDiv(parent:HTMLElement, text:string) {
|
createDiv(parent:HTMLElement) {
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.setAttribute("class", "editor");
|
div.setAttribute("class", "editor");
|
||||||
parent.appendChild(div);
|
parent.appendChild(div);
|
||||||
|
var text = current_project.getFile(this.path) as string;
|
||||||
var asmOverride = text && this.mode=='verilog' && /__asm\b([\s\S]+?)\b__endasm\b/.test(text);
|
var asmOverride = text && this.mode=='verilog' && /__asm\b([\s\S]+?)\b__endasm\b/.test(text);
|
||||||
this.newEditor(div, asmOverride);
|
this.newEditor(div, asmOverride);
|
||||||
if (text) {
|
if (text) {
|
||||||
|
@ -44,8 +44,7 @@ export class ProjectWindows {
|
|||||||
}
|
}
|
||||||
var div = this.id2div[id];
|
var div = this.id2div[id];
|
||||||
if (!div) {
|
if (!div) {
|
||||||
var data = this.project.getFile(id)+""; // TODO: binary files
|
div = this.id2div[id] = wnd.createDiv(this.containerdiv);
|
||||||
div = this.id2div[id] = wnd.createDiv(this.containerdiv, data);
|
|
||||||
$(div).hide();
|
$(div).hide();
|
||||||
}
|
}
|
||||||
return wnd;
|
return wnd;
|
||||||
|
@ -45,25 +45,6 @@ describe('MOS6502', function() {
|
|||||||
logRead: function(a) { pcs.push(a); },
|
logRead: function(a) { pcs.push(a); },
|
||||||
logWrite: function(a) { pcs.push(a); },
|
logWrite: function(a) { pcs.push(a); },
|
||||||
};
|
};
|
||||||
// test hooks
|
|
||||||
var chook = new emu.CPUClockHook(cpu, profiler);
|
|
||||||
for (var i=0; i<10000; i++) {
|
|
||||||
cpu.advanceClock();
|
|
||||||
}
|
|
||||||
chook.unhook();
|
|
||||||
for (var i=0; i<100000; i++) {
|
|
||||||
cpu.advanceClock();
|
|
||||||
}
|
|
||||||
console.log(pcs.slice(pcs.length-10));
|
|
||||||
assert.equal(10000, pcs.length);
|
|
||||||
// bus hook
|
|
||||||
var bhook = new emu.BusHook(bus, profiler);
|
|
||||||
for (var i=0; i<10000; i++) {
|
|
||||||
cpu.advanceClock();
|
|
||||||
}
|
|
||||||
bhook.unhook();
|
|
||||||
console.log(pcs.slice(pcs.length-10));
|
|
||||||
assert.equal(20000, pcs.length);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
|
|
||||||
var vm = require('vm');
|
|
||||||
var fs = require('fs');
|
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
|
|
||||||
var util = require("gen/util.js");
|
|
||||||
var pixed = require("gen/pixed/pixeleditor.js");
|
var pixed = require("gen/pixed/pixeleditor.js");
|
||||||
|
|
||||||
|
function dumbEqual(a,b) {
|
||||||
|
if (a instanceof Uint32Array || a instanceof Uint8Array) {
|
||||||
|
a = Array.from(a);
|
||||||
|
}
|
||||||
|
return assert.deepEqual(a,b);
|
||||||
|
}
|
||||||
|
|
||||||
describe('Pixel editor', function() {
|
describe('Pixel editor', function() {
|
||||||
it('Should decode', function() {
|
it('Should decode', function() {
|
||||||
|
|
||||||
@ -36,7 +39,7 @@ describe('Pixel editor', function() {
|
|||||||
0xff40e0e0,
|
0xff40e0e0,
|
||||||
0xff40e0e1,
|
0xff40e0e1,
|
||||||
];
|
];
|
||||||
assert.deepEqual(node5.palette, expectedPalette);
|
dumbEqual(node5.palette, expectedPalette);
|
||||||
|
|
||||||
var ctx = {
|
var ctx = {
|
||||||
getPalettes: function(ncolors) {
|
getPalettes: function(ncolors) {
|
||||||
@ -53,29 +56,29 @@ describe('Pixel editor', function() {
|
|||||||
var node3 = new pixed.Palettizer(ctx, fmt);
|
var node3 = new pixed.Palettizer(ctx, fmt);
|
||||||
node2.addRight(node3);
|
node2.addRight(node3);
|
||||||
node1.refreshRight();
|
node1.refreshRight();
|
||||||
assert.deepEqual(node3.palette, expectedPalette);
|
dumbEqual(node3.palette, expectedPalette);
|
||||||
|
|
||||||
assert.deepEqual(node2.images, [[0,0,0,0,14,15,14,15,14,0,0,0,0,0,0,0,14,14,14,14,15,14,14,14,14,0,0,0,0,14,14,13,14,15,14,15,14,13,14,14,0,0,0,14,14,14,13,13,13,13,13,14,14,14,0,0,0,14,14,14,14,13,13,14,14,14,14,14,0,0,0,0,14,14,14,14,13,14,14,14,14,0,0,0,0,0,14,14,14,14,13,14,14,14,14,0,0,0,0,0,0,0,14,13,13,13,14,0,0,0,0,13,13,13,13,13,14,14,14,14,14,13,13,13,13,0,0,13,14,14,14,14,14,14,14,14,14,14,0,0,0,14,14,0,14,14,14,14,14,0,14,14,0,0,0,14,14,0,14,14,14,14,14,0,14,14,0,0,0,14,14,0,13,13,13,13,13,0,13,14,0,0,0,13,0,0,14,14,0,14,14,0,0,13,0,0,0,0,0,0,14,13,0,14,14,0,0,0,0,0,0,0,0,13,13,13,0,13,13,13,0,0,1,8]]);
|
dumbEqual(node2.images[0], [0,0,0,0,14,15,14,15,14,0,0,0,0,0,0,0,14,14,14,14,15,14,14,14,14,0,0,0,0,14,14,13,14,15,14,15,14,13,14,14,0,0,0,14,14,14,13,13,13,13,13,14,14,14,0,0,0,14,14,14,14,13,13,14,14,14,14,14,0,0,0,0,14,14,14,14,13,14,14,14,14,0,0,0,0,0,14,14,14,14,13,14,14,14,14,0,0,0,0,0,0,0,14,13,13,13,14,0,0,0,0,13,13,13,13,13,14,14,14,14,14,13,13,13,13,0,0,13,14,14,14,14,14,14,14,14,14,14,0,0,0,14,14,0,14,14,14,14,14,0,14,14,0,0,0,14,14,0,14,14,14,14,14,0,14,14,0,0,0,14,14,0,13,13,13,13,13,0,13,14,0,0,0,13,0,0,14,14,0,14,14,0,0,13,0,0,0,0,0,0,14,13,0,14,14,0,0,0,0,0,0,0,0,13,13,13,0,13,13,13,0,0,1,8]);
|
||||||
assert.equal(" 0x00, 0x03, 0x19, 0x50, 0x52, 0x07, 0x1F, 0x37, 0xE0, 0xA4, 0xFD, 0xFF, 0x38, 0x70, 0x7F, 0x7F, ",
|
assert.equal(" 0x00, 0x03, 0x19, 0x50, 0x52, 0x07, 0x1F, 0x37, 0xE0, 0xA4, 0xFD, 0xFF, 0x38, 0x70, 0x7F, 0x7F, ",
|
||||||
pixed.replaceHexWords(paldatastr, pixed.parseHexWords(paldatastr)));
|
pixed.replaceHexWords(paldatastr, pixed.parseHexWords(paldatastr)));
|
||||||
node3.refreshLeft();
|
node3.refreshLeft();
|
||||||
assert.deepEqual(node2.images, [[0,0,0,0,14,15,14,15,14,0,0,0,0,0,0,0,14,14,14,14,15,14,14,14,14,0,0,0,0,14,14,13,14,15,14,15,14,13,14,14,0,0,0,14,14,14,13,13,13,13,13,14,14,14,0,0,0,14,14,14,14,13,13,14,14,14,14,14,0,0,0,0,14,14,14,14,13,14,14,14,14,0,0,0,0,0,14,14,14,14,13,14,14,14,14,0,0,0,0,0,0,0,14,13,13,13,14,0,0,0,0,13,13,13,13,13,14,14,14,14,14,13,13,13,13,0,0,13,14,14,14,14,14,14,14,14,14,14,0,0,0,14,14,0,14,14,14,14,14,0,14,14,0,0,0,14,14,0,14,14,14,14,14,0,14,14,0,0,0,14,14,0,13,13,13,13,13,0,13,14,0,0,0,13,0,0,14,14,0,14,14,0,0,13,0,0,0,0,0,0,14,13,0,14,14,0,0,0,0,0,0,0,0,13,13,13,0,13,13,13,0,0,1,8]]);
|
dumbEqual(node2.images[0], [0,0,0,0,14,15,14,15,14,0,0,0,0,0,0,0,14,14,14,14,15,14,14,14,14,0,0,0,0,14,14,13,14,15,14,15,14,13,14,14,0,0,0,14,14,14,13,13,13,13,13,14,14,14,0,0,0,14,14,14,14,13,13,14,14,14,14,14,0,0,0,0,14,14,14,14,13,14,14,14,14,0,0,0,0,0,14,14,14,14,13,14,14,14,14,0,0,0,0,0,0,0,14,13,13,13,14,0,0,0,0,13,13,13,13,13,14,14,14,14,14,13,13,13,13,0,0,13,14,14,14,14,14,14,14,14,14,14,0,0,0,14,14,0,14,14,14,14,14,0,14,14,0,0,0,14,14,0,14,14,14,14,14,0,14,14,0,0,0,14,14,0,13,13,13,13,13,0,13,14,0,0,0,13,0,0,14,14,0,14,14,0,0,13,0,0,0,0,0,0,14,13,0,14,14,0,0,0,0,0,0,0,0,13,13,13,0,13,13,13,0,0,1,8]);
|
||||||
|
|
||||||
var datastr2 = "const char PALETTE[32] = { \n 0x03, // screen color\n\n 0x11,0x30,0x27,0x0, // background palette 0\n 0x1c,0x20,0x2c,0x0, // background palette 1\n};";
|
var datastr2 = "const char PALETTE[32] = { \n 0x03, // screen color\n\n 0x11,0x30,0x27,0x0, // background palette 0\n 0x1c,0x20,0x2c,0x0, // background palette 1\n};";
|
||||||
var words2 = pixed.parseHexWords(datastr2);
|
var words2 = pixed.parseHexWords(datastr2);
|
||||||
assert.deepEqual(words2, [0x03,0x11,0x30,0x27,0x00,0x1c,0x20,0x2c,0x00]);
|
dumbEqual(words2, [0x03,0x11,0x30,0x27,0x00,0x1c,0x20,0x2c,0x00]);
|
||||||
|
|
||||||
// test verilog
|
// test verilog
|
||||||
var datastr3 = " 7'o00: bits = 5'b11111; ";
|
var datastr3 = " 7'o00: bits = 5'b11111; ";
|
||||||
var words3 = pixed.parseHexWords(datastr3);
|
var words3 = pixed.parseHexWords(datastr3);
|
||||||
assert.deepEqual(words3, [31]);
|
dumbEqual(words3, [31]);
|
||||||
assert.equal(datastr3, pixed.replaceHexWords(datastr3, pixed.parseHexWords(datastr3)));
|
assert.equal(datastr3, pixed.replaceHexWords(datastr3, pixed.parseHexWords(datastr3)));
|
||||||
// TODO: test (nplanes > 0 && fmt.sl)
|
// TODO: test (nplanes > 0 && fmt.sl)
|
||||||
|
|
||||||
// test comments
|
// test comments
|
||||||
var datastr4 = " .byte #%01111110;$7E \n .byte #%01111111;$7F";
|
var datastr4 = " .byte #%01111110;$7E \n .byte #%01111111;$7F";
|
||||||
var words4 = pixed.parseHexWords(datastr4);
|
var words4 = pixed.parseHexWords(datastr4);
|
||||||
assert.deepEqual(words4, [0x7E,0x7F]);
|
dumbEqual(words4, [0x7E,0x7F]);
|
||||||
assert.notEqual(datastr4, pixed.replaceHexWords(datastr4, pixed.parseHexWords(datastr4))); // removed comment
|
assert.notEqual(datastr4, pixed.replaceHexWords(datastr4, pixed.parseHexWords(datastr4))); // removed comment
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user