mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-06-10 06:29:28 +00:00
use #emuscreen to place emulator video
This commit is contained in:
parent
320e0c02a4
commit
31356a7b5f
|
@ -122,6 +122,7 @@ TODO:
|
|||
- toolbar overlaps scope
|
||||
- CPU debugging
|
||||
- use $readmem for inline asm programs?
|
||||
- can't add control instructions b/c of split
|
||||
- single-stepping vector games makes screen fade
|
||||
- break on stack overflow, bad op, bad access, etc
|
||||
- PPU/TIA register write visualization
|
||||
|
|
|
@ -35,6 +35,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||
<body>
|
||||
|
||||
<div id="emulator">
|
||||
<!-- emulator video -->
|
||||
<div id="emuscreen">
|
||||
</div>
|
||||
<div id="javatari-div" style="margin:10px; display:none">
|
||||
<div id="javatari-screen" style="margin: 0 auto; box-shadow: 2px 2px 10px rgb(60, 60, 60);"></div>
|
||||
<div id="javatari-console-panel" style="margin: 0 auto; box-shadow: 2px 2px 10px rgb(60, 60, 60);"></div>
|
||||
|
|
|
@ -225,6 +225,9 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
|||
<button id="replay_max" class="btn" title="End of replay"><span class="glyphicon glyphicon-fast-forward" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- emulator video -->
|
||||
<div id="emuscreen">
|
||||
</div>
|
||||
<!-- control instructions -->
|
||||
<div class="emucontrols-vcs text-center small control-insns" style="display:none">
|
||||
<span class="control-def"><span class="control-key">←↑↓→</span> Joystick</span>
|
||||
|
|
|
@ -34,8 +34,8 @@ void main(void) {
|
|||
pal_bg(PALETTE);
|
||||
|
||||
// fill nametable with diamonds
|
||||
vram_adr(NAMETABLE_A);
|
||||
vram_fill(0x16, 32*30);
|
||||
vram_adr(NAMETABLE_A); // start address ($2000)
|
||||
vram_fill(0x16, 32*30); // fill nametable (960 bytes)
|
||||
|
||||
// copy attribute table from PRG ROM to VRAM
|
||||
vram_write(ATTRIBUTE_TABLE, sizeof(ATTRIBUTE_TABLE));
|
||||
|
|
|
@ -133,7 +133,7 @@ function recordVideo(intervalMsec, maxFrames, callback) {
|
|||
|
||||
function startPlatform(qs) {
|
||||
if (!PLATFORMS[platform_id]) throw Error("Invalid platform '" + platform_id + "'.");
|
||||
platform = new PLATFORMS[platform_id]($("#emulator")[0]);
|
||||
platform = new PLATFORMS[platform_id]($("#emuscreen")[0]);
|
||||
platform.start();
|
||||
// start recorder when click on canvas (TODO?)
|
||||
if (qs['rec']) {
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
/* profiler window: currently unused */
|
||||
|
||||
var profilelist;
|
||||
|
||||
var pcdata = {};
|
||||
var prof_reads, prof_writes;
|
||||
|
||||
function scrollProfileView(_ed) {
|
||||
_ed.on('scroll', function(ed, changeobj) {
|
||||
if (profilelist) {
|
||||
profilelist.container.scrollTop = ed.getScrollInfo().top;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateProfileWindow() {
|
||||
if (profilelist && sourcefile) {
|
||||
$("#profileview").find('[data-index]').each(function(i,e) {
|
||||
var div = $(e);
|
||||
var lineno = div.attr('data-index') | 0;
|
||||
var newtext = getProfileLine(lineno+1);
|
||||
if (newtext) {
|
||||
var oldtext = div.text();
|
||||
if (oldtext != newtext)
|
||||
div.text(newtext);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function createProfileWindow() {
|
||||
profilelist = new VirtualList({
|
||||
w:$("#emulator").width(),
|
||||
h:$("#emulator").height(),
|
||||
itemHeight: getVisibleEditorLineHeight(),
|
||||
totalRows: getVisibleSourceFile().lineCount(),
|
||||
generatorFn: function(row) {
|
||||
var div = document.createElement("div");
|
||||
div.appendChild(document.createTextNode("."));
|
||||
return div;
|
||||
}
|
||||
});
|
||||
$("#profileview").empty().append(profilelist.container);
|
||||
updateProfileWindow();
|
||||
}
|
||||
|
||||
function resetProfiler() {
|
||||
prof_reads = [];
|
||||
prof_writes = [];
|
||||
pcdata = [];
|
||||
dumplines = null;
|
||||
}
|
||||
|
||||
function profileWindowCallback(a,v) {
|
||||
if (platform.getPC) {
|
||||
var pc = platform.getPC();
|
||||
var pcd = pcdata[pc];
|
||||
if (!pcd) {
|
||||
pcd = pcdata[pc] = {nv:1};
|
||||
}
|
||||
if (a != pc) {
|
||||
if (v >= 0) {
|
||||
pcd.lastwa = a;
|
||||
pcd.lastwv = v;
|
||||
} else {
|
||||
pcd.lastra = a;
|
||||
pcd.lastrv = platform.readAddress(a);
|
||||
}
|
||||
} else {
|
||||
pcd.nv++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getProfileLine(line) {
|
||||
var srcfile = getVisibleSourceFile();
|
||||
var offset = srcfile.line2offset[line];
|
||||
var offset2 = srcfile.line2offset[line+1];
|
||||
if (!(offset2 > offset)) offset2 = offset+1;
|
||||
var s = '';
|
||||
var nv = 0;
|
||||
while (offset < offset2) {
|
||||
var pcd = pcdata[offset];
|
||||
if (pcd) {
|
||||
nv += pcd.nv;
|
||||
if (pcd.lastra >= 0) {
|
||||
s += " rd [" + hex(pcd.lastra,4) + "] == " + hex(pcd.lastrv,2);
|
||||
}
|
||||
if (pcd.lastwa >= 0) {
|
||||
s += " wr " + hex(pcd.lastwv,2) + " -> [" + hex(pcd.lastwa,4) + "]";
|
||||
}
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
return nv ? (lpad(nv+"",8) + s) : '.';
|
||||
}
|
||||
|
||||
function toggleProfileWindow() {
|
||||
if ($("#memoryview").is(':visible')) toggleMemoryWindow();
|
||||
if ($("#profileview").is(':visible')) {
|
||||
profilelist = null;
|
||||
platform.getProbe().deactivate();
|
||||
$("#emulator").show();
|
||||
$("#profileview").hide();
|
||||
} else {
|
||||
createProfileWindow();
|
||||
platform.getProbe().activate(profileWindowCallback);
|
||||
$("#emulator").hide();
|
||||
$("#profileview").show();
|
||||
}
|
||||
}
|
||||
|
|
@ -1661,7 +1661,6 @@ function addPageFocusHandlers() {
|
|||
|
||||
function showInstructions() {
|
||||
var div = $(document).find(".emucontrols-" + getRootBasePlatform(platform_id));
|
||||
$("#emulator").append(div);
|
||||
var vcanvas = $("#emulator").find("canvas");
|
||||
if (vcanvas) {
|
||||
vcanvas.on('focus', () => {
|
||||
|
@ -1685,7 +1684,7 @@ function installGAHooks() {
|
|||
|
||||
function startPlatform() {
|
||||
if (!PLATFORMS[platform_id]) throw Error("Invalid platform '" + platform_id + "'.");
|
||||
platform = new PLATFORMS[platform_id]($("#emulator")[0]);
|
||||
platform = new PLATFORMS[platform_id]($("#emuscreen")[0]);
|
||||
stateRecorder = new StateRecorderImpl(platform);
|
||||
PRESETS = platform.getPresets();
|
||||
if (!qs['file']) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user