1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 18:33:11 +00:00

all debug buttons now have state colors

This commit is contained in:
Steven Hugg 2018-07-07 00:09:15 -05:00
parent 3221d43cdc
commit 23557640b4
5 changed files with 31 additions and 20 deletions

View File

@ -25,13 +25,12 @@ TODO:
- watchpoints
- breakpoints
- debug inspector
- better debug buttons
- MAME single step (?)
- step over
- slowdown beam for all platforms?
- kbd shortcuts
- PC x86 support
- show errors in list
- show errors in list (maybe window list?)
- can't see 1st line in editor sometimes
- online help
- show self-modifying code insns left of editor

View File

@ -42,7 +42,8 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<div id="controls_top">
<span class="dropdown">
<a class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Menu">
&#9776; <span class="caret"></span>
<span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span></button>
<span class="caret"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li><a class="dropdown-item" href="#" id="item_new_file">New File...</a></li>
@ -89,7 +90,8 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
<span class="dropdown">
<a class="btn btn-secondary dropdown-toggle" id="windowMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Window Select">
&#9775; <span class="caret"></span>
<span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span></button>
<span class="caret"></span>
</a>
<ul class="dropdown-menu" aria-labelledby="windowMenuButton" id="windowMenuList">
</ul>
@ -213,6 +215,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
var exports = {};
function require(modname) {
if (modname == 'jquery') return $;
else console.log("Unknown require()", modname);
}
</script>

View File

@ -1,5 +1,7 @@
"use strict";
//import * as localforage from "localforage";
var OldFileStore = function(storage, prefix) {
var self = this;
this.saveFile = function(name, text) {
@ -26,6 +28,7 @@ var OldFileStore = function(storage, prefix) {
}
}
/*
// localforage-compatible driver for old file store format
var OldFileStoreDriver = {
_driver: 'oldFileStoreDriver',
@ -59,11 +62,11 @@ var OldFileStoreDriver = {
callback();
}
}
localforage.defineDriver(OldFileStoreDriver);
*/
// copy localStorage to new driver
function copyFromOldStorageFormat(platformid, newstore, callback) {
function copyFromOldStorageFormat(platformid:string, newstore, callback) {
var alreadyMigratedKey = "__migrated_" + platformid;
//localStorage.removeItem(alreadyMigratedKey);
if (localStorage.getItem(alreadyMigratedKey))
@ -108,7 +111,7 @@ function copyFromOldStorageFormat(platformid, newstore, callback) {
function createNewPersistentStore(platformid, callback) {
var store = localforage.createInstance({
name: platformid,
version: "2.0"
version: 2.0
});
copyFromOldStorageFormat(platformid, store, callback);
return store;

View File

@ -413,13 +413,19 @@ function showMemory(state) {
}
}
function setupBreakpoint() {
// TODO
function setDebugButtonState(btnid, btnstate) {
$("#debug_bar").find("button").removeClass("btn_active").removeClass("btn_stopped");
$("#dbg_"+btnid).addClass("btn_"+btnstate);
}
function setupBreakpoint(btnid) {
platform.setupDebug(function(state) {
lastDebugState = state;
showMemory(state);
projectWindows.refresh();
if (btnid) setDebugButtonState(btnid, "stopped");
});
if (btnid) setDebugButtonState(btnid, "active");
}
function _pause() {
@ -427,8 +433,7 @@ function _pause() {
platform.pause();
console.log("Paused");
}
$("#dbg_pause").addClass("btn_stopped");
$("#dbg_go").removeClass("btn_active");
setDebugButtonState("pause", "stopped");
}
function pause() {
@ -442,8 +447,7 @@ function _resume() {
platform.resume();
console.log("Resumed");
}
$("#dbg_pause").removeClass("btn_stopped");
$("#dbg_go").addClass("btn_active");
setDebugButtonState("go", "active");
}
function resume() {
@ -456,12 +460,12 @@ function resume() {
}
function singleStep() {
setupBreakpoint();
setupBreakpoint("step");
platform.step();
}
function singleFrameStep() {
setupBreakpoint();
setupBreakpoint("tovsync");
platform.runToVsync();
}
@ -471,7 +475,7 @@ function getEditorPC() {
}
function runToCursor() {
setupBreakpoint();
setupBreakpoint("toline");
var pc = getEditorPC();
if (pc >= 0) {
console.log("Run to", pc.toString(16));
@ -486,12 +490,12 @@ function runToCursor() {
}
function runUntilReturn() {
setupBreakpoint();
setupBreakpoint("stepout");
platform.runUntilReturn();
}
function runStepBackwards() {
setupBreakpoint();
setupBreakpoint("stepback");
platform.stepBack();
}
@ -506,7 +510,7 @@ function resetAndDebug() {
clearBreakpoint();
_resume();
platform.reset();
setupBreakpoint();
setupBreakpoint("reset");
if (platform.runEval)
platform.runEval(function(c) { return true; }); // break immediately
else
@ -614,6 +618,7 @@ function _slowestFrameRate() {
}
function _fastestFrameRate() {
_resume();
setFrameRateUI(60);
}

View File

@ -10,6 +10,7 @@
]
},
"include": [
"./src/*.ts"
"./src/*.ts",
"./localForage/typings/*.ts"
]
}