mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-11 15:30:31 +00:00
vcs: ctrl-click to break on raster position
This commit is contained in:
parent
efbc6dbe34
commit
6cb71d40b8
@ -57,7 +57,7 @@ Javatari.AUDIO_BUFFER_SIZE = 256;
|
|||||||
|
|
||||||
class VCSPlatform extends BasePlatform {
|
class VCSPlatform extends BasePlatform {
|
||||||
|
|
||||||
lastDebugState;
|
lastBreakState; // last breakpoint state
|
||||||
|
|
||||||
getPresets() { return VCS_PRESETS; }
|
getPresets() { return VCS_PRESETS; }
|
||||||
|
|
||||||
@ -71,6 +71,23 @@ class VCSPlatform extends BasePlatform {
|
|||||||
self.updateRecorder();
|
self.updateRecorder();
|
||||||
this.oldClockPulse();
|
this.oldClockPulse();
|
||||||
}
|
}
|
||||||
|
// setup mouse events
|
||||||
|
var rasterPosBreakFn = (e) => {
|
||||||
|
if (e.ctrlKey) {
|
||||||
|
Javatari.room.console.resetDebug();
|
||||||
|
var vcanvas = $(e.target);
|
||||||
|
var x = e.pageX - vcanvas.offset().left;
|
||||||
|
var y = e.pageY - vcanvas.offset().top;
|
||||||
|
var new_x = Math.floor(x * 152 / vcanvas.width());
|
||||||
|
var new_y = Math.floor((y-37) * (210+37) / vcanvas.height());
|
||||||
|
this.runEval( (c) => {
|
||||||
|
var pos = this.getRasterPosition();
|
||||||
|
return (pos.x >= new_x) && (pos.y >= new_y);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var jacanvas = $("#javatari-screen").find("canvas");
|
||||||
|
jacanvas.mousedown(rasterPosBreakFn);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadROM(title, data) {
|
loadROM(title, data) {
|
||||||
@ -87,7 +104,7 @@ class VCSPlatform extends BasePlatform {
|
|||||||
return Javatari.getOpcodeMetadata(opcode, offset);
|
return Javatari.getOpcodeMetadata(opcode, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRasterPosition() {
|
getRasterPosition() : {x:number,y:number} {
|
||||||
var clkfs = Javatari.room.console.getClocksFromFrameStart() - 1;
|
var clkfs = Javatari.room.console.getClocksFromFrameStart() - 1;
|
||||||
var row = Math.floor(clkfs/76);
|
var row = Math.floor(clkfs/76);
|
||||||
var col = clkfs - row*76;
|
var col = clkfs - row*76;
|
||||||
@ -127,7 +144,7 @@ class VCSPlatform extends BasePlatform {
|
|||||||
this.fixState(state);
|
this.fixState(state);
|
||||||
Javatari.room.console.pause();
|
Javatari.room.console.pause();
|
||||||
Javatari.room.speaker.mute();
|
Javatari.room.speaker.mute();
|
||||||
this.lastDebugState = state;
|
this.lastBreakState = state;
|
||||||
callback(state);
|
callback(state);
|
||||||
}
|
}
|
||||||
Javatari.room.speaker.mute();
|
Javatari.room.speaker.mute();
|
||||||
@ -136,7 +153,7 @@ class VCSPlatform extends BasePlatform {
|
|||||||
return Javatari.room.console.onBreakpointHit != null;
|
return Javatari.room.console.onBreakpointHit != null;
|
||||||
}
|
}
|
||||||
clearDebug() {
|
clearDebug() {
|
||||||
this.lastDebugState = null;
|
this.lastBreakState = null;
|
||||||
Javatari.room.console.disableDebug();
|
Javatari.room.console.disableDebug();
|
||||||
Javatari.room.console.onBreakpointHit = null;
|
Javatari.room.console.onBreakpointHit = null;
|
||||||
if (this.isRunning()) Javatari.room.speaker.play();
|
if (this.isRunning()) Javatari.room.speaker.play();
|
||||||
@ -180,8 +197,8 @@ class VCSPlatform extends BasePlatform {
|
|||||||
}
|
}
|
||||||
readAddress(addr) {
|
readAddress(addr) {
|
||||||
// TODO: shouldn't have to do this when debugging
|
// TODO: shouldn't have to do this when debugging
|
||||||
if (this.lastDebugState && addr >= 0x80 && addr < 0x100)
|
if (this.lastBreakState && addr >= 0x80 && addr < 0x100)
|
||||||
return this.getRAMForState(this.lastDebugState)[addr & 0x7f];
|
return this.getRAMForState(this.lastBreakState)[addr & 0x7f];
|
||||||
else
|
else
|
||||||
return Javatari.room.console.readAddress(addr);
|
return Javatari.room.console.readAddress(addr);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user