diff --git a/src/common/baseplatform.ts b/src/common/baseplatform.ts index 763f37bc..6f6483b3 100644 --- a/src/common/baseplatform.ts +++ b/src/common/baseplatform.ts @@ -225,7 +225,7 @@ export abstract class BasePlatform { getDebugTree() : {} { var o : any = { }; o.state = this.saveState(); - if (this.debugSymbols.debuginfo) o.debuginfo = this.debugSymbols.debuginfo; + if (this.debugSymbols?.debuginfo) o.debuginfo = this.debugSymbols.debuginfo; return o; } readFile(path: string) : FileData { diff --git a/src/platform/williams.ts b/src/platform/williams.ts index 54de92ab..0f36acdc 100644 --- a/src/platform/williams.ts +++ b/src/platform/williams.ts @@ -15,7 +15,7 @@ var WilliamsPlatform = function(mainElement, proto, options) { var self = this; this.__proto__ = new (proto ? proto : Base6809Platform)(); - var isDefender = options.isDefender; + var isDefender = options?.isDefender; var SCREEN_HEIGHT = 304; var SCREEN_WIDTH = 256; @@ -303,7 +303,7 @@ var WilliamsPlatform = function(mainElement, proto, options) { workerchannel = new WorkerSoundChannel(worker); audio.master.addChannel(workerchannel); - let rotate = options.rotate == null ? -90 : parseFloat(options.rotate); + let rotate = options?.rotate == null ? -90 : parseFloat(options.rotate); video = new RasterVideo(mainElement, SCREEN_WIDTH, SCREEN_HEIGHT, { rotate }); video.create(); $(video.canvas).click(function(e) { diff --git a/src/worker/tools/cc65.ts b/src/worker/tools/cc65.ts index fe324a58..a7bebcf6 100644 --- a/src/worker/tools/cc65.ts +++ b/src/worker/tools/cc65.ts @@ -230,11 +230,12 @@ export function linkLD65(step: BuildStep): BuildStepResult { if (fn.endsWith('.lst')) { var lstout = FS.readFile(fn, { encoding: 'utf8' }); lstout = lstout.split('\n\n')[1] || lstout; // remove header - var asmlines = []; // TODO: parseCA65Listing(lstout, symbolmap, params, false); - var srclines = parseCA65Listing(lstout, symbolmap, params, true, listings); + var asmlines = parseCA65Listing(lstout, symbolmap, params, false); + var srclines = parseCA65Listing(lstout, symbolmap, params, true); // TODO: listings param for ecs putWorkFile(fn, lstout); listings[fn] = { - lines: [], + asmlines: srclines.length ? asmlines : null, + lines: srclines.length ? srclines : asmlines, text: lstout }; } diff --git a/test/cli/testplatforms.js b/test/cli/testplatforms.js index 8889f072..64e336f9 100644 --- a/test/cli/testplatforms.js +++ b/test/cli/testplatforms.js @@ -196,9 +196,9 @@ async function testPlatform(platid, romname, maxframes, callback) { assert.equal(clks, proberec.countClocks()); } // debug tree - if (platform.getDebugTree) { + if (platform.getDebugTree != null) { var dbgtree = platform.getDebugTree(); - JSON.stringify(dbgtree); + if (dbgtree != null) JSON.stringify(dbgtree); } // misc assert.ok(platform.getDefaultExtension().startsWith('.'));