First web implementation draft of the draft

This commit is contained in:
Luxferre
2022-07-28 18:14:21 +03:00
parent 5a98969bce
commit 08ed67ff95
5 changed files with 470 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
//app part not related to ESOP JS implementation
function main() {
var devCfg = {
audio: window.audioContext || window.webkitAudioContext,
canvas: document.getElementById('C') //JS-specific implementation canvas DOM reference
}
document.getElementById('apprun').addEventListener('click', function() {
var fileObj = document.getElementById('appselect').files[0]
if(fileObj.name.endsWith('.eso')) {
var rdr = new FileReader()
rdr.onload = function() {
var vm = UxnCore()
var ext = ESOPExtensions()
vm.boot()
ext.setup(vm, devCfg)
vm.load(new Uint8Array(rdr.result))
console.log('VM started')
vm.start(0x100)
}
rdr.readAsArrayBuffer(fileObj)
}
else window.alert('Please select an .eso file to run on ESOP')
})
}
addEventListener('DOMContentLoaded', main)