From c1e83c3a03dbcc6d33b9249e32b74bde6d21d873 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Fri, 10 Jul 2020 23:04:00 -0500 Subject: [PATCH] rebuilt node modules, now typescript lib == es2017 --- package-lock.json | 6 ++ package.json | 1 + src/common/audio/z80worker.ts | 165 ---------------------------------- tsconfig-base.json | 2 +- 4 files changed, 8 insertions(+), 166 deletions(-) delete mode 100644 src/common/audio/z80worker.ts diff --git a/package-lock.json b/package-lock.json index bfb6926f..36f25d86 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,12 @@ "@types/sizzle": "*" } }, + "@types/node": { + "version": "14.0.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.22.tgz", + "integrity": "sha512-emeGcJvdiZ4Z3ohbmw93E/64jRzUHAItSHt8nF7M4TGgQTiWqFVGB8KNpLGFmUHmHLvjvBgFwVlqNcq+VuGv9g==", + "dev": true + }, "@types/sizzle": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", diff --git a/package.json b/package.json index 97750946..d13e5771 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@types/bootbox": "^4.4.36", "@types/bootstrap": "^3.4.0", "@types/jquery": "^3.5.0", + "@types/node": "^14.0.22", "atob": "^2.1.x", "btoa": "^1.2.x", "clipboard": "^2.0.6", diff --git a/src/common/audio/z80worker.ts b/src/common/audio/z80worker.ts deleted file mode 100644 index 182f3e11..00000000 --- a/src/common/audio/z80worker.ts +++ /dev/null @@ -1,165 +0,0 @@ -/**************************************************************************** - - Midway/Williams Audio Boards - ---------------------------- - - 6809 MEMORY MAP - - Function Address R/W Data - --------------------------------------------------------------- - Program RAM 0000-07FF R/W D0-D7 - - Music (YM-2151) 2000-2001 R/W D0-D7 - - 6821 PIA 4000-4003 R/W D0-D7 - - HC55516 clock low, digit latch 6000 W D0 - HC55516 clock high 6800 W xx - - Bank select 7800 W D0-D2 - - Banked Program ROM 8000-FFFF R D0-D7 - -****************************************************************************/ - -import { RAM, newAddressDecoder } from "../emu"; - -declare function importScripts(path:string); -declare function postMessage(msg); - -var cpu, ram, rom, membus, iobus; -var audio; -var command = 0; -var dac = 0; -var current_buffer; -var tstates; -var last_tstate; - -var timer; -var curTime; -var timerPeriod = 20; -var sampleRate; -var numChannels = 2; -var bufferLength; - -var cpuFrequency = 18432000/6; // 3.072 MHz -var cpuCyclesPerFrame = cpuFrequency/60; -var cpuAudioFactor = 32; - -rom = new RAM(0x4000).mem; -// sample: [0xe,0x0,0x6,0x0,0x78,0xb9,0x30,0x06,0xa9,0xd3,0x00,0x04,0x18,0xf6,0x0c,0x79,0xd6,0xff,0x38,0xee,0x76,0x18,0xea]; -rom.fill(0x76); // HALT opcodes - -function fillBuffer() { - var t = tstates / cpuAudioFactor; - while (last_tstate < t) { - current_buffer[last_tstate*2] = dac; - current_buffer[last_tstate*2+1] = dac; - last_tstate++; - } -} - -function start() { - ram = new RAM(0x400); - membus = { - read: newAddressDecoder([ - [0x0000, 0x3fff, 0x3fff, function(a) { return rom ? rom[a] : null; }], - [0x4000, 0x7fff, 0x3ff, function(a) { return ram.mem[a]; }] - ]), - write: newAddressDecoder([ - [0x4000, 0x7fff, 0x3ff, function(a,v) { ram.mem[a] = v; }], - ]), - isContended: function() { return false; }, - }; - iobus = { - read: function(addr) { - return command & 0xff; - }, - write: function(addr, val) { - dac = (val & 0xff) << 8; - fillBuffer(); - } - }; - cpu = new exports.Z80(); - cpu.connectMemoryBus(membus); - cpu.connectIOBus(iobus); - current_buffer = new Int16Array(bufferLength); - console.log('started audio'); -} - -function timerCallback() { - tstates = 0; - last_tstate = 0; - var numStates = Math.floor(bufferLength * cpuAudioFactor / numChannels); - while (tstates < numStates) { - tstates += cpu.advanceInsn(); - } - tstates = 0; - fillBuffer(); - postMessage({samples:current_buffer}); - if (!cpu.saveState().halted) { - curTime += timerPeriod; - var dt = curTime - new Date().getTime(); - if (dt < 0) dt = 0; - timer = setTimeout(timerCallback, dt); - } else { - timer = 0; - //console.log("HALT @ " + cpu.getPC()); - } -} - -function reset() { - if (!bufferLength) return; - cpu.reset(); - if (!timer) { - curTime = new Date().getTime() - timerPeriod*4; - timerCallback(); - } -} - -onmessage = function(e) { - if (e && e.data) { - if (e.data.command) { - command = e.data.command & 0xff; - reset(); - } else if (e.data.sampleRate) { - console.log(e.data); - sampleRate = e.data.sampleRate; - bufferLength = numChannels*sampleRate*timerPeriod/1000; - start(); - reset(); - } else if (e.data.rom) { - rom = e.data.rom; - command = 0x0; - reset(); - } - } -} - - -/** - -0000 56 _main:: - 57 ;:10: -0000 0E 00 [ 7] 58 ld c,#0x00 - 59 ;:11: -0002 60 00111$: -0002 06 00 [ 7] 61 ld b,#0x00 -0004 62 00104$: -0004 78 [ 4] 63 ld a,b -0005 B9 [ 4] 64 cp a,c -0006 30 06 [12] 65 jr NC,00107$ -0008 A9 [ 4] 66 xor a, c -0009 D3 00 [11] 67 out (_dac),a -000B 04 [ 4] 68 inc b -000C 18 F6 [12] 69 jr 00104$ -000E 70 00107$: - 71 ;:10: -000E 0C [ 4] 72 inc c -000F 79 [ 4] 73 ld a,c -0010 D6 FF [ 7] 74 sub a, #0xff -0012 38 EE [12] 75 jr C,00111$ - 76 ;:13: -0014 18 EA [12] 77 jr _main - -**/ diff --git a/tsconfig-base.json b/tsconfig-base.json index 443c7d60..e366bb62 100644 --- a/tsconfig-base.json +++ b/tsconfig-base.json @@ -6,7 +6,7 @@ "sourceMap": true, "target": "es5", "lib": [ - "es2016", + "es2017", "dom" ], "noImplicitThis": false,