diff --git a/src/cpu/6809.js b/src/cpu/6809.js index fa7335aa..eb7b5e2d 100644 --- a/src/cpu/6809.js +++ b/src/cpu/6809.js @@ -2352,7 +2352,14 @@ return { Ts-=step(); } }, + runFrame: function(Tt){ + while (T 2) { + rom = padBytes(data, 0xc000); + } // TODO self.reset(); } @@ -362,10 +368,16 @@ var WilliamsPlatform = function(mainElement) { this.reset = function() { cpu.reset(); watchdog_counter = INITIAL_WATCHDOG; + banksel = 1; } this.readAddress = function(addr) { return membus.read(addr); } } +var WilliamsZ80Platform = function(mainElement) { + this.__proto__ = new WilliamsPlatform(mainElement, BaseZ80Platform); +} + PLATFORMS['williams'] = WilliamsPlatform; +PLATFORMS['williams-z80'] = WilliamsZ80Platform; diff --git a/src/ui.js b/src/ui.js index bde2d2cc..1168dbb9 100644 --- a/src/ui.js +++ b/src/ui.js @@ -907,6 +907,7 @@ function initPlatform() { function startPlatform() { initPlatform(); + if (!PLATFORMS[platform_id]) throw Error("Invalid platform '" + platform_id + "'."); platform = new PLATFORMS[platform_id]($("#emulator")[0]); PRESETS = platform.getPresets(); if (qs['file']) { @@ -970,7 +971,8 @@ function startUI(loadplatform) { } else { // load and start platform object if (loadplatform) { - $.getScript('src/platform/' + platform_id + '.js', function() { + var scriptfn = 'src/platform/' + platform_id.split('-')[0] + '.js'; + $.getScript(scriptfn, function() { console.log("loaded platform", platform_id); startPlatform(); }); diff --git a/src/worker/workermain.js b/src/worker/workermain.js index 661ea975..3c601699 100644 --- a/src/worker/workermain.js +++ b/src/worker/workermain.js @@ -19,6 +19,12 @@ var PLATFORM_PARAMS = { data_start: 0x4000, data_size: 0x400, }, + 'williams-z80': { + code_start: 0x0, + code_size: 0x9000, + data_start: 0x9000, + data_size: 0x3000, + }, }; var loaded = {} @@ -639,7 +645,11 @@ function compileSDCC(code, platform) { if (msvc_errors.length) { return {errors:msvc_errors}; } - var asmout = FS.readFile("main.asm", {encoding:'utf8'}); + try { + var asmout = FS.readFile("main.asm", {encoding:'utf8'}); + } catch (e) { + return {errors:[{line:1, msg:e+""}]}; + } var warnings = msvc_errors; var result = assemblelinkSDASZ80(asmout, platform, true); result.asmlines = result.lines; @@ -711,7 +721,7 @@ function preprocessMCPP(code, platform) { FS.writeFile("main.c", code, {encoding:'utf8'}); MCPP.callMain([ "-D", "__8BITWORKSHOP__", - "-D", platform.toUpperCase(), + "-D", platform.toUpperCase().replace('-','_'), "-I", "/share/include", "-Q", "main.c", "main.i"]); @@ -725,7 +735,11 @@ function preprocessMCPP(code, platform) { var errout = FS.readFile("mcpp.err", {encoding:'utf8'}); if (errout.length) { // //main.c:2: error: Can't open include file "stdiosd.h" - return {errors: extractErrors(/[^:]+:(\d+): (.+)/, errout.split("\n"))}; + var errors = extractErrors(/[^:]+:(\d+): (.+)/, errout.split("\n")); + if (errors.length == 0) { + errors = [{line:1, msg:errout}]; + } + return {errors: errors}; } } catch (e) { //