mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-04-09 21:37:17 +00:00
setCompileOutput always called; devel-6502 platform
This commit is contained in:
parent
67bf6c7310
commit
d482145319
@ -195,6 +195,8 @@ TODO:
|
||||
- BIOS symbols
|
||||
- show current tool for file
|
||||
|
||||
Probing
|
||||
- probe log doesn't start @ reset
|
||||
|
||||
|
||||
WEB WORKER FORMAT
|
||||
|
@ -101,11 +101,11 @@ export type WorkerOutput = Uint8Array | VerilogOutput;
|
||||
export type Segment = {name:string, start:number, size:number, last?:number, type?:string};
|
||||
|
||||
export interface WorkerResult {
|
||||
output:WorkerOutput
|
||||
errors:WorkerError[]
|
||||
listings:CodeListingMap
|
||||
symbolmap:{[sym:string]:number}
|
||||
params:{}
|
||||
output?:WorkerOutput
|
||||
listings?:CodeListingMap
|
||||
symbolmap?:{[sym:string]:number}
|
||||
params?:{}
|
||||
segments?:Segment[]
|
||||
unchanged?:boolean
|
||||
debuginfo?:{} // optional info
|
||||
|
@ -56,8 +56,8 @@ export class CodeProject {
|
||||
}
|
||||
if (data && !data.unchanged) {
|
||||
this.processBuildResult(data);
|
||||
if (this.callbackBuildResult) this.callbackBuildResult(data); // call with data when changed
|
||||
}
|
||||
this.callbackBuildResult(data);
|
||||
}
|
||||
|
||||
preloadWorker(path:string) {
|
||||
|
@ -179,21 +179,21 @@ function initProject() {
|
||||
}
|
||||
current_project.callbackBuildResult = (result:WorkerResult) => {
|
||||
setCompileOutput(result);
|
||||
refreshWindowList();
|
||||
};
|
||||
current_project.callbackBuildStatus = (busy:boolean) => {
|
||||
if (busy) {
|
||||
toolbar.addClass("is-busy");
|
||||
} else {
|
||||
toolbar.removeClass("is-busy");
|
||||
toolbar.removeClass("has-errors"); // may be added in next callback
|
||||
projectWindows.setErrors(null);
|
||||
hideErrorAlerts();
|
||||
}
|
||||
$('#compile_spinner').css('visibility', busy ? 'visible' : 'hidden');
|
||||
setBusyStatus(busy);
|
||||
};
|
||||
}
|
||||
|
||||
function setBusyStatus(busy: boolean) {
|
||||
if (busy) {
|
||||
toolbar.addClass("is-busy");
|
||||
} else {
|
||||
toolbar.removeClass("is-busy");
|
||||
}
|
||||
$('#compile_spinner').css('visibility', busy ? 'visible' : 'hidden');
|
||||
}
|
||||
|
||||
function refreshWindowList() {
|
||||
var ul = $("#windowMenuList").empty();
|
||||
var separate = false;
|
||||
@ -1129,11 +1129,16 @@ function measureBuildTime() {
|
||||
|
||||
function setCompileOutput(data: WorkerResult) {
|
||||
// errors? mark them in editor
|
||||
if (data.errors && data.errors.length > 0) {
|
||||
if (data && data.errors && data.errors.length > 0) {
|
||||
toolbar.addClass("has-errors");
|
||||
projectWindows.setErrors(data.errors);
|
||||
showErrorAlert(data.errors);
|
||||
} else {
|
||||
toolbar.removeClass("has-errors"); // may be added in next callback
|
||||
projectWindows.setErrors(null);
|
||||
hideErrorAlerts();
|
||||
// exit if compile output unchanged
|
||||
if (data == null || data.unchanged) return;
|
||||
// process symbol map
|
||||
platform.debugSymbols = new DebugSymbols(data.symbolmap, data.debuginfo);
|
||||
compparams = data.params;
|
||||
@ -1157,6 +1162,7 @@ function setCompileOutput(data: WorkerResult) {
|
||||
}
|
||||
}
|
||||
// update all windows (listings)
|
||||
refreshWindowList();
|
||||
projectWindows.refresh(false);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export interface ProjectView {
|
||||
};
|
||||
|
||||
// detect mobile (https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device)
|
||||
export var isMobileDevice = window.matchMedia("only screen and (max-width: 760px)").matches;
|
||||
export var isMobileDevice = window.matchMedia && window.matchMedia("only screen and (max-width: 760px)").matches;
|
||||
|
||||
declare var CodeMirror;
|
||||
declare var VirtualList;
|
||||
|
43
src/machine/devel.ts
Normal file
43
src/machine/devel.ts
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
import { MOS6502 } from "../common/cpu/MOS6502";
|
||||
import { BasicHeadlessMachine } from "../common/devices";
|
||||
import { padBytes, newAddressDecoder } from "../common/emu"; // TODO
|
||||
|
||||
export class Devel6502 extends BasicHeadlessMachine {
|
||||
cpuFrequency = 1000000;
|
||||
defaultROMSize = 0x8000;
|
||||
|
||||
cpu = new MOS6502();
|
||||
ram = new Uint8Array(0x4000);
|
||||
rom : Uint8Array;
|
||||
|
||||
digits = [];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.connectCPUMemoryBus(this);
|
||||
}
|
||||
|
||||
read = newAddressDecoder([
|
||||
[0x0000, 0x3fff, 0x3fff, (a) => { return this.ram[a]; }],
|
||||
[0x8000, 0xffff, 0x7fff, (a) => { return this.rom && this.rom[a]; }],
|
||||
]);
|
||||
|
||||
write = newAddressDecoder([
|
||||
[0x0000, 0x3fff, 0x3fff, (a,v) => { this.ram[a] = v; }],
|
||||
]);
|
||||
|
||||
readConst(a:number) : number {
|
||||
return this.read(a);
|
||||
}
|
||||
|
||||
advanceFrame(trap) : number {
|
||||
var clock = 0;
|
||||
while (clock < this.cpuFrequency/60) {
|
||||
if (trap && trap()) break;
|
||||
clock += this.advanceCPU();
|
||||
}
|
||||
return clock;
|
||||
}
|
||||
}
|
||||
|
26
src/platform/devel.ts
Normal file
26
src/platform/devel.ts
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
import { Platform, getOpcodeMetadata_6502, getToolForFilename_6502 } from "../common/baseplatform";
|
||||
import { PLATFORMS } from "../common/emu";
|
||||
import { Devel6502 } from "../machine/devel";
|
||||
import { Base6502MachinePlatform } from "../common/baseplatform";
|
||||
|
||||
var DEVEL_6502_PRESETS = [
|
||||
{id:'hello.dasm', name:'Hello World (ASM)'},
|
||||
];
|
||||
|
||||
class Devel6502Platform extends Base6502MachinePlatform<Devel6502> implements Platform {
|
||||
|
||||
newMachine() { return new Devel6502(); }
|
||||
getPresets() { return DEVEL_6502_PRESETS; }
|
||||
getDefaultExtension() { return ".dasm"; };
|
||||
readAddress(a) { return this.machine.readConst(a); }
|
||||
|
||||
getMemoryMap = function() { return { main:[
|
||||
{name:'RAM', start:0x0000,size:0x4000,type:'ram'},
|
||||
{name:'ROM', start:0x8000,size:0x8000,type:'rom'},
|
||||
] } };
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
PLATFORMS['devel-6502'] = Devel6502Platform;
|
@ -27,7 +27,3 @@ class KIM1Platform extends Base6502MachinePlatform<KIM1> implements Platform {
|
||||
///
|
||||
|
||||
PLATFORMS['kim1'] = KIM1Platform;
|
||||
|
||||
// https://github.com/jefftranter/6502/blob/master/asm/KIM-1/ROMs/kim.s
|
||||
const KIM1_BIOS_LZG = `TFpHAAAIAAAABY3ivWkoAQsOJSiprY3sFyAyGaknjUIXqb+NQxeiZKkWIHoZytD4qSoo4a35FyBhGa31FyBeGa32KKPtF833F63uF+34F5AkqS8lXeclnegooqICqQQOBTgAhfqF+0xPHCDsJXAg6hlMMxgPGamNDgVrTI3vF61xGI3wF61yGI3xF6kHDgJ8/43pFyBBGk7pFw3pFyUErekXyRbQ7aIKICQaJQHfytD2JUIq8AYlBtHw8yDzGc35F/ANrfkXyQAlDf/wF9CcJQ0gTBmN7RcOBQHuF0z4GCXEKKSiAiV9L/AUIAAa0CPK0PElDEzsFw4CnCWhzecX0Awo4ugX0ASpAPACqf8OBcWt9ReN7Ret9heN7hepYI3vF6kAjecXjegXYKgYbSUB5xet6BdpACUJmGAgTBmoSigBIG8ZmChiYCkPyQoYMAJpB2kwjukXjOoXoAggnhlKsAYooUyRGSDEKEKI0Ouu6Res6hdgoglILEcXEPupfo1EF6mnjUIXDgkHDiKqytDfaGCiBg4FHsMODB4lhw4HHu7tF9AD7u4XYCAkGiAAGiikYMkwMB7JRxAayUAwAxhpCSooAaQEKi7pF4jQ+a3pF6AAYMhgjusXoggOIovqFw3qF43qF8rQ8a3qFypKrusXYCxCFxD7rUYXoP+MKIEUiND9JQow+zjtDgYLByULSf8pgGAOSFsOBJeaDgymJYclW0x1Gv8oHygfKB4oGWsaKCKF82iF8WiF74X6aIXwhfuE9Ib1uobyIIgeTE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AKAMKDU1JSyATUlJFIBO/htvP5u39h//v9/y53vnx////HBwiHB8c`;
|
||||
|
||||
|
@ -55,6 +55,7 @@ describe('Store', function () {
|
||||
};
|
||||
var project = new prj.CodeProject(worker, test_platform_id, platform, store);
|
||||
project.callbackBuildStatus = function (b) { msgs.push(b) };
|
||||
project.callbackBuildResult = function (b) { msgs.push(1) };
|
||||
project.updateFile('test.a', ' lda #0');
|
||||
project.setMainFile('test.a');
|
||||
setTimeout(() => {
|
||||
@ -79,6 +80,7 @@ describe('Store', function () {
|
||||
};
|
||||
var project = new prj.CodeProject(worker, test_platform_id, platform, store);
|
||||
project.callbackBuildStatus = function (b) { msgs.push(b) };
|
||||
project.callbackBuildResult = function (b) { msgs.push(1) };
|
||||
var buildresult = {
|
||||
listings: {
|
||||
test: {
|
||||
@ -87,7 +89,7 @@ describe('Store', function () {
|
||||
}
|
||||
};
|
||||
worker.onmessage({ data: buildresult });
|
||||
assert.deepEqual([false], msgs);
|
||||
assert.deepEqual([false, 1], msgs);
|
||||
var lst = buildresult.listings.test;
|
||||
console.log(lst);
|
||||
assert.deepEqual({ line: 3, offset: 61440, insns: 'a9 00', iscode: true },
|
||||
|
Loading…
x
Reference in New Issue
Block a user