1
0
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:
Steven Hugg 2019-10-19 10:29:40 -05:00
parent d73e9963ce
commit 05f4d43d1e
7 changed files with 32 additions and 48 deletions

View File

@ -168,6 +168,7 @@ TODO:
- re-publish repo (bug: doesn't put all files in local repo after publishing)
- allow text/binary change
- importing from subtree commits to root anyway
- publishing Markdown file loads default file?
- astrocade
- keyboard shortcuts
- ctrl+alt+l on ubuntu locks screen

View File

@ -162,7 +162,6 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<a tabindex="-1" href="#">Computers</a>
<ul class="dropdown-menu">
<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-libcv">MSX (libCV)</a></li>
</ul>

View File

@ -214,11 +214,13 @@ function refreshWindowList() {
}
function addEditorItem(id:string) {
addWindowItem(id, getFilenameForPath(id), () => {
var data = current_project.getFile(id);
if (typeof data === 'string')
addWindowItem(id, getFilenameForPath(id), loadEditor);
return loadEditor(id);
else if (data instanceof Uint8Array)
addWindowItem(id, getFilenameForPath(id), () => { return new Views.BinaryFileView(id, data as Uint8Array); });
return new Views.BinaryFileView(id, data as Uint8Array);
});
}
// add main file editor
@ -231,7 +233,6 @@ function refreshWindowList() {
});
// add listings
// TODO: update listing when recompiling
separate = true;
var listings = current_project.getListings();
if (listings) {
@ -276,9 +277,11 @@ function refreshWindowList() {
addWindowItem("#crtheatmap", "CRT Probe", () => {
return new Views.RasterPCHeatMapView();
});
/*
addWindowItem("#spheatmap", "Stack Probe", () => {
return new Views.RasterStackMapView();
});
*/
}
addWindowItem('#asseteditor', 'Asset Editor', () => {
return new Views.AssetEditorView();
@ -391,7 +394,7 @@ function handleFileUpload(files: File[]) {
if (confirm("Open '" + qs['file'] + "' as project?")) {
gotoNewLocation();
} else {
updateSelector();
setTimeout(updateSelector, 1000); // TODO: wait for files to upload
}
}
gaEvent('workspace', 'file', 'upload');
@ -688,7 +691,7 @@ function deleteRepository() {
}
function _shareEmbedLink(e) {
if (current_output == null) { // TODO
if (current_output == null) {
alertError("Please fix errors before sharing.");
return true;
}
@ -1011,7 +1014,7 @@ function setCompileOutput(data: WorkerResult) {
compparams = data.params;
// load ROM
var rom = data.output;
if (rom) { // TODO instanceof Uint8Array) {
if (rom) {
try {
clearBreakpoint(); // so we can replace memory (TODO: change toolbar btn)
_resetRecording();
@ -1019,7 +1022,6 @@ function setCompileOutput(data: WorkerResult) {
current_output = rom;
if (!userPaused) _resume();
measureBuildTime();
// TODO: reset profiler etc? (Tell views?)
} catch (e) {
console.log(e);
toolbar.addClass("has-errors");
@ -1860,7 +1862,6 @@ function startPlatform() {
// start platform and load file
replaceURLState();
platform.start();
// TODO: ordering of loads?
installGAHooks();
loadBIOSFromProject();
initProject();
@ -1907,8 +1908,7 @@ function loadImportedURL(url : string) {
setWaitDialog(true);
getWithBinary(url, (data) => {
if (data) {
var path = 'shared/' + getFilenameForPath(url); // TODO: shared prefix?
// TODO: progress dialog
var path = 'shared/' + getFilenameForPath(url);
console.log("Importing " + data.length + " bytes as " + path);
store.getItem(path, (err, olddata) => {
setWaitDialog(false);

View File

@ -11,7 +11,7 @@ import * as pixed from "./pixed/pixeleditor";
declare var Mousetrap;
export interface ProjectView {
createDiv(parent:HTMLElement, text:string) : HTMLElement;
createDiv(parent:HTMLElement) : HTMLElement;
setVisible?(showing : boolean) : void;
refresh(moveCursor:boolean) : void;
tick?() : void;
@ -77,10 +77,11 @@ export class SourceEditor implements ProjectView {
errorwidgets = [];
inspectWidget;
createDiv(parent:HTMLElement, text:string) {
createDiv(parent:HTMLElement) {
var div = document.createElement('div');
div.setAttribute("class", "editor");
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);
this.newEditor(div, asmOverride);
if (text) {

View File

@ -44,8 +44,7 @@ export class ProjectWindows {
}
var div = this.id2div[id];
if (!div) {
var data = this.project.getFile(id)+""; // TODO: binary files
div = this.id2div[id] = wnd.createDiv(this.containerdiv, data);
div = this.id2div[id] = wnd.createDiv(this.containerdiv);
$(div).hide();
}
return wnd;

View File

@ -45,25 +45,6 @@ describe('MOS6502', function() {
logRead: 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);
});
});

View File

@ -1,11 +1,14 @@
var vm = require('vm');
var fs = require('fs');
var assert = require('assert');
var util = require("gen/util.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() {
it('Should decode', function() {
@ -36,7 +39,7 @@ describe('Pixel editor', function() {
0xff40e0e0,
0xff40e0e1,
];
assert.deepEqual(node5.palette, expectedPalette);
dumbEqual(node5.palette, expectedPalette);
var ctx = {
getPalettes: function(ncolors) {
@ -53,29 +56,29 @@ describe('Pixel editor', function() {
var node3 = new pixed.Palettizer(ctx, fmt);
node2.addRight(node3);
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, ",
pixed.replaceHexWords(paldatastr, pixed.parseHexWords(paldatastr)));
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 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
var datastr3 = " 7'o00: bits = 5'b11111; ";
var words3 = pixed.parseHexWords(datastr3);
assert.deepEqual(words3, [31]);
dumbEqual(words3, [31]);
assert.equal(datastr3, pixed.replaceHexWords(datastr3, pixed.parseHexWords(datastr3)));
// TODO: test (nplanes > 0 && fmt.sl)
// test comments
var datastr4 = " .byte #%01111110;$7E \n .byte #%01111111;$7F";
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
});
});