diff --git a/index.html b/index.html index 88f4f59a..85da42fc 100644 --- a/index.html +++ b/index.html @@ -43,20 +43,24 @@ body { .tooltipbox:hover .tooltiptext { visibility: visible; } -#notebook { - height: 100vh; - width: 50%; +#controls_top { + position: absolute; + padding: 0.5em; + height:3em; + width:100%; background-color:#999; } -#controls_top { - padding: 0.5em; - width:100%; - height:3em; +#notebook { + position:absolute; + top:3em; + bottom:0; + left:0; + right:0; } div.editor { position:absolute; left:0; - top:3em; + top:0; bottom:0; right:0; width:50%; @@ -165,40 +169,41 @@ a.dropdown-toggle { -
-
- - - - - - - - - - - +
+ + + + + + + + + + + - - - - -
+ + +
+ +
+
@@ -253,6 +258,7 @@ a.dropdown-toggle { + diff --git a/src/platform/exidy.js b/src/platform/exidy.js new file mode 100644 index 00000000..99564eb7 --- /dev/null +++ b/src/platform/exidy.js @@ -0,0 +1,195 @@ +"use strict"; + +var EXIDY_PRESETS = [ +]; + +var ExidyPlatform = function(mainElement) { + var self = this; + var cpuFrequency = 705562; + var cyclesPerFrame = Math.round(cpuFrequency/60); + var vblankCyclesPerFrame = Math.round(cpuFrequency*3/(262.5*60)); + var cpu, ram, bus, rom; + var video, ap2disp, audio, timer; + var port_dsw = 0; + var PGM_BASE = 0x1000; // where to JMP after pr#6 + + this.getPresets = function() { + return EXIDY_PRESETS; + } + + this.start = function() { + cpu = new jt.M6502(); + ram = new RAM(0x200); // 64K + 16K LC RAM - 4K hardware + rom = new RAM(0x1000); + // bus + bus = { + read: function(address) { + address &= 0xffff; + if (address < ram.mem.length) { + return ram.mem[address]; + } else if (address >= 0x1000 && address <= 0x1fff) { + return rom.mem[address - 0x1000]; + } else if (address >= 0xf000) { + return rom.mem[address - 0xf000]; + } else if (address == 0xc000) { + return port_dsw; + } + return 0; + }, + write: function(address, val) { + address &= 0xffff; + val &= 0xff; + if (address < ram.mem.length) { + ram.mem[address] = val; + } + } + }; + cpu.connectBus(bus); + // create video/audio + video = new RasterVideo(mainElement,256,256); + video.start(); + audio = new SampleAudio(cpuFrequency); // TODO + audio.start(); + var idata = video.getFrameData(); + timer = new AnimationTimer(60, function() { + var clock = 0; + breakClock = -1; + for (var i=0; i debugTargetClock) { + var thisState = cpu.saveState(); + if (previousPC < 0) { + previousPC = thisState.PC; + } else { + if (thisState.PC != previousPC && thisState.T == 0) { + //console.log(previousPC.toString(16), thisPC.toString(16)); + debugTargetClock = debugClock-1; + self.breakpointHit(); + return true; + } + } + } + return false; + }); + } + this.runEval = function(evalfunc) { + var self = this; + self.setDebugCondition(function() { + if (debugClock++ > debugTargetClock) { + var cpuState = cpu.saveState(); + cpuState.PC = (cpuState.PC-1)&0xffff; + if (evalfunc(cpuState)) { + self.breakpointHit(); + debugTargetClock = debugClock; + return true; + } else { + return false; + } + } + }); + } + + this.loadState = function(state) { + cpu.loadState(state.c); + ram.mem.set(state.b); + } + this.saveState = function() { + return { + c:cpu.saveState(), + b:ram.mem.slice(0), + }; + } + this.getRAMForState = function(state) { + return ram.mem; + } +}; diff --git a/src/ui.js b/src/ui.js index 3624e140..5bc10c7d 100644 --- a/src/ui.js +++ b/src/ui.js @@ -263,7 +263,7 @@ function arrayCompare(a,b) { worker.onmessage = function(e) { // errors? - var toolbar = $("#notebook"); + var toolbar = $("#controls_top"); if (e.data.listing.errors.length > 0) { toolbar.addClass("has-errors"); editor.clearGutter("gutter-info"); @@ -806,6 +806,7 @@ try { platform_id = qs['platform'] = "vcs"; } // load and start platform object + // TODO: self-register platforms if (platform_id == 'vcs') { platform = new VCSPlatform(); $("#booklink_vcs").show(); @@ -813,6 +814,8 @@ try { platform = new Apple2Platform($("#emulator")[0]); } else if (platform_id == 'atarivec') { platform = new AtariVectorPlatform($("#emulator")[0]); + } else if (platform_id == 'exidy') { + platform = new ExidyPlatform($("#emulator")[0]); } else { alert("Platform " + platform_id + " not recognized"); }