1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2025-02-16 17:30:27 +00:00

messing with heat maps

This commit is contained in:
Steven Hugg 2019-08-25 10:45:36 -04:00
parent 768253751a
commit dba3060535
6 changed files with 46 additions and 21 deletions

View File

@ -177,6 +177,10 @@ TODO:
- "shared" in URL doesn't work, leave in URL? (also importURL)
- alert when skeleton file loaded or file not found
- TypeError: null is not an object (evaluating 'n.destination')
https://8bitworkshop.com/v3.4.1/javatari.js/release/javatari/javatari.js
(32:443651) Safari 12.1.2
WEB WORKER FORMAT
{code,platform,tool,dependencies}

View File

@ -299,9 +299,9 @@ export abstract class BasicMachine implements HasCPU, Bus, SampledAudioSource, A
advanceCPU() {
var c = this.cpu as any;
var n = 1;
this.probe.logExecute(this.cpu.getPC());
if (c.advanceClock) c.advanceClock();
else if (c.advanceInsn) n = c.advanceInsn(1);
if (this.cpu.isStable()) { this.probe.logExecute(this.cpu.getPC()); }
if (c.advanceClock) { c.advanceClock(); }
else if (c.advanceInsn) { n = c.advanceInsn(1); }
this.probe.logClocks(n);
return n;
}

View File

