From 52b58f471c4100c116f50b3ba1f675aca40adfa4 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Wed, 1 Feb 2017 13:21:17 -0500 Subject: [PATCH] working on vector --- index.html | 2 +- src/emu.js | 31 ++++- src/platform/galaxian.js | 4 +- src/platform/{atarivec.js => vector.js} | 149 ++++++++++++++++++++---- src/platform/williams.js | 31 ++--- src/worker/workermain.js | 30 ++++- testemu.html | 3 + tools/p4_to_48pix.py | 0 tools/p4_to_pfbytes.py | 0 tools/parsebdf3x5.py | 6 +- tools/parsebdf8.py | 5 +- tools/pbm_to_c.py | 0 12 files changed, 210 insertions(+), 51 deletions(-) rename src/platform/{atarivec.js => vector.js} (62%) mode change 100644 => 100755 tools/p4_to_48pix.py mode change 100644 => 100755 tools/p4_to_pfbytes.py mode change 100644 => 100755 tools/parsebdf3x5.py mode change 100644 => 100755 tools/parsebdf8.py mode change 100644 => 100755 tools/pbm_to_c.py diff --git a/index.html b/index.html index 14f9e56b..d0ca9465 100644 --- a/index.html +++ b/index.html @@ -192,7 +192,7 @@ canvas.pixelated { diff --git a/src/emu.js b/src/emu.js index f06a30fe..a40e33ed 100644 --- a/src/emu.js +++ b/src/emu.js @@ -374,6 +374,12 @@ var AY38910_Audio = function(master) { var Base6502Platform = function() { + this.newCPU = function(membus) { + var cpu = new jt.M6502(); + cpu.connectBus(membus); + return cpu; + } + this.getOpcodeMetadata = function(opcode, offset) { return Javatari.getOpcodeMetadata(opcode, offset); // TODO } @@ -544,12 +550,13 @@ function cpuStateToLongString_Z80(c) { ; } -window.buildZ80({ - applyContention: false // TODO??? -}); var BaseZ80Platform = function() { + window.buildZ80({ + applyContention: false // TODO??? + }); + // TODO: refactor w/ platforms this.newCPU = function(membus, iobus) { return window.Z80({ @@ -559,6 +566,24 @@ var BaseZ80Platform = function() { }); } + // TODO: refactor other parts into here + this.runCPU = function(cpu, cycles) { + var debugCond = this.getDebugCallback(); + var targetTstates = cpu.getTstates() + cycles; + if (debugCond) { // || trace) { + while (cpu.getTstates() < targetTstates) { + //_trace(); // TODO + if (debugCond && debugCond()) { + debugCond = null; + break; + } + cpu.runFrame(cpu.getTstates() + 1); + } + } else { + cpu.runFrame(targetTstates); + } + } + var onBreakpointHit; var debugCondition; var debugSavedState = null; diff --git a/src/platform/galaxian.js b/src/platform/galaxian.js index c9e6f21f..de338ee5 100644 --- a/src/platform/galaxian.js +++ b/src/platform/galaxian.js @@ -1,4 +1,5 @@ "use strict"; + var GALAXIAN_PRESETS = [ ]; @@ -111,7 +112,8 @@ var GalaxianPlatform = function(mainElement) { missile = which; } } - for (var which of [shell,missile]) { + for (var i=0; i<2; i++) { + which = i ? missile : shell; if (which != 0xff) { var sx = 255 - oram.mem[0x60 + (which<<2)+3]; var outi = pixofs+sx; diff --git a/src/platform/atarivec.js b/src/platform/vector.js similarity index 62% rename from src/platform/atarivec.js rename to src/platform/vector.js index 2b6732d5..946ab31a 100644 --- a/src/platform/atarivec.js +++ b/src/platform/vector.js @@ -1,8 +1,22 @@ "use strict"; -var ATARIVEC_PRESETS = [ +var VECTOR_PRESETS = [ ] +var ASTEROIDS_KEYCODE_MAP = makeKeycodeMap([ + [Keys.VK_SHIFT, 3, 0xff], + [Keys.VK_SPACE, 4, 0xff], + [Keys.VK_5, 8, 0xff], + [Keys.VK_6, 9, 0xff], + [Keys.VK_7, 10, 0xff], + [Keys.VK_1, 11, 0xff], + [Keys.VK_2, 12, 0xff], + [Keys.VK_UP, 13, 0xff], + [Keys.VK_RIGHT, 14, 0xff], + [Keys.VK_LEFT, 15, 0xff], +]); + + var AtariVectorPlatform = function(mainElement) { var self = this; var cpuFrequency = 1500000.0; @@ -16,25 +30,11 @@ var AtariVectorPlatform = function(mainElement) { this.__proto__ = new Base6502Platform(); - var ASTEROIDS_KEYCODE_MAP = makeKeycodeMap([ - [Keys.VK_SHIFT, 3, 0xff], - [Keys.VK_SPACE, 4, 0xff], - [Keys.VK_5, 8, 0xff], - [Keys.VK_6, 9, 0xff], - [Keys.VK_7, 10, 0xff], - [Keys.VK_1, 11, 0xff], - [Keys.VK_2, 12, 0xff], - [Keys.VK_UP, 13, 0xff], - [Keys.VK_RIGHT, 14, 0xff], - [Keys.VK_LEFT, 15, 0xff], - ]); - this.getPresets = function() { - return ATARIVEC_PRESETS; + return VECTOR_PRESETS; } this.start = function() { - cpu = new jt.M6502(); cpuram = new RAM(0x400); dvgram = new RAM(0x2000); //switches[5] = 0xff; @@ -60,7 +60,7 @@ var AtariVectorPlatform = function(mainElement) { ], {gmask:0x7fff}) }; - cpu.connectBus(bus); + cpu = self.newCPU(bus); // create video/audio video = new VectorVideo(mainElement,1024,1024); dvg = new DVGStateMachine(bus, video); @@ -68,15 +68,12 @@ var AtariVectorPlatform = function(mainElement) { video.create(); timer = new AnimationTimer(60, function() { video.clear(); - // 262.5 scanlines per frame - var iaddr = 0x4000; - var iofs = 0; var debugCond = self.getDebugCallback(); clock = 0; for (var i=0; i + + +