generate z80 cpu on demand like we used to, fix test b/c global.z80 is global
This commit is contained in:
parent
b5d0c2410b
commit
3ebfd784a6
|
@ -44,7 +44,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||||
<script src="jquery/jquery-3.4.1.min.js"></script>
|
<script src="jquery/jquery-3.4.1.min.js"></script>
|
||||||
|
|
||||||
<script src="javatari.js/release/javatari/javatari.js"></script>
|
<script src="javatari.js/release/javatari/javatari.js"></script>
|
||||||
<script src="src/cpu/z80fast.js"></script>
|
<script src="src/cpu/z80.js"></script>
|
||||||
<script src="jsnes/dist/jsnes.min.js"></script>
|
<script src="jsnes/dist/jsnes.min.js"></script>
|
||||||
<script src="src/cpu/6809.js"></script>
|
<script src="src/cpu/6809.js"></script>
|
||||||
<script src="FileSaver.js/FileSaver.min.js"></script>
|
<script src="FileSaver.js/FileSaver.min.js"></script>
|
||||||
|
|
|
@ -408,7 +408,7 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||||
<script src="javatari.js/src/main/Javatari.js"></script>
|
<script src="javatari.js/src/main/Javatari.js"></script>
|
||||||
<script src="javatari.js/temp/javatari.part.concat.js"></script>
|
<script src="javatari.js/temp/javatari.part.concat.js"></script>
|
||||||
-->
|
-->
|
||||||
<script src="src/cpu/z80fast.js"></script>
|
<script src="src/cpu/z80.js"></script>
|
||||||
<script src="jsnes/dist/jsnes.min.js"></script>
|
<script src="jsnes/dist/jsnes.min.js"></script>
|
||||||
<script src="src/cpu/6809.js"></script>
|
<script src="src/cpu/6809.js"></script>
|
||||||
<!--<script src="jsnes/lib/dynamicaudio-min.js" type="text/javascript" charset="utf-8"></script>-->
|
<!--<script src="jsnes/lib/dynamicaudio-min.js" type="text/javascript" charset="utf-8"></script>-->
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { CodeAnalyzer } from "./analysis";
|
||||||
import { disassemble6502 } from "./cpu/disasm6502";
|
import { disassemble6502 } from "./cpu/disasm6502";
|
||||||
import { disassembleZ80 } from "./cpu/disasmz80";
|
import { disassembleZ80 } from "./cpu/disasmz80";
|
||||||
|
|
||||||
declare var Z80_fast, jt, CPU6809;
|
declare var buildZ80, jt, CPU6809;
|
||||||
|
|
||||||
export interface OpcodeMetadata {
|
export interface OpcodeMetadata {
|
||||||
minCycles: number;
|
minCycles: number;
|
||||||
|
@ -517,7 +517,8 @@ export abstract class BaseZ80Platform extends BaseDebugPlatform {
|
||||||
|
|
||||||
newCPU(membus : MemoryBus, iobus : MemoryBus) {
|
newCPU(membus : MemoryBus, iobus : MemoryBus) {
|
||||||
this.probe = new BusProbe(membus);
|
this.probe = new BusProbe(membus);
|
||||||
this._cpu = Z80_fast({
|
var z80opts = {};
|
||||||
|
this._cpu = buildZ80(z80opts)({
|
||||||
display: {},
|
display: {},
|
||||||
memory: this.probe,
|
memory: this.probe,
|
||||||
ioBus: iobus
|
ioBus: iobus
|
||||||
|
|
15331
src/cpu/z80fast.js
15331
src/cpu/z80fast.js
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
||||||
import { hex, clamp } from "./util";
|
import { hex, clamp } from "./util";
|
||||||
|
|
||||||
// external modules
|
// external modules
|
||||||
declare var jt, Javatari, Z80_fast, CPU6809;
|
declare var jt, Javatari;
|
||||||
declare var Mousetrap;
|
declare var Mousetrap;
|
||||||
|
|
||||||
// Emulator classes
|
// Emulator classes
|
||||||
|
|
|
@ -6,7 +6,7 @@ var PNG = require('pngjs').PNG;
|
||||||
|
|
||||||
const jsdom = require('jsdom');
|
const jsdom = require('jsdom');
|
||||||
const { JSDOM } = jsdom;
|
const { JSDOM } = jsdom;
|
||||||
const { window } = new JSDOM();
|
//const { window } = new JSDOM();
|
||||||
|
|
||||||
const dom = new JSDOM(`<!DOCTYPE html><div id="emulator"><div id="javatari-screen"></div></div>`);
|
const dom = new JSDOM(`<!DOCTYPE html><div id="emulator"><div id="javatari-screen"></div></div>`);
|
||||||
global.window = dom.window;
|
global.window = dom.window;
|
||||||
|
@ -14,10 +14,10 @@ global.document = dom.window.document;
|
||||||
dom.window.Audio = null;
|
dom.window.Audio = null;
|
||||||
global.Image = function() { }
|
global.Image = function() { }
|
||||||
global['$'] = require("jquery/jquery-2.2.3.min.js");
|
global['$'] = require("jquery/jquery-2.2.3.min.js");
|
||||||
global.includeInThisContext('src/cpu/z80fast.js');
|
includeInThisContext('src/cpu/z80.js');
|
||||||
|
global['buildZ80'] = global.window.buildZ80;
|
||||||
includeInThisContext("javatari.js/release/javatari/javatari.js");
|
includeInThisContext("javatari.js/release/javatari/javatari.js");
|
||||||
Javatari.AUTO_START = false;
|
Javatari.AUTO_START = false;
|
||||||
includeInThisContext('src/cpu/z80fast.js');
|
|
||||||
includeInThisContext('tss/js/Log.js');
|
includeInThisContext('tss/js/Log.js');
|
||||||
//global.Log = require('tss/js/Log.js').Log;
|
//global.Log = require('tss/js/Log.js').Log;
|
||||||
includeInThisContext('tss/js/tss/PsgDeviceChannel.js');
|
includeInThisContext('tss/js/tss/PsgDeviceChannel.js');
|
||||||
|
|
|
@ -1,17 +1,8 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (true) {
|
var wtu = require('../workertestutils.js');
|
||||||
global.window = global;
|
includeInThisContext('src/cpu/z80.js');
|
||||||
require('../../../src/cpu/z80.js');
|
if (!global.buildZ80) global.buildZ80 = global.window.buildZ80;
|
||||||
var _global = window;
|
|
||||||
_global.buildZ80({
|
|
||||||
applyContention: true
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
var wtu = require('../workertestutils.js');
|
|
||||||
global.includeInThisContext('src/cpu/z80fast.js');
|
|
||||||
var _global = {Z80:Z80_fast};
|
|
||||||
}
|
|
||||||
|
|
||||||
var Memory = function(dump) {
|
var Memory = function(dump) {
|
||||||
var self = {};
|
var self = {};
|
||||||
|
@ -99,7 +90,7 @@ function runTest(input, expected) {
|
||||||
|
|
||||||
var memory = Memory(dump);
|
var memory = Memory(dump);
|
||||||
var ioBus = IOBus();
|
var ioBus = IOBus();
|
||||||
var z80 = _global.Z80({
|
var z80 = global.Z80({
|
||||||
display: {},
|
display: {},
|
||||||
memory: memory,
|
memory: memory,
|
||||||
ioBus: ioBus
|
ioBus: ioBus
|
||||||
|
@ -208,7 +199,7 @@ assert(testsIn.length == testsExpected.length);
|
||||||
function benchmark(cycles) {
|
function benchmark(cycles) {
|
||||||
var memory = Memory(function() { });
|
var memory = Memory(function() { });
|
||||||
var ioBus = IOBus();
|
var ioBus = IOBus();
|
||||||
var z80 = _global.Z80({
|
var z80 = global.Z80({
|
||||||
display: {},
|
display: {},
|
||||||
memory: memory,
|
memory: memory,
|
||||||
ioBus: ioBus
|
ioBus: ioBus
|
||||||
|
@ -223,7 +214,11 @@ function benchmark(cycles) {
|
||||||
|
|
||||||
if (global.describe) {
|
if (global.describe) {
|
||||||
describe('Z80 CPU', function() {
|
describe('Z80 CPU', function() {
|
||||||
it('should execute test cases', function() {
|
global.buildZ80({
|
||||||
|
applyContention: true
|
||||||
|
});
|
||||||
|
global.Z80 = global.window.Z80;
|
||||||
|
it('should execute Z80 test cases', function() {
|
||||||
for (var iter=0; iter<testsIn.length; iter++) {
|
for (var iter=0; iter<testsIn.length; iter++) {
|
||||||
var fn = function(index, input, expected) {
|
var fn = function(index, input, expected) {
|
||||||
var output = runTest(input);
|
var output = runTest(input);
|
||||||
|
@ -231,7 +226,7 @@ if (global.describe) {
|
||||||
}.call(this, iter, testsIn[iter], testsExpected[iter]);
|
}.call(this, iter, testsIn[iter], testsExpected[iter]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('should run 1M cycles', function() {
|
it('should run Z80 1M cycles', function() {
|
||||||
benchmark(1164770);
|
benchmark(1164770);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<script src="jquery/jquery-3.4.1.min.js"></script>
|
<script src="jquery/jquery-3.4.1.min.js"></script>
|
||||||
|
|
||||||
<script src="javatari.js/release/javatari/javatari.js"></script>
|
<script src="javatari.js/release/javatari/javatari.js"></script>
|
||||||
<script src="src/cpu/z80fast.js"></script>
|
<script src="src/cpu/z80.js"></script>
|
||||||
<script src="jsnes/jsnes.min.js"></script>
|
<script src="jsnes/jsnes.min.js"></script>
|
||||||
<script src="localForage/dist/localforage.nopromises.js"></script>
|
<script src="localForage/dist/localforage.nopromises.js"></script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue