mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-12-21 21:29:17 +00:00
started migration to esbuild modules
This commit is contained in:
parent
5c52862a0b
commit
4506ebd7e0
6
Makefile
6
Makefile
@ -43,9 +43,11 @@ meta/electron.diff: index.html electron.html
|
||||
-diff -u index.html electron.html > $@
|
||||
|
||||
tsweb:
|
||||
npm run esbuild-clean
|
||||
(ip addr || ifconfig) | grep inet
|
||||
$(TSC) -w &
|
||||
npm run eswatch &
|
||||
$(TSC) -w --preserveWatchOutput &
|
||||
npm run esbuild-worker -- --watch &
|
||||
npm run esbuild-ui -- --watch &
|
||||
python3 scripts/serveit.py 2>> /dev/null #http.out
|
||||
|
||||
astrolibre.b64.txt: astrolibre.rom
|
||||
|
33
embed.html
33
embed.html
@ -56,47 +56,16 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
<script src="jquery/jquery.min.js"></script>
|
||||
|
||||
<script src="javatari.js/release/javatari/javatari.js"></script>
|
||||
<script src="jsnes/dist/jsnes.min.js"></script>
|
||||
<script src="src/common/cpu/6809.js"></script>
|
||||
<script src="lib/FileSaver.min.js"></script>
|
||||
<script src="lib/mousetrap.min.js"></script>
|
||||
<script src="lib/mousetrap-global-bind.min.js"></script>
|
||||
|
||||
<script>
|
||||
var exports = {};
|
||||
function require(modname) {
|
||||
if (modname == 'jquery') return $;
|
||||
else if (modname.startsWith('.')) return exports;
|
||||
else { console.log("Unknown require()", modname); return exports; }
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="tss/js/tss/PsgDeviceChannel.js"></script>
|
||||
<script src="tss/js/tss/MasterChannel.js"></script>
|
||||
<script src="tss/js/tss/AudioLooper.js"></script>
|
||||
<script src="tss/js/Log.js"></script>
|
||||
|
||||
<script src="gen/common/video/tms9918a.js"></script>
|
||||
<script src="gen/common/util.js"></script>
|
||||
<script src="gen/common/emu.js"></script>
|
||||
<script src="gen/common/baseplatform.js"></script>
|
||||
<script src="gen/common/audio.js"></script>
|
||||
<script src="gen/common/recorder.js"></script>
|
||||
<script src="gen/common/devices.js"></script>
|
||||
<script src="gen/common/cpu/MOS6502.js"></script>
|
||||
<script src="gen/common/cpu/ZilogZ80.js"></script>
|
||||
<script src="gen/machine/vdp_z80.js"></script>
|
||||
<script src="gen/ide/embedui.js"></script>
|
||||
|
||||
<script src="lib/liblzg.js"></script>
|
||||
|
||||
<script>
|
||||
// are we not in an iframe?
|
||||
if(self === top) {
|
||||
document.body.style.backgroundColor = '#555';
|
||||
}
|
||||
startEmbed();
|
||||
</script>
|
||||
<script src="gen/embedui.js" type="module"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
41
index.html
41
index.html
@ -555,7 +555,6 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
<script src="codemirror/addon/selection/active-line.js"></script>
|
||||
<link rel="stylesheet" href="codemirror/addon/dialog/dialog.css">
|
||||
<script src="javatari.js/release/javatari/javatari.js"></script>
|
||||
<script src="jsnes/dist/jsnes.min.js"></script>
|
||||
<script src="src/common/cpu/6809.js"></script>
|
||||
<script src="lib/mousetrap.min.js"></script>
|
||||
<script src="lib/mousetrap-global-bind.min.js"></script>
|
||||
@ -563,18 +562,6 @@ if (window.location.host.endsWith('8bitworkshop.com')) {
|
||||
<link rel="stylesheet" href="lib/bootstrap-tourist.css">
|
||||
<script src="lib/bootstrap-tourist.js"></script>
|
||||
<script src="lib/FileSaver.min.js"></script>
|
||||
<script src="lib/localforage.min.js"></script>
|
||||
<script src="lib/split.min.js"></script>
|
||||
|
||||
<script>
|
||||
var exports = {};
|
||||
function require(modname) {
|
||||
if (modname == 'jquery') return $;
|
||||
else if (modname == 'localforage') return localforage;
|
||||
else if (modname.startsWith('.')) return exports;
|
||||
else { console.log("Unknown require()", modname); return exports; }
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="lib/octokat.js"></script>
|
||||
<script src="tss/js/tss/PsgDeviceChannel.js"></script>
|
||||
@ -582,29 +569,7 @@ function require(modname) {
|
||||
<script src="tss/js/tss/AudioLooper.js"></script>
|
||||
<script src="tss/js/Log.js"></script>
|
||||
|
||||
<script src="gen/ide/vlist.js"></script>
|
||||
<script src="gen/common/video/tms9918a.js"></script>
|
||||
<script src="gen/common/util.js"></script>
|
||||
<script src="gen/common/emu.js"></script>
|
||||
<script src="gen/common/baseplatform.js"></script>
|
||||
<script src="gen/common/analysis.js"></script>
|
||||
<script src="gen/common/audio.js"></script>
|
||||
<script src="gen/common/cpu/disasm6502.js"></script>
|
||||
<script src="gen/common/cpu/disasmz80.js"></script>
|
||||
<script src="gen/common/workertypes.js"></script>
|
||||
<script src="gen/ide/project.js"></script>
|
||||
<script src="gen/ide/windows.js"></script>
|
||||
<script src="gen/ide/views.js"></script>
|
||||
<script src="gen/common/recorder.js"></script>
|
||||
<script src="gen/ide/waveform.js"></script>
|
||||
<script src="gen/ide/pixeleditor.js"></script>
|
||||
<script src="gen/ide/services.js"></script>
|
||||
<script src="gen/ide/ui.js"></script>
|
||||
<script src="gen/common/devices.js"></script>
|
||||
<script src="gen/common/cpu/MOS6502.js"></script>
|
||||
<script src="gen/common/cpu/ZilogZ80.js"></script>
|
||||
<script src="gen/common/cpu/ARM.js"></script>
|
||||
<script src="gen/machine/vdp_z80.js"></script>
|
||||
<script src="gen/ui.js" type="module"></script>
|
||||
|
||||
<script>
|
||||
// submenus open on click + hover
|
||||
@ -615,10 +580,6 @@ $( ".dropdown-submenu" ).click(function(event) {
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
startUI();
|
||||
</script>
|
||||
|
||||
<!-- Sentry error reporting -->
|
||||
<script
|
||||
src="https://browser.sentry-cdn.com/6.4.1/bundle.min.js"
|
||||
|
351
lib/binaryen.js
351
lib/binaryen.js
File diff suppressed because one or more lines are too long
173
lib/capstone-arm.min.js
vendored
Normal file
173
lib/capstone-arm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
56
package-lock.json
generated
56
package-lock.json
generated
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "8bitworkshop",
|
||||
"version": "3.8.1",
|
||||
"version": "3.9.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "3.8.1",
|
||||
"version": "3.9.0",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@sentry/electron": "^2.5.1",
|
||||
@ -14,8 +14,11 @@
|
||||
"@wasmer/wasmfs": "^0.12.0",
|
||||
"binaryen": "^101.0.0",
|
||||
"chokidar": "^3.5.0",
|
||||
"jquery": "^3.5.1",
|
||||
"jquery": "^3.6.0",
|
||||
"localforage": "^1.9.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"split.js": "^1.6.2",
|
||||
"update-electron-app": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -28,7 +31,7 @@
|
||||
"bootstrap": "^3.4.1",
|
||||
"bootstrap-tourist": "^0.2.1",
|
||||
"btoa": "^1.2.x",
|
||||
"chromedriver": "^90.0.1",
|
||||
"chromedriver": "^92.0.0",
|
||||
"clipboard": "^2.0.6",
|
||||
"command-exists": "^1.2.9",
|
||||
"electron": "^9.4.0",
|
||||
@ -40,16 +43,13 @@
|
||||
"jsdom": "^12.2.0",
|
||||
"jsfuzz": "^1.0.14",
|
||||
"jszip": "^3.5.0",
|
||||
"localforage": "^1.9.0",
|
||||
"lzg": "^1.0.x",
|
||||
"mocha": "^7.2.0",
|
||||
"mocha-simple-html-reporter": "^2.0.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"nightwatch": "^1.6.4",
|
||||
"octokat": "^0.10.0",
|
||||
"pngjs": "^3.4.0",
|
||||
"rgbquant": "^1.1.2",
|
||||
"split.js": "^1.6.2",
|
||||
"typedoc": "^0.21.0",
|
||||
"typescript": "^4.3.4",
|
||||
"typescript-formatter": "^7.2.2",
|
||||
@ -1965,8 +1965,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/chromedriver": {
|
||||
"version": "90.0.1",
|
||||
"integrity": "sha512-jvyhin0I/Bacxfet7eg29B1j+5mKR35XwWGbgcCOUALeE3mqcCKJY8xUW9cVrqVqTK9/iUOq8/kar7qrTVshPA==",
|
||||
"version": "92.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-92.0.0.tgz",
|
||||
"integrity": "sha512-IdJ5n5jLL6tCsGQF/fQHF2gDEhVzoYIqktUn6hE/BSsXlCcyDTi45fQbhTEhZlmshM8+BpnRtPuIT5DRbxNqKg==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
@ -4539,8 +4540,7 @@
|
||||
},
|
||||
"node_modules/immediate": {
|
||||
"version": "3.0.6",
|
||||
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=",
|
||||
"dev": true
|
||||
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
|
||||
},
|
||||
"node_modules/import-lazy": {
|
||||
"version": "2.1.0",
|
||||
@ -5382,7 +5382,6 @@
|
||||
"node_modules/localforage": {
|
||||
"version": "1.9.0",
|
||||
"integrity": "sha512-rR1oyNrKulpe+VM9cYmcFn6tsHuokyVHFaCM3+osEmxaHTbEk8oQu6eGDfS6DQLWi/N67XRmB8ECG37OES368g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"lie": "3.1.1"
|
||||
}
|
||||
@ -5390,7 +5389,6 @@
|
||||
"node_modules/localforage/node_modules/lie": {
|
||||
"version": "3.1.1",
|
||||
"integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"immediate": "~3.0.5"
|
||||
}
|
||||
@ -5970,8 +5968,7 @@
|
||||
},
|
||||
"node_modules/mousetrap": {
|
||||
"version": "1.6.5",
|
||||
"integrity": "sha512-QNo4kEepaIBwiT8CDhP98umTetp+JNfQYBWvC1pc6/OAibuXtRcxZ58Qz8skvEHYvURne/7R8T5VoOI7rDsEUA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-QNo4kEepaIBwiT8CDhP98umTetp+JNfQYBWvC1pc6/OAibuXtRcxZ58Qz8skvEHYvURne/7R8T5VoOI7rDsEUA=="
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
@ -6006,8 +6003,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nightwatch": {
|
||||
"version": "1.7.3",
|
||||
"integrity": "sha512-8haEi+FhJfjB3bfhsmNhGrllhFsLz+Ax+xxLbJ1vvyKPH27XgQQQ3UbYXAq2kvj+TiyfT4nHeHLKEwRvVeY3kA==",
|
||||
"version": "1.7.8",
|
||||
"resolved": "https://registry.npmjs.org/nightwatch/-/nightwatch-1.7.8.tgz",
|
||||
"integrity": "sha512-GTY2VoPU2EuoBUB+mz5tAjeEWRQmuT54Il2lOUTmpv87D7cO8fXaadrxSHwl2YDX9rDFvNZovqwiKBtk3/5R6w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"assertion-error": "^1.1.0",
|
||||
@ -7927,8 +7925,7 @@
|
||||
},
|
||||
"node_modules/split.js": {
|
||||
"version": "1.6.4",
|
||||
"integrity": "sha512-kYmQZprRJrF1IOjg/E+gdBEsKFv5kbgUE6RJVJZvrIzTOK/IHzKSqIeiJnWs7IP5D9TnpTQ2CbanuDuIWcyDUQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-kYmQZprRJrF1IOjg/E+gdBEsKFv5kbgUE6RJVJZvrIzTOK/IHzKSqIeiJnWs7IP5D9TnpTQ2CbanuDuIWcyDUQ=="
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
@ -10669,8 +10666,9 @@
|
||||
}
|
||||
},
|
||||
"chromedriver": {
|
||||
"version": "90.0.1",
|
||||
"integrity": "sha512-jvyhin0I/Bacxfet7eg29B1j+5mKR35XwWGbgcCOUALeE3mqcCKJY8xUW9cVrqVqTK9/iUOq8/kar7qrTVshPA==",
|
||||
"version": "92.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chromedriver/-/chromedriver-92.0.0.tgz",
|
||||
"integrity": "sha512-IdJ5n5jLL6tCsGQF/fQHF2gDEhVzoYIqktUn6hE/BSsXlCcyDTi45fQbhTEhZlmshM8+BpnRtPuIT5DRbxNqKg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@testim/chrome-version": "^1.0.7",
|
||||
@ -12637,8 +12635,7 @@
|
||||
},
|
||||
"immediate": {
|
||||
"version": "3.0.6",
|
||||
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=",
|
||||
"dev": true
|
||||
"integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps="
|
||||
},
|
||||
"import-lazy": {
|
||||
"version": "2.1.0",
|
||||
@ -13254,7 +13251,6 @@
|
||||
"localforage": {
|
||||
"version": "1.9.0",
|
||||
"integrity": "sha512-rR1oyNrKulpe+VM9cYmcFn6tsHuokyVHFaCM3+osEmxaHTbEk8oQu6eGDfS6DQLWi/N67XRmB8ECG37OES368g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lie": "3.1.1"
|
||||
},
|
||||
@ -13262,7 +13258,6 @@
|
||||
"lie": {
|
||||
"version": "3.1.1",
|
||||
"integrity": "sha1-mkNrLMd0bKWd56QfpGmz77dr2H4=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"immediate": "~3.0.5"
|
||||
}
|
||||
@ -13734,8 +13729,7 @@
|
||||
},
|
||||
"mousetrap": {
|
||||
"version": "1.6.5",
|
||||
"integrity": "sha512-QNo4kEepaIBwiT8CDhP98umTetp+JNfQYBWvC1pc6/OAibuXtRcxZ58Qz8skvEHYvURne/7R8T5VoOI7rDsEUA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-QNo4kEepaIBwiT8CDhP98umTetp+JNfQYBWvC1pc6/OAibuXtRcxZ58Qz8skvEHYvURne/7R8T5VoOI7rDsEUA=="
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
@ -13767,8 +13761,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"nightwatch": {
|
||||
"version": "1.7.3",
|
||||
"integrity": "sha512-8haEi+FhJfjB3bfhsmNhGrllhFsLz+Ax+xxLbJ1vvyKPH27XgQQQ3UbYXAq2kvj+TiyfT4nHeHLKEwRvVeY3kA==",
|
||||
"version": "1.7.8",
|
||||
"resolved": "https://registry.npmjs.org/nightwatch/-/nightwatch-1.7.8.tgz",
|
||||
"integrity": "sha512-GTY2VoPU2EuoBUB+mz5tAjeEWRQmuT54Il2lOUTmpv87D7cO8fXaadrxSHwl2YDX9rDFvNZovqwiKBtk3/5R6w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"assertion-error": "^1.1.0",
|
||||
@ -15232,8 +15227,7 @@
|
||||
},
|
||||
"split.js": {
|
||||
"version": "1.6.4",
|
||||
"integrity": "sha512-kYmQZprRJrF1IOjg/E+gdBEsKFv5kbgUE6RJVJZvrIzTOK/IHzKSqIeiJnWs7IP5D9TnpTQ2CbanuDuIWcyDUQ==",
|
||||
"dev": true
|
||||
"integrity": "sha512-kYmQZprRJrF1IOjg/E+gdBEsKFv5kbgUE6RJVJZvrIzTOK/IHzKSqIeiJnWs7IP5D9TnpTQ2CbanuDuIWcyDUQ=="
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
|
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "8bitworkshop",
|
||||
"version": "3.8.1",
|
||||
"version": "3.9.0",
|
||||
"author": "Steven Hugg",
|
||||
"category": "Development",
|
||||
"description": "Desktop version of 8bitworkshop.com retro programming IDE",
|
||||
@ -16,8 +16,11 @@
|
||||
"@wasmer/wasmfs": "^0.12.0",
|
||||
"binaryen": "^101.0.0",
|
||||
"chokidar": "^3.5.0",
|
||||
"jquery": "^3.5.1",
|
||||
"jquery": "^3.6.0",
|
||||
"localforage": "^1.9.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"split.js": "^1.6.2",
|
||||
"update-electron-app": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -30,7 +33,7 @@
|
||||
"bootstrap": "^3.4.1",
|
||||
"bootstrap-tourist": "^0.2.1",
|
||||
"btoa": "^1.2.x",
|
||||
"chromedriver": "^90.0.1",
|
||||
"chromedriver": "^92.0.0",
|
||||
"clipboard": "^2.0.6",
|
||||
"command-exists": "^1.2.9",
|
||||
"electron": "^9.4.0",
|
||||
@ -42,16 +45,13 @@
|
||||
"jsdom": "^12.2.0",
|
||||
"jsfuzz": "^1.0.14",
|
||||
"jszip": "^3.5.0",
|
||||
"localforage": "^1.9.0",
|
||||
"lzg": "^1.0.x",
|
||||
"mocha": "^7.2.0",
|
||||
"mocha-simple-html-reporter": "^2.0.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"nightwatch": "^1.6.4",
|
||||
"octokat": "^0.10.0",
|
||||
"pngjs": "^3.4.0",
|
||||
"rgbquant": "^1.1.2",
|
||||
"split.js": "^1.6.2",
|
||||
"typedoc": "^0.21.0",
|
||||
"typescript": "^4.3.4",
|
||||
"typescript-formatter": "^7.2.2",
|
||||
@ -60,8 +60,10 @@
|
||||
"scripts": {
|
||||
"build": "tsc --build tsconfig.json",
|
||||
"test": "npm run test-node",
|
||||
"esbuild": "esbuild src/worker/workermain.ts --bundle --minify --sourcemap --target=es2020,chrome58,firefox57,safari11 --outfile=./gen/worker/bundle.js --external:binaryen",
|
||||
"eswatch": "npm run esbuild -- --watch",
|
||||
"esbuild": "npm run esbuild-worker && npm run esbuild-ui",
|
||||
"esbuild-clean": "rm -f ./gen/*.*",
|
||||
"esbuild-worker": "esbuild src/worker/workermain.ts --bundle --minify --sourcemap --target=es2020,chrome58,firefox57,safari11 --outfile=./gen/worker/bundle.js",
|
||||
"esbuild-ui": "esbuild src/ide/ui.ts src/ide/embedui.ts --splitting --format=esm --bundle --minify --sourcemap --target=es2020 --outdir=./gen/ --external:path --external:fs",
|
||||
"test-one": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000",
|
||||
"test-node": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 test/cli",
|
||||
"test-profile": "NODE_PATH=$(pwd) mocha --recursive --timeout 60000 --prof test/cli",
|
||||
|
@ -138,6 +138,7 @@ export interface Platform {
|
||||
|
||||
readFile?(path: string) : FileData;
|
||||
writeFile?(path: string, data: FileData) : boolean;
|
||||
sourceFileFetch?: (path:string) => FileData;
|
||||
|
||||
getDownloadFile?() : {extension:string, blob:Blob};
|
||||
}
|
||||
@ -1556,7 +1557,7 @@ export abstract class BaseWASMMachine {
|
||||
}
|
||||
}
|
||||
|
||||
import { loadScript } from "../ide/ui";
|
||||
import { loadScript } from "../common/util";
|
||||
import { WasmFs } from "@wasmer/wasmfs";
|
||||
|
||||
let stub = function() { console.log(arguments); return 0 }
|
||||
|
@ -194,7 +194,7 @@ export class BASICRuntime {
|
||||
getBuiltinFunctions() {
|
||||
var fnames = this.program && this.opts.validFunctions;
|
||||
// if no valid function list, look for ABC...() functions in prototype
|
||||
if (!fnames) fnames = Object.keys(BASICRuntime.prototype).filter((name) => /^[A-Z]{3,}[$]?$/.test(name));
|
||||
if (!fnames) fnames = Object.getOwnPropertyNames(BASICRuntime.prototype).filter((name) => /^[A-Z]{3,}[$]?$/.test(name));
|
||||
var dict = {};
|
||||
for (var fn of fnames) if (this.supportsFunction(fn)) dict[fn] = this[fn].bind(this);
|
||||
return dict;
|
||||
|
@ -263,6 +263,7 @@ export var OPS_6502 = [
|
||||
export function disassemble6502(pc:number, b0:number, b1:number, b2:number) : {line:string, nbytes:number, isaddr:boolean} {
|
||||
|
||||
var op = OPS_6502[b0];
|
||||
if (op == null) return {line:"???", nbytes:1, isaddr:false};
|
||||
var s = op.mn;
|
||||
var am = op.am;
|
||||
var isaddr = false;
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
import { hex, clamp, lpad } from "./util";
|
||||
import { SourceLocation } from "./workertypes";
|
||||
import Mousetrap = require('mousetrap');
|
||||
import { VirtualList } from "./vlist"
|
||||
|
||||
// external modules
|
||||
declare var jt, Javatari;
|
||||
declare var Mousetrap;
|
||||
|
||||
// Emulator classes
|
||||
|
||||
@ -721,8 +722,6 @@ export function getVisibleEditorLineHeight() : number{
|
||||
return $("#booksMenuButton").first().height();
|
||||
}
|
||||
|
||||
declare var VirtualList;
|
||||
|
||||
export interface VirtualTextLine {
|
||||
text : string;
|
||||
clas? : string;
|
||||
@ -780,3 +779,4 @@ export class VirtualTextScroller {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
import binaryen = require('binaryen');
|
||||
import * as binaryen from 'binaryen';
|
||||
//import binaryen = require("binaryen");
|
||||
import { hasDataType, HDLBinop, HDLBlock, HDLConstant, HDLDataType, HDLDataTypeObject, HDLExpr, HDLExtendop, HDLFuncCall, HDLModuleDef, HDLModuleRunner, HDLSourceLocation, HDLSourceObject, HDLTriop, HDLUnop, HDLValue, HDLVariableDef, HDLVarRef, HDLWhileOp, isArrayItem, isArrayType, isBigConstExpr, isBinop, isBlock, isConstExpr, isFuncCall, isLogicType, isTriop, isUnop, isVarDecl, isVarRef, isWhileop } from "./hdltypes";
|
||||
import { HDLError } from "./hdlruntime";
|
||||
|
||||
|
@ -506,3 +506,13 @@ export function byteToASCII(b: number) : string {
|
||||
return String.fromCharCode(b);
|
||||
}
|
||||
|
||||
export function loadScript(scriptfn:string) : Promise<Event> {
|
||||
return new Promise( (resolve, reject) => {
|
||||
var script = document.createElement('script');
|
||||
script.onload = resolve;
|
||||
script.onerror = reject;
|
||||
script.src = scriptfn;
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* @param {object} config
|
||||
* @constructor
|
||||
*/
|
||||
function VirtualList(config) {
|
||||
export function VirtualList(config) {
|
||||
var width = (config && config.w + 'px') || '100%';
|
||||
var height = (config && config.h + 'px') || '100%';
|
||||
var itemHeight = this.itemHeight = config.itemHeight;
|
@ -3,8 +3,9 @@ window['Javatari'].AUTO_START = false;
|
||||
|
||||
import { PLATFORMS } from "../common/emu";
|
||||
import { Platform } from "../common/baseplatform";
|
||||
import { stringToByteArray, getWithBinary } from "../common/util";
|
||||
import { stringToByteArray, getWithBinary, loadScript, getRootBasePlatform } from "../common/util";
|
||||
import { StateRecorderImpl } from "../common/recorder";
|
||||
import { importPlatform } from "../platform/_index";
|
||||
|
||||
export var platform_id : string; // platform ID string
|
||||
export var platform : Platform; // platform object
|
||||
@ -168,20 +169,7 @@ async function loadPlatform(qs) {
|
||||
if (qs.data) qs = qs.data;
|
||||
platform_id = qs['p'];
|
||||
if (!platform_id) throw('No platform variable!');
|
||||
var platformfn = 'gen/platform/' + platform_id.split(/[.-]/)[0] + '.js'; // required file
|
||||
var machinefn = platformfn.replace('/platform/', '/machine/'); // optional file
|
||||
try {
|
||||
await loadScript(platformfn); // load platform file
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
throw('Platform "' + platform_id + '" not supported.');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await loadScript(machinefn); // load machine file
|
||||
} catch (e) {
|
||||
console.log('skipped',machinefn); // optional file skipped
|
||||
}
|
||||
var module = await importPlatform(getRootBasePlatform(platform_id));
|
||||
try {
|
||||
console.log("starting platform", platform_id); // loaded required <platform_id>.js file
|
||||
await startPlatform(qs);
|
||||
@ -191,16 +179,6 @@ async function loadPlatform(qs) {
|
||||
}
|
||||
}
|
||||
|
||||
export function loadScript(scriptfn:string) : Promise<Event> {
|
||||
return new Promise( (resolve, reject) => {
|
||||
var script = document.createElement('script');
|
||||
script.onload = resolve;
|
||||
script.onerror = reject;
|
||||
script.src = scriptfn;
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
});
|
||||
}
|
||||
|
||||
// start
|
||||
export function startEmbed() {
|
||||
installErrorHandler();
|
||||
@ -252,3 +230,11 @@ function receiveMessage(event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
// are we not in an iframe?
|
||||
if(self === top) {
|
||||
document.body.style.backgroundColor = '#555';
|
||||
}
|
||||
startEmbed();
|
||||
|
@ -3,7 +3,7 @@
|
||||
import { hex, rgb2bgr, rle_unpack } from "../common/util";
|
||||
import { ProjectWindows } from "./windows";
|
||||
import { Toolbar } from "../common/emu";
|
||||
declare var Mousetrap;
|
||||
import Mousetrap = require('mousetrap');
|
||||
|
||||
export type UintArray = number[] | Uint8Array | Uint16Array | Uint32Array; //{[i:number]:number};
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
// TODO: don't need this file anymore?
|
||||
|
||||
declare var localforage;
|
||||
|
||||
export function createNewPersistentStore(storeid:string, callback?) {
|
||||
var store = localforage.createInstance({
|
||||
name: "__" + storeid,
|
||||
version: 2.0
|
||||
});
|
||||
if (callback != null) { callback(store); } // for tests only
|
||||
return store;
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
|
||||
// 8bitworkshop IDE user interface
|
||||
|
||||
import $ = require("jquery");
|
||||
import * as bootstrap from "bootstrap";
|
||||
import * as localforage from "localforage";
|
||||
import { CodeProject, LocalForageFilesystem, OverlayFilesystem, ProjectFilesystem, WebPresetsFileSystem } from "./project";
|
||||
import { WorkerResult, WorkerOutput, VerilogOutput, SourceFile, WorkerError, FileData } from "../common/workertypes";
|
||||
@ -11,15 +9,18 @@ import { Platform, Preset, DebugSymbols, DebugEvalCondition, isDebuggable, EmuSt
|
||||
import { PLATFORMS, EmuHalt, Toolbar } from "../common/emu";
|
||||
import * as Views from "./views";
|
||||
import { getFilenameForPath, getFilenamePrefix, highlightDifferences, invertMap, byteArrayToString, compressLZG, stringToByteArray,
|
||||
byteArrayToUTF8, isProbablyBinary, getWithBinary, getBasePlatform, getRootBasePlatform, hex } from "../common/util";
|
||||
byteArrayToUTF8, isProbablyBinary, getWithBinary, getBasePlatform, getRootBasePlatform, hex, loadScript } from "../common/util";
|
||||
import { StateRecorderImpl } from "../common/recorder";
|
||||
import { GHSession, GithubService, getRepos, parseGithubURL, FirebaseProjectFilesystem } from "./services";
|
||||
import Split = require('split.js');
|
||||
import { importPlatform } from "../platform/_index";
|
||||
|
||||
// external libs (TODO)
|
||||
declare var Tour, GIF, saveAs, JSZip, Mousetrap, Split, firebase;
|
||||
declare var Tour, GIF, saveAs, JSZip, firebase;
|
||||
declare var ga;
|
||||
// in index.html
|
||||
declare var exports;
|
||||
declare var $ : JQueryStatic; // use browser jquery
|
||||
|
||||
// make sure VCS doesn't start
|
||||
if (window['Javatari']) window['Javatari'].AUTO_START = false;
|
||||
@ -121,16 +122,6 @@ function alertInfo(s:string) {
|
||||
bootbox.alert(s);
|
||||
}
|
||||
|
||||
export function loadScript(scriptfn:string) : Promise<Event> {
|
||||
return new Promise( (resolve, reject) => {
|
||||
var script = document.createElement('script');
|
||||
script.onload = resolve;
|
||||
script.onerror = reject;
|
||||
script.src = scriptfn;
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
});
|
||||
}
|
||||
|
||||
function newWorker() : Worker {
|
||||
return new Worker("./gen/worker/bundle.js");
|
||||
}
|
||||
@ -542,9 +533,6 @@ async function getLocalFilesystem(repoid: string) : Promise<ProjectFilesystem> {
|
||||
bootbox.alert(`Could not get permission to access filesystem.`);
|
||||
return;
|
||||
}
|
||||
for await (const entry of dirHandle.values()) {
|
||||
console.log(entry.kind, entry.name);
|
||||
}
|
||||
return {
|
||||
getFileData: async (path) => {
|
||||
console.log('getFileData', path);
|
||||
@ -2190,6 +2178,7 @@ async function startPlatform() {
|
||||
await loadBIOSFromProject();
|
||||
await initProject();
|
||||
await loadProject(qs['file']);
|
||||
platform.sourceFileFetch = (path) => current_project.filedata[path];
|
||||
setupDebugControls();
|
||||
addPageFocusHandlers();
|
||||
showInstructions();
|
||||
@ -2366,20 +2355,7 @@ export async function startUI() {
|
||||
}
|
||||
|
||||
async function loadAndStartPlatform() {
|
||||
var platformfn = 'gen/platform/' + platform_id.split(/[.-]/)[0] + '.js'; // required file
|
||||
var machinefn = platformfn.replace('/platform/', '/machine/'); // optional file
|
||||
try {
|
||||
await loadScript(platformfn); // load platform file
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
alertError('Platform "' + platform_id + '" not supported.');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await loadScript(machinefn); // load machine file
|
||||
} catch (e) {
|
||||
console.log('skipped',machinefn); // optional file skipped
|
||||
}
|
||||
var module = await importPlatform(getRootBasePlatform(platform_id));
|
||||
try {
|
||||
console.log("starting platform", platform_id); // loaded required <platform_id>.js file
|
||||
try {
|
||||
@ -2487,3 +2463,8 @@ export function highlightSearch(query: string) { // TODO: filename?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// start UI if in browser (not node)
|
||||
if (typeof process === 'undefined') {
|
||||
startUI();
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ import { platform, platform_id, compparams, current_project, lastDebugState, pro
|
||||
import { ProbeRecorder, ProbeFlags } from "../common/recorder";
|
||||
import { getMousePos, dumpRAM, getVisibleEditorLineHeight, VirtualTextScroller, VirtualTextLine } from "../common/emu";
|
||||
import * as pixed from "./pixeleditor";
|
||||
|
||||
declare var Mousetrap;
|
||||
import Mousetrap = require('mousetrap');
|
||||
import { VirtualList } from "../common/vlist";
|
||||
|
||||
export interface ProjectView {
|
||||
createDiv(parent:HTMLElement) : HTMLElement;
|
||||
@ -34,7 +34,6 @@ export interface ProjectView {
|
||||
export var isMobileDevice = window.matchMedia && window.matchMedia("only screen and (max-width: 760px)").matches;
|
||||
|
||||
declare var CodeMirror;
|
||||
declare var VirtualList;
|
||||
|
||||
// helper function for editor
|
||||
function jumpToLine(ed, i:number) {
|
||||
@ -2116,9 +2115,9 @@ export class AssetEditorView implements ProjectView, pixed.EditorContext {
|
||||
setVisible?(showing : boolean) : void {
|
||||
// TODO: make into toolbar?
|
||||
if (showing) {
|
||||
Mousetrap.bind('ctrl+z', projectWindows.undoStep.bind(projectWindows));
|
||||
if (Mousetrap.bind) Mousetrap.bind('ctrl+z', projectWindows.undoStep.bind(projectWindows));
|
||||
} else {
|
||||
Mousetrap.unbind('ctrl+z');
|
||||
if (Mousetrap.unbind) Mousetrap.unbind('ctrl+z');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
import { Toolbar } from "../common/emu";
|
||||
|
||||
declare var VirtualList;
|
||||
import { VirtualList } from "../common/vlist";
|
||||
|
||||
const BUILTIN_INPUT_PORTS = [
|
||||
'clk', 'reset',
|
||||
|
36
src/platform/_index.ts
Normal file
36
src/platform/_index.ts
Normal file
@ -0,0 +1,36 @@
|
||||
// hard-code platform files for esbuild code-splitting
|
||||
|
||||
export function importPlatform(name: string) : Promise<any> {
|
||||
switch (name) {
|
||||
case "apple2": return import("../platform/apple2");
|
||||
case "arm32": return import("../platform/arm32");
|
||||
case "astrocade": return import("../platform/astrocade");
|
||||
case "atari7800": return import("../platform/atari7800");
|
||||
case "atari8": return import("../platform/atari8");
|
||||
case "basic": return import("../platform/basic");
|
||||
case "c64": return import("../platform/c64");
|
||||
case "coleco": return import("../platform/coleco");
|
||||
case "devel": return import("../platform/devel");
|
||||
case "galaxian": return import("../platform/galaxian");
|
||||
case "kim1": return import("../platform/kim1");
|
||||
case "markdown": return import("../platform/markdown");
|
||||
case "msx": return import("../platform/msx");
|
||||
case "mw8080bw": return import("../platform/mw8080bw");
|
||||
case "nes": return import("../platform/nes");
|
||||
case "sms": return import("../platform/sms");
|
||||
case "sound_konami": return import("../platform/sound_konami");
|
||||
case "sound_williams": return import("../platform/sound_williams");
|
||||
case "vcs": return import("../platform/vcs");
|
||||
case "vector": return import("../platform/vector");
|
||||
case "vectrex": return import("../platform/vectrex");
|
||||
case "verilog": return import("../platform/verilog");
|
||||
case "vicdual": return import("../platform/vicdual");
|
||||
case "williams": return import("../platform/williams");
|
||||
case "x86": return import("../platform/x86");
|
||||
case "zmachine": return import("../platform/zmachine");
|
||||
case "zx": return import("../platform/zx");
|
||||
default: throw new Error(`Platform not recognized: '${name}'`)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
|
||||
import { BaseDebugPlatform, CpuState, EmuState, Platform, DisasmLine, Debuggable, Machine, BaseMachinePlatform } from "../common/baseplatform";
|
||||
import { AnimationTimer, EmuHalt, padBytes, PLATFORMS, RasterVideo } from "../common/emu";
|
||||
import { loadScript } from "../ide/ui";
|
||||
import { hex, lpad } from "../common/util";
|
||||
import { hex, lpad, loadScript } from "../common/util";
|
||||
import { ARM32CPU } from "../common/cpu/ARM";
|
||||
import { ARM32Machine } from "../machine/arm32";
|
||||
|
||||
@ -25,203 +24,6 @@ interface ARM32State extends EmuState {
|
||||
r: Uint32Array; // registers
|
||||
}
|
||||
|
||||
class ARM32UnicornPlatform extends BaseDebugPlatform implements Platform, Debuggable {
|
||||
|
||||
u : any; // Unicorn
|
||||
d : any; // Capstone
|
||||
mainElement : HTMLElement;
|
||||
video : RasterVideo;
|
||||
timer : AnimationTimer;
|
||||
romSize = 0;
|
||||
halted = false;
|
||||
state : ARM32State;
|
||||
cpu : ARM32CPU;
|
||||
|
||||
constructor(mainElement: HTMLElement) {
|
||||
super();
|
||||
this.mainElement = mainElement;
|
||||
}
|
||||
getPresets() { return ARM32_PRESETS };
|
||||
|
||||
async start() {
|
||||
console.log("Loading Unicorn/Capstone");
|
||||
await loadScript('./lib/unicorn-arm.min.js');
|
||||
await loadScript('./lib/capstone-arm.min.js');
|
||||
|
||||
this.cpu = new ARM32CPU();
|
||||
|
||||
this.u = new uc.Unicorn(uc.ARCH_ARM, uc.MODE_ARM);
|
||||
this.u.mem_map(ROM_START_ADDR, ROM_SIZE, uc.PROT_READ | uc.PROT_EXEC);
|
||||
this.u.mem_map(HIROM_START_ADDR, ROM_SIZE, uc.PROT_READ | uc.PROT_EXEC);
|
||||
this.u.mem_map(RAM_START_ADDR, RAM_SIZE, uc.PROT_READ | uc.PROT_WRITE | uc.PROT_EXEC);
|
||||
|
||||
this.d = new cs.Capstone(cs.ARCH_ARM, cs.MODE_ARM);
|
||||
|
||||
this.video = new RasterVideo(this.mainElement, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
this.video.create();
|
||||
|
||||
this.timer = new AnimationTimer(60, this.nextFrame.bind(this));
|
||||
}
|
||||
reset() {
|
||||
this.cpu.reset();
|
||||
this.u.reg_write_i32(uc.ARM_REG_PC, 0);
|
||||
var cpsr = this.u.reg_read_i32(uc.ARM_REG_CPSR);
|
||||
this.u.reg_write_i32(uc.ARM_REG_CPSR, (cpsr & 0xffffff00) | 0b11010011);
|
||||
this.u.mem_write(RAM_START_ADDR, new Uint8Array(RAM_SIZE)); // clear RAM
|
||||
this.halted = false;
|
||||
this.state = null;
|
||||
}
|
||||
pause(): void {
|
||||
this.timer.stop();
|
||||
}
|
||||
resume(): void {
|
||||
this.timer.start();
|
||||
console.log('resume')
|
||||
}
|
||||
isRunning() {
|
||||
return this.timer.isRunning();
|
||||
}
|
||||
isBlocked() {
|
||||
return this.halted;
|
||||
}
|
||||
checkPCOverflow(pc) {
|
||||
|
||||
}
|
||||
disassemble(pc:number, read:(addr:number)=>number) : DisasmLine {
|
||||
try {
|
||||
var b = this.u.mem_read(pc, 4);
|
||||
var insns = this.d.disasm(b, pc, 4);
|
||||
var i0 = insns[0];
|
||||
return {
|
||||
nbytes: i0.size,
|
||||
line: i0.mnemonic + " " + i0.op_str,
|
||||
isaddr: i0.address > 0
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
nbytes: 4,
|
||||
line: "???",
|
||||
isaddr: false
|
||||
};
|
||||
}
|
||||
}
|
||||
advance(novideo?: boolean): number {
|
||||
this.state = null;
|
||||
var pc = this.getPC();
|
||||
var endpc = this.romSize;
|
||||
if (pc >= endpc) {
|
||||
this.halted = true;
|
||||
this.haltAndCatchFire("ROM overrun at PC 0x" + hex(pc));
|
||||
this.pause();
|
||||
return 1;
|
||||
}
|
||||
var debugCond = this.getDebugCallback();
|
||||
try {
|
||||
if (debugCond != null) {
|
||||
for (var i=0; i<CLOCKS_PER_FRAME && pc <= endpc; i++) {
|
||||
if (debugCond()) {
|
||||
break;
|
||||
}
|
||||
this.u.emu_start(pc, endpc, 0, 1);
|
||||
pc = this.getPC();
|
||||
}
|
||||
} else {
|
||||
this.u.emu_start(pc, endpc, 0, CLOCKS_PER_FRAME); // TODO
|
||||
}
|
||||
} catch (e) {
|
||||
throw new EmuHalt(e + " at PC=0x" + hex(this.getPC()));
|
||||
}
|
||||
if (!novideo) {
|
||||
this.updateVideo();
|
||||
}
|
||||
return CLOCKS_PER_FRAME; //throw new Error("Method not implemented.");
|
||||
}
|
||||
updateVideo() {
|
||||
var vmem8 : Uint8Array = this.u.mem_read(RAM_START_ADDR, SCREEN_WIDTH * SCREEN_HEIGHT * 4);
|
||||
var vmem32 = new Uint32Array(vmem8.buffer);
|
||||
var pixels = this.video.getFrameData();
|
||||
for (var i=0; i<vmem32.length; i++)
|
||||
pixels[i] = vmem32[i] | 0xff000000;
|
||||
this.video.updateFrame();
|
||||
}
|
||||
getToolForFilename() {
|
||||
return "vasmarm";
|
||||
}
|
||||
getDefaultExtension() {
|
||||
return ".asm";
|
||||
}
|
||||
loadROM(title, data: Uint8Array) {
|
||||
this.romSize = data.length;
|
||||
data = padBytes(data, ROM_SIZE);
|
||||
this.u.mem_write(ROM_START_ADDR, data);
|
||||
this.u.mem_write(HIROM_START_ADDR, data);
|
||||
this.state = null;
|
||||
this.reset();
|
||||
}
|
||||
readAddress(addr: number) {
|
||||
// TODO: slow
|
||||
try {
|
||||
return this.u.mem_read(addr, 1)[0];
|
||||
} catch (e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
getCPUState(): CpuState {
|
||||
return {
|
||||
PC: this.getPC(),
|
||||
SP: this.getSP(),
|
||||
};
|
||||
}
|
||||
isStable(): boolean {
|
||||
return true;
|
||||
}
|
||||
getPC() {
|
||||
return this.u.reg_read_i32(uc.ARM_REG_PC);
|
||||
}
|
||||
getSP() {
|
||||
return this.u.reg_read_i32(uc.ARM_REG_SP);
|
||||
}
|
||||
loadState(state: ARM32State): void {
|
||||
for (var i=0; i<uc.ARM_REG_ENDING; i++) {
|
||||
this.u.reg_write_i32(i, state.r[i]);
|
||||
}
|
||||
this.u.mem_write(RAM_START_ADDR, state.b);
|
||||
}
|
||||
saveState(): ARM32State {
|
||||
var regs = new Uint32Array(uc.ARM_REG_ENDING);
|
||||
for (var i=0; i<uc.ARM_REG_ENDING; i++) {
|
||||
regs[i] = this.u.reg_read_i32(i);
|
||||
}
|
||||
this.state = {
|
||||
c: this.getCPUState(),
|
||||
b: this.u.mem_read(RAM_START_ADDR, RAM_SIZE),
|
||||
r: regs
|
||||
};
|
||||
return this.state;
|
||||
}
|
||||
showHelp(tool: string) {
|
||||
if (tool == 'vasmarm') {
|
||||
window.open('http://sun.hasenbraten.de/vasm/release/vasm.html');
|
||||
}
|
||||
}
|
||||
getDebugCategories() {
|
||||
return ["CPU"];
|
||||
}
|
||||
getDebugInfo?(category:string, state:ARM32State) : string {
|
||||
var s = '';
|
||||
for (var i=0; i<13; i++) {
|
||||
s += lpad('r'+i, 3) + ' ' + hex(state.r[i+uc.ARM_REG_R0],8) + '\n';
|
||||
}
|
||||
s += ' SP ' + hex(state.r[uc.ARM_REG_SP],8) + '\n';
|
||||
s += ' LR ' + hex(state.r[uc.ARM_REG_LR],8) + '\n';
|
||||
s += ' PC ' + hex(state.r[uc.ARM_REG_PC],8) + '\n';
|
||||
s += 'CPSR ' + hex(state.r[uc.ARM_REG_CPSR],8) + '\n';
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
export abstract class BaseARMMachinePlatform<T extends Machine> extends BaseMachinePlatform<T> {
|
||||
|
||||
//getOpcodeMetadata = getOpcodeMetadata_z80;
|
||||
@ -282,5 +84,4 @@ class ARM32Platform extends BaseARMMachinePlatform<ARM32Machine> implements Plat
|
||||
|
||||
////
|
||||
|
||||
PLATFORMS['arm32.u'] = ARM32UnicornPlatform;
|
||||
PLATFORMS['arm32'] = ARM32Platform;
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
import { Platform, BreakpointCallback, DebugCondition, DebugEvalCondition } from "../common/baseplatform";
|
||||
import { PLATFORMS, AnimationTimer, EmuHalt } from "../common/emu";
|
||||
import { loadScript } from "../ide/ui";
|
||||
import * as views from "../ide/views";
|
||||
import { BASICRuntime } from "../common/basic/runtime";
|
||||
import { BASICProgram } from "../common/basic/compiler";
|
||||
@ -43,8 +42,6 @@ class BASICPlatform implements Platform {
|
||||
}
|
||||
|
||||
async start() {
|
||||
await loadScript('./gen/common/basic/runtime.js');
|
||||
await loadScript('./gen/common/teletype.js');
|
||||
// create runtime
|
||||
this.runtime = new BASICRuntime();
|
||||
this.runtime.reset();
|
||||
|
@ -4,9 +4,9 @@ import { EmuHalt, PLATFORMS } from "../common/emu";
|
||||
import { Devel6502 } from "../machine/devel";
|
||||
import { Base6502MachinePlatform } from "../common/baseplatform";
|
||||
import { SerialIOInterface } from "../common/devices";
|
||||
import { byteArrayToString, convertDataToUint8Array, hex } from "../common/util";
|
||||
import { byteArrayToString, convertDataToUint8Array } from "../common/util";
|
||||
import { TeleType } from "../common/teletype";
|
||||
import { haltEmulation, loadScript } from "../ide/ui";
|
||||
import { haltEmulation } from "../ide/ui";
|
||||
|
||||
var DEVEL_6502_PRESETS = [
|
||||
{id:'hello.dasm', name:'Hello World (ASM)'},
|
||||
@ -126,7 +126,6 @@ class Devel6502Platform extends Base6502MachinePlatform<Devel6502> implements Pl
|
||||
|
||||
async start() {
|
||||
super.start();
|
||||
await loadScript('./gen/common/teletype.js');
|
||||
this.serial = new SerialTestHarness();
|
||||
this.serial.viewer = this.serview;
|
||||
this.serview.start();
|
||||
|
@ -6,9 +6,8 @@ import { CodeAnalyzer_nes } from "../common/analysis";
|
||||
import { SampleAudio } from "../common/audio";
|
||||
import { ProbeRecorder } from "../common/recorder";
|
||||
import { NullProbe, Probeable, ProbeAll } from "../common/devices";
|
||||
|
||||
declare var jsnes : any;
|
||||
declare var Mousetrap;
|
||||
import Mousetrap = require('mousetrap');
|
||||
import jsnes = require('../../jsnes');
|
||||
|
||||
const JSNES_PRESETS = [
|
||||
{id:'hello.c', name:'Hello World'},
|
||||
@ -100,7 +99,7 @@ class JSNESPlatform extends Base6502Platform implements Platform, Probeable {
|
||||
this.ntvideo.create();
|
||||
$(this.ntvideo.canvas).hide();
|
||||
this.ntlastbuf = new Uint32Array(0x1000);
|
||||
Mousetrap.bind('ctrl+shift+alt+n', () => {
|
||||
if (Mousetrap.bind) Mousetrap.bind('ctrl+shift+alt+n', () => {
|
||||
$(this.video.canvas).toggle()
|
||||
$(this.ntvideo.canvas).toggle()
|
||||
});
|
||||
|
@ -464,5 +464,10 @@ class VCSMAMEPlatform extends BaseMAME6502Platform implements Platform {
|
||||
|
||||
////////////////
|
||||
|
||||
export const Platforms = {
|
||||
'vcs': VCSPlatform,
|
||||
'vcs.mame': VCSMAMEPlatform,
|
||||
}
|
||||
|
||||
PLATFORMS['vcs'] = VCSPlatform;
|
||||
PLATFORMS['vcs.mame'] = VCSMAMEPlatform;
|
||||
|
@ -2,14 +2,12 @@
|
||||
import { Platform, BasePlatform } from "../common/baseplatform";
|
||||
import { PLATFORMS, setKeyboardFromMap, AnimationTimer, RasterVideo, Keys, makeKeycodeMap, getMousePos, KeyFlags } from "../common/emu";
|
||||
import { SampleAudio } from "../common/audio";
|
||||
import { safe_extend } from "../common/util";
|
||||
import { WaveformView, WaveformProvider, WaveformMeta } from "../ide/waveform";
|
||||
import { setFrameRateUI, loadScript, current_project } from "../ide/ui";
|
||||
import { HDLModuleRunner, HDLModuleTrace, HDLUnit, isLogicType } from "../common/hdl/hdltypes";
|
||||
import { HDLModuleJS } from "../common/hdl/hdlruntime";
|
||||
import { HDLModuleWASM } from "../common/hdl/hdlwasm";
|
||||
|
||||
declare var Split;
|
||||
import Split = require("split.js");
|
||||
import { FileData } from "../common/workertypes";
|
||||
|
||||
interface WaveformSignal extends WaveformMeta {
|
||||
name: string;
|
||||
@ -169,6 +167,8 @@ var VerilogPlatform = function(mainElement, options) {
|
||||
split;
|
||||
hasvideo : boolean;
|
||||
|
||||
sourceFileFetch : (path:string) => FileData;
|
||||
|
||||
getPresets() { return VERILOG_PRESETS; }
|
||||
|
||||
setVideoParams(width:number, height:number, clock:number) {
|
||||
@ -179,10 +179,7 @@ var VerilogPlatform = function(mainElement, options) {
|
||||
}
|
||||
|
||||
async start() {
|
||||
await loadScript('./gen/common/hdl/hdltypes.js');
|
||||
await loadScript('./gen/common/hdl/hdlruntime.js');
|
||||
await loadScript('./gen/common/hdl/hdlwasm.js');
|
||||
await loadScript('./lib/binaryen.js');
|
||||
//await loadScript('./lib/binaryen.js'); // TODO: remove
|
||||
video = new RasterVideo(mainElement,videoWidth,videoHeight,{overscan:true});
|
||||
video.create();
|
||||
poller = setKeyboardFromMap(video, switches, VERILOG_KEYCODE_MAP, (o,key,code,flags) => {
|
||||
@ -219,22 +216,6 @@ var VerilogPlatform = function(mainElement, options) {
|
||||
});
|
||||
// setup mouse events
|
||||
video.setupMouseEvents();
|
||||
// setup mouse click
|
||||
video.vcanvas.click( (e) => {
|
||||
if (!top) return; // must have created emulator
|
||||
if (!e.ctrlKey) {
|
||||
//setFrameRateUI(60);
|
||||
return; // ctrl key must be down
|
||||
}
|
||||
setFrameRateUI(1.0/2048);
|
||||
var pos = getMousePos(video.canvas, e);
|
||||
var new_y = Math.floor(pos.y);
|
||||
var clock = 0;
|
||||
while (framey != new_y || clock++ > 200000) {
|
||||
this.setGenInputs();
|
||||
this.updateVideoFrameCycles(1, true, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: pollControls() { poller.poll(); }
|
||||
@ -585,7 +566,7 @@ var VerilogPlatform = function(mainElement, options) {
|
||||
var useWASM = true;
|
||||
var topcons = useWASM ? HDLModuleWASM : HDLModuleJS;
|
||||
var _top = new topcons(topmod, unit.modules['@CONST-POOL@']);
|
||||
_top.getFileData = (path) => current_project.filedata[path]; // external file provider
|
||||
_top.getFileData = this.sourceFileFetch;
|
||||
await _top.init();
|
||||
this.dispose();
|
||||
top = _top;
|
||||
@ -617,13 +598,9 @@ var VerilogPlatform = function(mainElement, options) {
|
||||
if (this.hasvideo) {
|
||||
const IGNORE_SIGNALS = ['clk','reset'];
|
||||
trace_signals = trace_signals.filter((v) => { return IGNORE_SIGNALS.indexOf(v.name)<0; }); // remove clk, reset
|
||||
$("#speed_bar").show();
|
||||
$("#run_bar").show();
|
||||
$("#dbg_record").show();
|
||||
this.showVideoControls();
|
||||
} else {
|
||||
$("#speed_bar").hide();
|
||||
$("#run_bar").hide();
|
||||
$("#dbg_record").hide();
|
||||
this.hideVideoControls();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -650,6 +627,18 @@ var VerilogPlatform = function(mainElement, options) {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
showVideoControls() {
|
||||
$("#speed_bar").show();
|
||||
$("#run_bar").show();
|
||||
$("#dbg_record").show();
|
||||
}
|
||||
|
||||
hideVideoControls() {
|
||||
$("#speed_bar").hide();
|
||||
$("#run_bar").hide();
|
||||
$("#dbg_record").hide();
|
||||
}
|
||||
|
||||
restartAudio() {
|
||||
// stop/start audio
|
||||
var hasAudio = top && top.state.spkr != null && frameRate > 1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
import { Platform } from "../common/baseplatform";
|
||||
import { PLATFORMS, RasterVideo } from "../common/emu";
|
||||
import { loadScript } from "../ide/ui";
|
||||
import { loadScript } from "../common/util";
|
||||
|
||||
// PC emulator: https://github.com/copy/v86
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
import { Platform, BasePlatform, BaseDebugPlatform, Preset, EmuState, inspectSymbol } from "../common/baseplatform";
|
||||
import { PLATFORMS, EmuHalt } from "../common/emu";
|
||||
import { loadScript } from "../ide/ui";
|
||||
import { EmuHalt, PLATFORMS } from "../common/emu";
|
||||
import { TeleType, TeleTypeWithKeyboard } from "../common/teletype";
|
||||
import { InputResponse } from "../common/basic/runtime";
|
||||
import { loadScript } from "../common/util";
|
||||
|
||||
const ZMACHINE_PRESETS = [
|
||||
{ id: 'hello.inf', name: 'Hello World' },
|
||||
@ -627,8 +627,6 @@ class ZmachinePlatform implements Platform {
|
||||
|
||||
async start() {
|
||||
await loadScript('./lib/zvm/ifvms.min.js');
|
||||
await loadScript('./gen/common/teletype.js');
|
||||
|
||||
// create divs
|
||||
var parent = this.mainElement;
|
||||
var gameport = $('<div id="gameport"/>').appendTo(parent);
|
||||
|
@ -2725,6 +2725,7 @@ function compileInform6(step:BuildStep) {
|
||||
lstout += "\n";
|
||||
}
|
||||
}
|
||||
// TODO: step.path must end in '.inf' or error
|
||||
var args = [ '-afjnops', '-v5', '-Cu', '-E1', '-k', '+/share/lib', step.path ];
|
||||
var inform : EmscriptenModule = emglobal.inform({
|
||||
instantiateWasm: moduleInstFn('inform'),
|
||||
|
@ -15,6 +15,7 @@ global.location = {href:'.'};
|
||||
global.path = require('path');
|
||||
global.btoa = require('btoa');
|
||||
global.atob = require('atob');
|
||||
global.navigator = global; // for mousetrap :P
|
||||
|
||||
global.includeInThisContext = function(path) {
|
||||
var code = fs.readFileSync(path);
|
||||
|
@ -9,12 +9,16 @@ function testCompile(browser, platform_id, platform_name) {
|
||||
.waitForElementVisible('#booksMenuButton')
|
||||
.waitForElementVisible('#preset_select')
|
||||
.assert.containsText('#platformsMenuButton', platform_name)
|
||||
.waitForElementNotVisible('#compile_spinner')
|
||||
.waitForElementNotVisible('#compile_spinner', time=10000)
|
||||
.waitForElementNotVisible('#error_alert')
|
||||
.waitForElementNotPresent('.bootbox-alert');
|
||||
|
||||
if (platform_id == 'vcs') {
|
||||
browser.waitForElementVisible('#javatari-screen');
|
||||
} else if (platform_id == 'verilog') {
|
||||
browser.waitForElementVisible('#emuoverlay');
|
||||
} else if (platform_id == 'basic' || platform_id == 'zmachine') {
|
||||
browser.waitForElementVisible('.transcript-line');
|
||||
} else {
|
||||
browser.waitForElementVisible('#emuscreen');
|
||||
browser.waitForElementVisible('.emuvideo');
|
||||
@ -22,7 +26,10 @@ function testCompile(browser, platform_id, platform_name) {
|
||||
}
|
||||
}
|
||||
|
||||
function testDebugging(browser) {
|
||||
function testDebugging(browser, platform_id) {
|
||||
if (platform_id == 'verilog') return;
|
||||
if (platform_id == 'basic') return;
|
||||
if (platform_id == 'zmachine') return;
|
||||
// do some debugging
|
||||
browser
|
||||
.waitForElementVisible('#dbg_go.btn_active')
|
||||
@ -52,40 +59,54 @@ function testTourDialog(browser) {
|
||||
.click('button[data-role="end"]');
|
||||
}
|
||||
|
||||
function testPlatform(exports, platform_id, platform_name, numPresets) {
|
||||
exports['load_'+platform_id] = function(browser) {
|
||||
browser.url(IDEURL + '?platform='+platform_id+"&file=NOEXIST");
|
||||
function testInitialLoad(exports, platform_id) {
|
||||
exports['load '+platform_id+' none'] = function(browser) {
|
||||
var ext = "";
|
||||
if (platform_id == 'zmachine') ext = '.inf';
|
||||
browser.url(IDEURL + '?platform='+platform_id+"&file=NOEXIST" + ext);
|
||||
browser.waitForElementVisible('.bootbox-alert'); // test unknown file alert (TODO: check text)
|
||||
browser.waitForElementNotVisible('#error_alert'); // but it will build anyway
|
||||
testTourDialog(browser);
|
||||
}
|
||||
}
|
||||
|
||||
function testPlatform(exports, platform_id, platform_name, numPresets) {
|
||||
testInitialLoad(exports, platform_id);
|
||||
for (let i=1; i<=numPresets; i++) {
|
||||
exports['load_'+platform_id+'_'+i] = function(browser) {
|
||||
exports['load '+platform_id+' '+i] = function(browser) {
|
||||
browser.click('#preset_select option:nth-child('+(i+1)+')');
|
||||
testCompile(browser, platform_id, platform_name);
|
||||
browser.getTitle( (title) => { console.log(title); } );
|
||||
testDebugging(browser);
|
||||
testDebugging(browser, platform_id);
|
||||
}
|
||||
}
|
||||
exports['end_'+platform_id] = function(browser) {
|
||||
exports['end '+platform_id] = function(browser) {
|
||||
browser.end();
|
||||
}
|
||||
exports['@tags'].push(platform_id);
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
testPlatform(this, 'vcs', 'Atari 2600', 35);
|
||||
testPlatform(this, 'nes', 'NES', 30);
|
||||
testPlatform(this, 'vicdual', 'VIC Dual', 7);
|
||||
testPlatform(this, 'mw8080bw', 'Midway 8080', 3);
|
||||
testPlatform(this, 'galaxian-scramble', 'Galaxian/Scramble', 3);
|
||||
testPlatform(this, 'vector-z80color', 'Atari Color Vector (Z80)', 3);
|
||||
testPlatform(this, 'williams-z80', 'Williams (Z80)', 3);
|
||||
// TODO testPlatform(this, 'sound_williams-z80', 'Williams Sound (Z80)', 1);
|
||||
testPlatform(this, 'coleco', 'ColecoVision', 12);
|
||||
//testPlatform(this, 'sms-sg1000-libcv', 'Sega SG-1000', 3);
|
||||
testPlatform(this, 'sms-sms-libcv', 'Sega Master System', 2);
|
||||
testPlatform(this, 'atari7800', 'Atari 7800', 1);
|
||||
testPlatform(this, 'astrocade', 'Bally Astrocade', 12);
|
||||
testPlatform(this, 'apple2', 'Apple ][+', 10);
|
||||
|
||||
var ex = module.exports;
|
||||
ex['@tags'] = []
|
||||
testPlatform(ex, 'vcs', 'Atari 2600', 35);
|
||||
testPlatform(ex, 'nes', 'NES', 30);
|
||||
testPlatform(ex, 'vicdual', 'VIC Dual', 7);
|
||||
testPlatform(ex, 'mw8080bw', 'Midway 8080', 3);
|
||||
testPlatform(ex, 'galaxian-scramble', 'Galaxian/Scramble', 3);
|
||||
testPlatform(ex, 'vector-z80color', 'Atari Color Vector (Z80)', 3);
|
||||
testPlatform(ex, 'williams-z80', 'Williams (Z80)', 3);
|
||||
// TODO testPlatform(ex, 'sound_williams-z80', 'Williams Sound (Z80)', 1);
|
||||
testPlatform(ex, 'coleco', 'ColecoVision', 12);
|
||||
//testPlatform(ex, 'sms-sg1000-libcv', 'Sega SG-1000', 3);
|
||||
testPlatform(ex, 'sms-sms-libcv', 'Sega Master System', 2);
|
||||
testPlatform(ex, 'atari7800', 'Atari 7800', 1);
|
||||
testPlatform(ex, 'astrocade', 'Bally Astrocade', 12);
|
||||
testPlatform(ex, 'verilog', 'Verilog', 33);
|
||||
testPlatform(ex, 'apple2', 'Apple ][+', 10);
|
||||
testPlatform(ex, 'basic', 'BASIC', 10);
|
||||
testPlatform(ex, 'zmachine', 'Z-Machine', 19);
|
||||
//testPlatform(ex, 'atari8-800xl.mame', 'Atari 800XL', 9);
|
||||
testPlatform(ex, 'msx', 'MSX', 5);
|
||||
testPlatform(ex, 'zx', 'ZX', 3);
|
||||
|
@ -12,6 +12,7 @@
|
||||
"es2017",
|
||||
"dom"
|
||||
],
|
||||
"esModuleInterop": true,
|
||||
"noImplicitThis": false,
|
||||
"noImplicitAny": false,
|
||||
"preserveConstEnums": true,
|
||||
|
Loading…
Reference in New Issue
Block a user