mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-01 13:50:30 +00:00
debug: click to breakpoint in probe views
This commit is contained in:
parent
664cecf4f7
commit
363691b964
@ -133,6 +133,7 @@ export interface Platform {
|
|||||||
resize?() : void;
|
resize?() : void;
|
||||||
|
|
||||||
getRasterScanline?() : number;
|
getRasterScanline?() : number;
|
||||||
|
getRasterLineClock?() : number;
|
||||||
setBreakpoint?(id : string, cond : DebugCondition);
|
setBreakpoint?(id : string, cond : DebugCondition);
|
||||||
clearBreakpoint?(id : string);
|
clearBreakpoint?(id : string);
|
||||||
hasBreakpoint?(id : string) : boolean;
|
hasBreakpoint?(id : string) : boolean;
|
||||||
|
@ -1491,7 +1491,7 @@ function setupDebugCallback(btnid? : DebugCommandType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupBreakpoint(btnid? : DebugCommandType) {
|
export function setupBreakpoint(btnid? : DebugCommandType) {
|
||||||
if (!checkRunReady()) return;
|
if (!checkRunReady()) return;
|
||||||
_disableRecording();
|
_disableRecording();
|
||||||
setupDebugCallback(btnid);
|
setupDebugCallback(btnid);
|
||||||
@ -1591,7 +1591,7 @@ function runStepBackwards() {
|
|||||||
platform.stepBack();
|
platform.stepBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearBreakpoint() {
|
export function clearBreakpoint() {
|
||||||
lastDebugState = null;
|
lastDebugState = null;
|
||||||
if (platform.clearDebug) platform.clearDebug();
|
if (platform.clearDebug) platform.clearDebug();
|
||||||
setupDebugCallback(); // in case of BRK/trap
|
setupDebugCallback(); // in case of BRK/trap
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
import { newDiv, ProjectView } from "./baseviews";
|
import { newDiv, ProjectView } from "./baseviews";
|
||||||
import { Segment } from "../../common/workertypes";
|
import { Segment } from "../../common/workertypes";
|
||||||
import { platform, compparams, current_project, projectWindows } from "../ui";
|
import { platform, compparams, current_project, projectWindows, runToPC, setupBreakpoint } from "../ui";
|
||||||
import { hex, lpad, rpad } from "../../common/util";
|
import { hex, lpad, rpad } from "../../common/util";
|
||||||
import { VirtualList } from "../../common/vlist";
|
import { VirtualList } from "../../common/vlist";
|
||||||
import { getMousePos, getVisibleEditorLineHeight, VirtualTextLine, VirtualTextScroller } from "../../common/emu";
|
import { getMousePos, getVisibleEditorLineHeight, VirtualTextLine, VirtualTextScroller } from "../../common/emu";
|
||||||
@ -471,6 +471,18 @@ abstract class ProbeViewBase extends ProbeViewBaseBase {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOpAtPos(x:number, y:number, mask:number) : number {
|
||||||
|
x = x|0;
|
||||||
|
y = y|0;
|
||||||
|
let result = 0;
|
||||||
|
this.redraw( (op,addr,col,row,clk,value) => {
|
||||||
|
if (!result && row == y && col >= x && (op & mask) != 0) {
|
||||||
|
result = op | addr;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,6 +558,15 @@ export class AddressHeatMapView extends ProbeBitmapViewBase implements ProjectVi
|
|||||||
return this.createCanvas(parent, 256, 256);
|
return this.createCanvas(parent, 256, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initCanvas() {
|
||||||
|
super.initCanvas();
|
||||||
|
this.canvas.onclick = (e) => {
|
||||||
|
var pos = getMousePos(this.canvas, e);
|
||||||
|
var opaddr = Math.floor(pos.x) + Math.floor(pos.y) * 256;
|
||||||
|
runToPC(opaddr & 0xffff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
for (var i=0; i<=0xffff; i++) {
|
for (var i=0; i<=0xffff; i++) {
|
||||||
var v = platform.readAddress(i);
|
var v = platform.readAddress(i);
|
||||||
@ -555,6 +576,7 @@ export class AddressHeatMapView extends ProbeBitmapViewBase implements ProjectVi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: show current PC
|
||||||
drawEvent(op, addr, col, row) {
|
drawEvent(op, addr, col, row) {
|
||||||
var rgb = this.getOpRGB(op, addr);
|
var rgb = this.getOpRGB(op, addr);
|
||||||
if (!rgb) return;
|
if (!rgb) return;
|
||||||
@ -598,6 +620,27 @@ export class AddressHeatMapView extends ProbeBitmapViewBase implements ProjectVi
|
|||||||
|
|
||||||
export class RasterPCHeatMapView extends ProbeBitmapViewBase implements ProjectView {
|
export class RasterPCHeatMapView extends ProbeBitmapViewBase implements ProjectView {
|
||||||
|
|
||||||
|
initCanvas() {
|
||||||
|
super.initCanvas();
|
||||||
|
// TODO: run to exact x/y position
|
||||||
|
this.canvas.onclick = (e) => {
|
||||||
|
var pos = getMousePos(this.canvas, e);
|
||||||
|
var x = Math.floor(pos.x);
|
||||||
|
var y = Math.floor(pos.y);
|
||||||
|
var opaddr = this.getOpAtPos(pos.x, pos.y, ProbeFlags.EXECUTE);
|
||||||
|
if (opaddr) {
|
||||||
|
//runToPC(opaddr & 0xffff);
|
||||||
|
setupBreakpoint("toline");
|
||||||
|
platform.runEval(() => {
|
||||||
|
let onrow = platform.getRasterScanline && platform.getRasterScanline() >= y;
|
||||||
|
if (onrow && platform.getRasterLineClock) {
|
||||||
|
return onrow && platform.getRasterLineClock() > x;
|
||||||
|
} else return onrow;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drawEvent(op, addr, col, row) {
|
drawEvent(op, addr, col, row) {
|
||||||
var rgb = this.getOpRGB(op, addr);
|
var rgb = this.getOpRGB(op, addr);
|
||||||
if (!rgb) return;
|
if (!rgb) return;
|
||||||
|
@ -247,6 +247,9 @@ export class Atari800 extends BasicScanlineMachine {
|
|||||||
getRasterScanline() {
|
getRasterScanline() {
|
||||||
return this.antic.v;
|
return this.antic.v;
|
||||||
}
|
}
|
||||||
|
getRasterLineClock() {
|
||||||
|
return this.antic.h;
|
||||||
|
}
|
||||||
getDebugCategories() {
|
getDebugCategories() {
|
||||||
return ['CPU', 'Stack', 'ANTIC', 'GTIA', 'POKEY'];
|
return ['CPU', 'Stack', 'ANTIC', 'GTIA', 'POKEY'];
|
||||||
}
|
}
|
||||||
|
@ -295,6 +295,9 @@ class JSNESPlatform extends Base6502Platform implements Platform, Probeable {
|
|||||||
getRasterScanline() : number {
|
getRasterScanline() : number {
|
||||||
return this.nes.ppu.scanline;
|
return this.nes.ppu.scanline;
|
||||||
}
|
}
|
||||||
|
getRasterLineClock() : number {
|
||||||
|
return this.nes.ppu.curX;
|
||||||
|
}
|
||||||
|
|
||||||
getCPUState() {
|
getCPUState() {
|
||||||
var c = this.nes.cpu.toJSON();
|
var c = this.nes.cpu.toJSON();
|
||||||
|
@ -156,6 +156,9 @@ class VCSPlatform extends BasePlatform {
|
|||||||
getRasterScanline() : number {
|
getRasterScanline() : number {
|
||||||
return this.getRasterPosition().y;
|
return this.getRasterPosition().y;
|
||||||
}
|
}
|
||||||
|
getRasterLineClock() : number {
|
||||||
|
return this.getRasterPosition().x;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Clock changes this on event, so it may not be current
|
// TODO: Clock changes this on event, so it may not be current
|
||||||
isRunning() {
|
isRunning() {
|
||||||
|
Loading…
Reference in New Issue
Block a user