mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-05-28 08:41:30 +00:00
moved to new presets/<platform> prefix; js/ dir
This commit is contained in:
parent
3e817adcb1
commit
9391cafac6
|
@ -22,4 +22,3 @@ TODO:
|
||||||
- break on BRK/illegal opcode?
|
- break on BRK/illegal opcode?
|
||||||
- start analysis from vector address
|
- start analysis from vector address
|
||||||
|
|
||||||
cat ~/Downloads/appleiigo.rom | hexdump -v -e '"\n" 32/1 "%u,"' ; echo
|
|
||||||
|
|
42
src/ui.js
42
src/ui.js
|
@ -4,13 +4,13 @@
|
||||||
|
|
||||||
var worker = new Worker("./src/worker/workermain.js");
|
var worker = new Worker("./src/worker/workermain.js");
|
||||||
var current_output = null;
|
var current_output = null;
|
||||||
var current_preset_idx = -1; // TODO: use URL
|
var current_preset_index = -1; // TODO: use URL
|
||||||
var current_preset_id = null;
|
var current_preset_id = null;
|
||||||
var offset2line = null;
|
var offset2line = null;
|
||||||
var line2offset = null;
|
var line2offset = null;
|
||||||
var trace_pending_at_pc;
|
var trace_pending_at_pc;
|
||||||
|
|
||||||
var PRESETS, platform;
|
var PRESETS, platform, platform_id;
|
||||||
|
|
||||||
var CODE = 'code1';
|
var CODE = 'code1';
|
||||||
var editor = CodeMirror(document.getElementById('editor'), {
|
var editor = CodeMirror(document.getElementById('editor'), {
|
||||||
|
@ -27,14 +27,15 @@ editor.on('changes', function(ed, changeobj) {
|
||||||
});
|
});
|
||||||
|
|
||||||
function getCurrentPresetTitle() {
|
function getCurrentPresetTitle() {
|
||||||
if (current_preset_idx < 0)
|
if (current_preset_index < 0)
|
||||||
return "ROM";
|
return "ROM";
|
||||||
else
|
else
|
||||||
return PRESETS[current_preset_idx].title || PRESETS[current_preset_idx].name || "ROM";
|
return PRESETS[current_preset_index].title || PRESETS[current_preset_index].name || "ROM";
|
||||||
}
|
}
|
||||||
|
|
||||||
function setLastPreset(id) {
|
function setLastPreset(id) {
|
||||||
localStorage.setItem("__lastid", id);
|
localStorage.setItem("__lastid", id);
|
||||||
|
localStorage.setItem("__lastplatform", platform_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePreset(current_preset_id, text) {
|
function updatePreset(current_preset_id, text) {
|
||||||
|
@ -51,8 +52,8 @@ function loadCode(text) {
|
||||||
|
|
||||||
function loadFile(fileid, filename, index) {
|
function loadFile(fileid, filename, index) {
|
||||||
current_preset_id = fileid;
|
current_preset_id = fileid;
|
||||||
current_preset_idx = index;
|
current_preset_index = index;
|
||||||
var text = (localStorage.getItem(fileid) || "");
|
var text = localStorage.getItem(fileid) || localStorage.getItem(fileid.replace(platform_id+"/","")) || "";
|
||||||
if (text) {
|
if (text) {
|
||||||
loadCode(text);
|
loadCode(text);
|
||||||
setLastPreset(fileid);
|
setLastPreset(fileid);
|
||||||
|
@ -68,7 +69,7 @@ function loadFile(fileid, filename, index) {
|
||||||
}, 'text');
|
}, 'text');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$.get( "presets/skeleton.a", function( text ) {
|
$.get( "presets/"+platform_id+"/skeleton.a", function( text ) {
|
||||||
loadCode(text);
|
loadCode(text);
|
||||||
setLastPreset(fileid);
|
setLastPreset(fileid);
|
||||||
updatePreset(fileid, text);
|
updatePreset(fileid, text);
|
||||||
|
@ -85,10 +86,10 @@ function loadPreset(preset_id) {
|
||||||
index = (index + PRESETS.length) % PRESETS.length;
|
index = (index + PRESETS.length) % PRESETS.length;
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
// load the preset
|
// load the preset
|
||||||
loadFile(preset_id, "presets/" + PRESETS[index].id, index);
|
loadFile(preset_id, "presets/" + platform_id + "/" + PRESETS[index].id, index);
|
||||||
} else {
|
} else {
|
||||||
// no preset found? load local
|
// no preset found? load local
|
||||||
loadFile(preset_id, "local/" + preset_id, -1);
|
loadFile(preset_id, "local/" + platform_id + "/" + preset_id, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ function _createNewFile(e) {
|
||||||
if (filename.indexOf(".") < 0) {
|
if (filename.indexOf(".") < 0) {
|
||||||
filename += ".a";
|
filename += ".a";
|
||||||
}
|
}
|
||||||
qs['file'] = "local/" + filename;
|
qs['file'] = "local/" + platform_id + "/" + filename;
|
||||||
window.location = "?" + $.param(qs);
|
window.location = "?" + $.param(qs);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -151,9 +152,9 @@ function _shareFile(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _resetPreset(e) {
|
function _resetPreset(e) {
|
||||||
if (current_preset_idx < 0) {
|
if (current_preset_index < 0) {
|
||||||
alert("Can only reset built-in file examples.")
|
alert("Can only reset built-in file examples.")
|
||||||
} else if (confirm("Reset '" + PRESETS[current_preset_idx].name + "' to default?")) {
|
} else if (confirm("Reset '" + PRESETS[current_preset_index].name + "' to default?")) {
|
||||||
qs['reset'] = '1';
|
qs['reset'] = '1';
|
||||||
window.location = "?" + $.param(qs);
|
window.location = "?" + $.param(qs);
|
||||||
}
|
}
|
||||||
|
@ -201,10 +202,10 @@ function updateSelector() {
|
||||||
gotoPresetNamed($(this).val());
|
gotoPresetNamed($(this).val());
|
||||||
});
|
});
|
||||||
$("#preset_prev").off('click').click(function() {
|
$("#preset_prev").off('click').click(function() {
|
||||||
gotoPresetAt(current_preset_idx - 1);
|
gotoPresetAt(current_preset_index - 1);
|
||||||
});
|
});
|
||||||
$("#preset_next").off('click').click(function() {
|
$("#preset_next").off('click').click(function() {
|
||||||
gotoPresetAt(current_preset_idx + 1);
|
gotoPresetAt(current_preset_index + 1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,18 +731,19 @@ try {
|
||||||
}, 'text');
|
}, 'text');
|
||||||
} else {
|
} else {
|
||||||
// add default platform?
|
// add default platform?
|
||||||
if (!qs['platform']) {
|
platform_id = qs['platform'] || localStorage.getItem("__lastplatform");
|
||||||
qs['platform'] = 'vcs';
|
if (!platform_id) {
|
||||||
|
platform_id = qs['platform'] = "vcs";
|
||||||
}
|
}
|
||||||
// load and start platform object
|
// load and start platform object
|
||||||
if (qs['platform'] == 'vcs') {
|
if (platform_id == 'vcs') {
|
||||||
platform = new VCSPlatform();
|
platform = new VCSPlatform();
|
||||||
} else if (qs['platform'] == 'apple2') {
|
} else if (platform_id == 'apple2') {
|
||||||
platform = new Apple2Platform($("#emulator")[0]);
|
platform = new Apple2Platform($("#emulator")[0]);
|
||||||
} else if (qs['platform'] == 'atarivec') {
|
} else if (platform_id == 'atarivec') {
|
||||||
platform = new AtariVectorPlatform($("#emulator")[0]);
|
platform = new AtariVectorPlatform($("#emulator")[0]);
|
||||||
} else {
|
} else {
|
||||||
alert("Platform " + qs['platform'] + " not recognized");
|
alert("Platform " + platform_id + " not recognized");
|
||||||
}
|
}
|
||||||
PRESETS = platform.getPresets();
|
PRESETS = platform.getPresets();
|
||||||
platform.start();
|
platform.start();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// set up require.js for worker
|
// set up require.js for worker
|
||||||
importScripts("../../dasm.js");
|
importScripts("../../js/dasm.js");
|
||||||
|
|
||||||
// shim out window and document objects
|
// shim out window and document objects
|
||||||
// https://github.com/mbostock/d3/issues/1053
|
// https://github.com/mbostock/d3/issues/1053
|
||||||
|
|
Loading…
Reference in New Issue
Block a user