1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-01 20:41:36 +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 - watchpoints
- breakpoints - breakpoints
- debug inspector - debug inspector
- better debug buttons
- MAME single step (?) - MAME single step (?)
- step over - step over
- slowdown beam for all platforms? - slowdown beam for all platforms?
- kbd shortcuts - kbd shortcuts
- PC x86 support - PC x86 support
- show errors in list - show errors in list (maybe window list?)
- can't see 1st line in editor sometimes - can't see 1st line in editor sometimes
- online help - online help
- show self-modifying code insns left of editor - 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"> <div id="controls_top">
<span class="dropdown"> <span class="dropdown">
<a class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Menu"> <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> </a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton"> <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li><a class="dropdown-item" href="#" id="item_new_file">New File...</a></li> <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"> <span class="dropdown">
<a class="btn btn-secondary dropdown-toggle" id="windowMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Window Select"> <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> </a>
<ul class="dropdown-menu" aria-labelledby="windowMenuButton" id="windowMenuList"> <ul class="dropdown-menu" aria-labelledby="windowMenuButton" id="windowMenuList">
</ul> </ul>
@ -213,6 +215,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
var exports = {}; var exports = {};
function require(modname) { function require(modname) {
if (modname == 'jquery') return $; if (modname == 'jquery') return $;
else console.log("Unknown require()", modname);
} }
</script> </script>

View File

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

View File

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

View File

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