@ -1,6 +1,6 @@
import { MOS6502, MOS6502State } from "../cpu/MOS6502";
import { BasicMachine, Bus } from "../devices";
import { BasicMachine, Bus, ProbeAll } from "../devices";
import { KeyFlags, newAddressDecoder, padBytes, Keys, makeKeycodeMap, newKeyboardHandler, EmuHalt, dumpRAM } from "../emu";
import { TssChannelAdapter, MasterAudio, POKEYDeviceChannel } from "../audio";
import { hex, rgb2bgr } from "../util";
@ -57,7 +57,6 @@ const Atari7800_KEYCODE_MAP = makeKeycodeMap([
// http://www.ataripreservation.org/websites/freddy.offenga/megazine/ISSUE5-PALNTSC.html
// http://7800.8bitdev.org/index.php/7800_Software_Guide#APPENDIX_4:_FRAME_TIMING
const CLK = 3579545;
const cpuFrequency = 1789772;
const linesPerFrame = 262;
const numVisibleLines = 258-16;
const colorClocksPerLine = 454; // 456?
@ -99,6 +98,7 @@ class TIA {
class MARIA {
bus : Bus;
probe : ProbeAll;
cycles : number = 0;
regs = new Uint8Array(0x20);
offset : number = -1;
@ -163,8 +163,8 @@ class MARIA {
}
}
readDLLEntry(bus) {
//this.profiler && this.profiler.logRead(this.dll);
let x = bus.read(this.dll);
//this.probe.logRead(this.dll, x); // TODO: use bus
this.offset = (x & 0xf);
this.h16 = (x & 0x40) != 0;
this.h8 = (x & 0x20) != 0;
@ -185,13 +185,14 @@ class MARIA {
return 0;
else {
this.cycles += 3;
//this.profiler && this.profiler.logRead(a);
return this.bus.read(a);
var val = this.bus.read(a);
//this.probe.logRead(a, val); // TODO: use Bus, clocks
return val;
}
}
doDMA(platform : Atari7800) {
let bus = this.bus = platform;
//let profiler = this.profiler = platform.profiler;
let probe = this.probe = platform.probe;
this.cycles = 0;
this.pixels.fill(this.regs[0x0]);
if (this.isDMAEnabled()) {
@ -301,8 +302,8 @@ export class Atari7800 extends BasicMachine {
cpuFrequency = 1789772;
canvasWidth = 320;
numTotalScanlines = 262;
numVisibleScanlines = 258-16;
numTotalScanlines = linesPerFrame;
numVisibleScanlines = numVisibleLines;
defaultROMSize = 0xc000;
cpuCyclesPerLine = 113.5;
sampleRate = audioSampleRate;
@ -402,7 +403,7 @@ export class Atari7800 extends BasicMachine {
if (visible) {
// do DMA for scanline?
let dmaClocks = this.maria.doDMA(this);
this.probe.logClocks(dmaClocks >> 2);
this.probe.logClocks(dmaClocks >> 2); // TODO: logDMA
mc += dmaClocks;
// copy line to frame buffer
if (idata) {
@ -433,10 +434,10 @@ export class Atari7800 extends BasicMachine {
}
// audio
this.audio && this.audioadapter.generate(this.audio);
this.probe.logNewScanline(); // TODO: doesn't go in right place
// update clocks
// update clocks, scanline
mc -= colorClocksPerLine;
fc += mc;
this.probe.logNewScanline();
}
/*
// TODO let bkcol = this.maria.regs[0x0];

View File

@ -206,6 +206,7 @@ export class ProbeRecorder implements ProbeAll {
fclk = 0;
sl = 0;
m : Probeable;
singleFrame : boolean = true;
constructor(m:Probeable) {
this.m = m;
@ -256,6 +257,7 @@ export class ProbeRecorder implements ProbeAll {
logNewFrame() {
this.log(ProbeFlags.FRAME);
this.sl = 0;
if (this.singleFrame) this.reset();
}
logExecute(address:number) {
this.log(address | ProbeFlags.EXECUTE);

View File

@ -262,8 +262,8 @@ function refreshWindowList() {
return new Views.AddressHeatMapView();
});
// TODO: only if raster
addWindowItem("#crtheatmap", "CRT Heatmap", () => {
return new Views.RasterHeatMapView();
addWindowItem("#crtheatmap", "Screen Heatmap", () => {
return new Views.RasterPCHeatMapView();
});
}
addWindowItem('#asseteditor', 'Asset Editor', () => {

View File

@ -937,8 +937,9 @@ abstract class ProbeViewBase {
var canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
canvas.classList.add('pixelated');
canvas.style.width = '100%';
canvas.style.height = '100%';
canvas.style.height = '100vh'; // i hate css
parent.appendChild(div);
div.appendChild(canvas);
this.canvas = canvas;
@ -1013,6 +1014,16 @@ abstract class ProbeBitmapViewBase extends ProbeViewBase {
datau32 : Uint32Array;
recreateOnResize = false;
createDiv(parent : HTMLElement) {
var width = 160;
var height = 262;
try {
width = platform['machine']['cpuCyclesPerLine'] || 160; // TODO
height = platform['machine']['numTotalScanlines'] || 262; // TODO
} catch (e) {
}
return this.createCanvas(parent, width, height);
}
initCanvas() {
this.imageData = this.ctx.createImageData(this.canvas.width, this.canvas.height);
this.datau32 = new Uint32Array(this.imageData.data.buffer);
@ -1062,10 +1073,6 @@ export class AddressHeatMapView extends ProbeBitmapViewBase implements ProjectVi
export class RasterHeatMapView extends ProbeBitmapViewBase implements ProjectView {
createDiv(parent : HTMLElement) {
return this.createCanvas(parent, 160, 262); // TODO
}
drawEvent(op, addr, col, row) {
if (op == ProbeFlags.EXECUTE || op == ProbeFlags.MEM_READ) return;
var rgb = this.getOpRGB(op);
@ -1079,6 +1086,17 @@ export class RasterHeatMapView extends ProbeBitmapViewBase implements ProjectVie
}
export class RasterPCHeatMapView extends ProbeBitmapViewBase implements ProjectView {
drawEvent(op, addr, col, row) {
// if (op != ProbeFlags.EXECUTE) return;
var iofs = col + row * this.canvas.width;
var rgb = addr << 8;
this.datau32[iofs] = rgb | 0xff000000;
}
}
export class EventProbeView extends ProbeViewBase implements ProjectView {
symcache : Map<number,symbol> = new Map();
xmax : number = 1;