worker: converted acme/zmac/yasm to WASI

This commit is contained in:
Steven Hugg committed 2026-09-06 09:55:24 +02:00
1 parent 574ea7d847
commit 2a48c5e272
11 files changed
+134 -5155

No files matched your search

+2 -2
View File
@@ -262,7 +262,7 @@ export const TOOL_META: { [id: string]: ToolMeta } = {
extensions: ['.lnk'],
editorStyle: '6502',
wasmModule: 'merlin32',
version: '1.1.1',
version: '1.1.10',
includePatterns: [...SHARED_INCLUDE_PATTERNS, ...USE_ASM_INCLUDE_PATTERNS],
linkPatterns: SHARED_LINK_PATTERNS,
},
@@ -479,7 +479,7 @@ export const TOOL_META: { [id: string]: ToolMeta } = {
extensions: ['.asm'],
editorStyle: 'gas',
wasmModule: 'yasm',
version: '1.3.0.47.gc9db',
version: '1.3.0',
includePatterns: SHARED_INCLUDE_PATTERNS,
linkPatterns: SHARED_LINK_PATTERNS,
},
+22
View File
@@ -633,6 +633,16 @@ export class WASIRunner {
this.poke_filestat(filestat_ptr, fd);
return WASIErrors.SUCCESS;
}
fd_filestat_set_size(fd: number, size: number | bigint) {
const file = this.fds[fd];
debug("fd_filestat_set_size", fd, size, file + "");
if (file == null) return WASIErrors.BADF;
if (typeof size == 'bigint') size = Number(size);
file.ensureCapacity(size);
if (size < file.size) file.offset = Math.min(file.offset, size);
file.size = size;
return WASIErrors.SUCCESS;
}
fd_filestat_get(fd: number, filestat_ptr: number) {
const file = this.fds[fd];
debug("fd_filestat_get", fd, filestat_ptr, file + "");
@@ -687,6 +697,16 @@ export class WASIRunner {
this.poke64(time_ptr, time);
return WASIErrors.SUCCESS;
}
path_create_directory(fd: number, path_ptr: number, path_len: number) {
const dir = this.fds[fd];
if (dir == null) return WASIErrors.BADF;
if (dir.type !== FDType.DIRECTORY) return WASIErrors.NOTDIR;
const filename = this.peekUTF8(path_ptr, path_len);
const path = dir.name + '/' + filename;
debug("path_create_directory", path);
this.fs.putDirectory(path);
return WASIErrors.SUCCESS;
}
getWASISnapshotPreview1() {
return {
args_sizes_get: this.args_sizes_get.bind(this),
@@ -704,9 +724,11 @@ export class WASIRunner {
fd_close: this.fd_close.bind(this),
path_filestat_get: this.path_filestat_get.bind(this),
fd_filestat_get: this.fd_filestat_get.bind(this),
fd_filestat_set_size: this.fd_filestat_set_size.bind(this),
random_get: this.random_get.bind(this),
path_readlink: this.path_readlink.bind(this),
path_unlink_file: this.path_unlink_file.bind(this),
path_create_directory: this.path_create_directory.bind(this),
clock_time_get: this.clock_time_get.bind(this),
fd_fdstat_set_flags() { warning("TODO: fd_fdstat_set_flags"); return WASIErrors.NOTSUP; },
fd_readdir() { warning("TODO: fd_readdir"); return WASIErrors.NOTSUP; },
+39 -21
View File
@@ -1,7 +1,8 @@
import { CodeListing, CodeListingMap } from "../../common/workertypes";
import { BuildStep, BuildStepResult, gatherFiles, staleFiles, populateFiles, fixParamsWithDefines, putWorkFile } from "../builder";
import { msvcErrorMatcher } from "../listingutils";
import { loadNative, moduleInstFn, print_fn, setupFS, execMain, emglobal, EmscriptenModule } from "../wasmutils";
import { CodeListing, CodeListingMap, WorkerError } from "../../common/workertypes";
import { BuildStep, BuildStepResult, gatherFiles, staleFiles, putWorkFile, store } from "../builder";
import { msvcErrorMatcher, re_crlf } from "../listingutils";
import { WASIRunner } from "../../common/wasi/wasishim";
import { loadWASMBinary } from "../wasmutils";
function parseACMESymbolTable(text: string) {
var symbolmap = {};
@@ -47,25 +48,24 @@ function parseACMEReportFile(text: string) {
return listings;
}
let wasiModule: WebAssembly.Module | null = null;
export function assembleACME(step: BuildStep): BuildStepResult {
loadNative("acme");
var errors = [];
let errors: WorkerError[] = [];
gatherFiles(step, { mainFilePath: "main.acme" });
var binpath = step.prefix + ".bin";
var lstpath = step.prefix + ".lst";
var sympath = step.prefix + ".sym";
if (staleFiles(step, [binpath])) {
var binout, lstout, symout;
var ACME: EmscriptenModule = emglobal.acme({
instantiateWasm: moduleInstFn('acme'),
noInitialRun: true,
print: print_fn,
printErr: msvcErrorMatcher(errors),
//printErr: makeErrorMatcher(errors, /(Error|Warning) - File (.+?), line (\d+)[^:]+: (.+)/, 3, 4, step.path, 2),
});
var FS = ACME.FS;
populateFiles(step, FS);
fixParamsWithDefines(step.path, step.params);
if (!wasiModule) {
wasiModule = new WebAssembly.Module(loadWASMBinary("acme"));
}
const wasi = new WASIRunner();
wasi.initSync(wasiModule);
for (let file of step.files) {
wasi.fs.putFile("./" + file, store.getFileData(file));
}
wasi.addPreopenDirectory(".");
var args = ['--msvc', '--initmem', '0', '-o', binpath, '-r', lstpath, '-l', sympath, step.path];
if (step.params?.acmeargs) {
args.unshift.apply(args, step.params.acmeargs);
@@ -76,14 +76,32 @@ export function assembleACME(step: BuildStep): BuildStepResult {
if (step.mainfile) {
args.unshift.apply(args, ["-D__MAIN__=1"]);
}
execMain(step, ACME, args);
wasi.setArgs(['acme', ...args]);
try {
wasi.run();
} catch (e) {
errors.push({ line: 0, msg: "" + e });
}
const stdout = wasi.fds[1].getBytesAsString();
const stderr = wasi.fds[2].getBytesAsString();
if (stdout) console.log(stdout);
const matcher = msvcErrorMatcher(errors);
for (let line of stderr.split(re_crlf)) {
matcher(line);
}
if (errors.length) {
let listings: CodeListingMap = {};
return { errors, listings };
}
binout = FS.readFile(binpath, { encoding: 'binary' });
lstout = FS.readFile(lstpath, { encoding: 'utf8' });
symout = FS.readFile(sympath, { encoding: 'utf8' });
let binout: Uint8Array, lstout: string, symout: string;
try {
binout = wasi.fs.getFile("./" + binpath).getBytes();
lstout = wasi.fs.getFile("./" + lstpath).getBytesAsString();
symout = wasi.fs.getFile("./" + sympath).getBytesAsString();
} catch (e) {
errors.push({ line: 0, msg: "No output generated, maybe a fatal assembly error?" });
return { errors };
}
putWorkFile(binpath, binout);
putWorkFile(lstpath, lstout);
putWorkFile(sympath, symout);
+35 -21
View File
@@ -1,10 +1,13 @@
import { WorkerError, CodeListingMap } from "../../common/workertypes";
import { BuildStep, BuildStepResult, gatherFiles, staleFiles, getWorkFileAsString, populateFiles, fixParamsWithDefines, putWorkFile, anyTargetChanged } from "../builder";
import { msvcErrorMatcher, parseListing } from "../listingutils";
import { EmscriptenModule, emglobal, execMain, loadNative, moduleInstFn, print_fn } from "../wasmutils";
import { BuildStep, BuildStepResult, gatherFiles, staleFiles, getWorkFileAsString, populateFiles, fixParamsWithDefines, putWorkFile, anyTargetChanged, store } from "../builder";
import { msvcErrorMatcher, parseListing, re_crlf } from "../listingutils";
import { EmscriptenModule, emglobal, execMain, loadNative, moduleInstFn, print_fn, loadWASMBinary } from "../wasmutils";
import { WASIRunner } from "../../common/wasi/wasishim";
import { preprocessMCPP } from "./mcpp";
// http://www.techhelpmanual.com/829-program_startup___exit.html
let wasiModule: WebAssembly.Module | null = null;
export function compileSmallerC(step: BuildStep): BuildStepResult {
loadNative("smlrc");
var params = step.params;
@@ -71,8 +74,7 @@ export function compileSmallerC(step: BuildStep): BuildStepResult {
}
export function assembleYASM(step: BuildStep): BuildStepResult {
loadNative("yasm");
var errors = [];
var errors: WorkerError[] = [];
gatherFiles(step, { mainFilePath: "main.asm" });
var objpath = step.prefix + ".exe";
var lstpath = step.prefix + ".lst";
@@ -85,25 +87,37 @@ export function assembleYASM(step: BuildStep): BuildStepResult {
//'-I/share/asminc',
'-o', objpath, '-l', lstpath, '--mapfile=' + mappath,
step.path];
// return yasm/*.ready*/
var YASM: EmscriptenModule = emglobal.yasm({
instantiateWasm: moduleInstFn('yasm'),
noInitialRun: true,
//logReadFiles:true,
print: print_fn,
printErr: msvcErrorMatcher(errors),
});
var FS = YASM.FS;
//setupFS(FS, '65-'+getRootBasePlatform(step.platform));
populateFiles(step, FS);
//fixParamsWithDefines(step.path, step.params);
execMain(step, YASM, args);
if (!wasiModule) {
wasiModule = new WebAssembly.Module(loadWASMBinary("yasm"));
}
const wasi = new WASIRunner();
wasi.initSync(wasiModule);
for (let file of step.files) {
wasi.fs.putFile("./" + file, store.getFileData(file));
}
wasi.addPreopenDirectory(".");
wasi.setArgs(['yasm', ...args]);
try {
wasi.run();
} catch (e) {
errors.push({ line: 0, msg: "" + e });
}
const stderr = wasi.fds[2].getBytesAsString();
const matcher = msvcErrorMatcher(errors);
for (let line of stderr.split(re_crlf)) {
matcher(line);
}
if (errors.length)
return { errors: errors };
var objout, lstout, mapout;
objout = FS.readFile(objpath, { encoding: 'binary' });
lstout = FS.readFile(lstpath, { encoding: 'utf8' });
mapout = FS.readFile(mappath, { encoding: 'utf8' });
try {
objout = wasi.fs.getFile("./" + objpath).getBytes();
lstout = wasi.fs.getFile("./" + lstpath).getBytesAsString();
mapout = wasi.fs.getFile("./" + mappath).getBytesAsString();
} catch (e) {
errors.push({ line: 0, msg: "No output generated, maybe a fatal assembly error?" });
return { errors: errors };
}
putWorkFile(objpath, objout);
putWorkFile(lstpath, lstout);
//putWorkFile(mappath, mapout);
+36 -21
View File
@@ -1,43 +1,59 @@
import { CodeListingMap } from "../../common/workertypes";
import { BuildStep, BuildStepResult, gatherFiles, staleFiles, populateFiles, putWorkFile, anyTargetChanged } from "../builder";
import { CodeListingMap, WorkerError } from "../../common/workertypes";
import { BuildStep, BuildStepResult, gatherFiles, staleFiles, putWorkFile, anyTargetChanged, store } from "../builder";
import { makeErrorMatcher, parseListing } from "../listingutils";
import { EmscriptenModule, emglobal, execMain, loadNative, moduleInstFn, print_fn } from "../wasmutils";
import { re_crlf } from "../listingutils";
import { WASIRunner } from "../../common/wasi/wasishim";
import { loadWASMBinary } from "../wasmutils";
let wasiModule: WebAssembly.Module | null = null;
export function assembleZMAC(step: BuildStep): BuildStepResult {
loadNative("zmac");
var hexout, lstout, binout;
var errors = [];
let errors: WorkerError[] = [];
var params = step.params;
gatherFiles(step, { mainFilePath: "main.asm" });
var lstpath = step.prefix + ".lst";
var binpath = step.prefix + ".cim";
if (staleFiles(step, [binpath])) {
if (!wasiModule) {
wasiModule = new WebAssembly.Module(loadWASMBinary("zmac"));
}
const wasi = new WASIRunner();
wasi.initSync(wasiModule);
for (let file of step.files) {
wasi.fs.putFile("./" + file, store.getFileData(file));
}
wasi.addPreopenDirectory(".");
/*
error1.asm(4) : 'l18d4' Undeclared
JP L18D4
error1.asm(11): warning: 'foobar' treated as label (instruction typo?)
Add a colon or move to first column to stop this warning.
1 errors (see listing if no diagnostics appeared here)
*/
var ZMAC: EmscriptenModule = emglobal.zmac({
instantiateWasm: moduleInstFn('zmac'),
noInitialRun: true,
//logReadFiles:true,
print: print_fn,
printErr: makeErrorMatcher(errors, /([^( ]+)\s*[(](\d+)[)]\s*:\s*(.+)/, 2, 3, step.path),
});
var FS = ZMAC.FS;
populateFiles(step, FS);
const matcher = makeErrorMatcher(errors, /([^( ]+)\s*[(](\d+)[)]\s*:\s*(.+)/, 2, 3, step.path);
// TODO: don't know why CIM (hexary) doesn't work
execMain(step, ZMAC, ['-z', '-c', '--oo', 'lst,cim', step.path]);
wasi.setArgs(['zmac', '-z', '-c', '--oo', 'lst,cim', step.path]);
try {
wasi.run();
} catch (e) {
errors.push({ line: 0, msg: "" + e });
}
const stderr = wasi.fds[2].getBytesAsString();
for (let line of stderr.split(re_crlf)) {
matcher(line);
}
if (errors.length) {
return { errors: errors };
}
lstout = FS.readFile("zout/" + lstpath, { encoding: 'utf8' });
binout = FS.readFile("zout/" + binpath, { encoding: 'binary' });
let lstout: string, binout: Uint8Array;
try {
lstout = wasi.fs.getFile("./zout/" + lstpath).getBytesAsString();
binout = wasi.fs.getFile("./zout/" + binpath).getBytes();
} catch (e) {
errors.push({ line: 0, msg: "No output generated, maybe a fatal assembly error?" });
return { errors: errors };
}
putWorkFile(binpath, binout);
putWorkFile(lstpath, lstout);
if (!anyTargetChanged(step, [binpath, lstpath]))
@@ -66,4 +82,3 @@ export function assembleZMAC(step: BuildStep): BuildStepResult {
};
}
}
-21
View File
@@ -1,21 +0,0 @@
var acme = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(acme = {}) {
var Module=typeof acme!="undefined"?acme:{};var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary,setWindowTitle;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=__dirname+"/"}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=()=>"[Emscripten Module object]"}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}setWindowTitle=title=>document.title=title}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.warn.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];var noExitRuntime=Module["noExitRuntime"]||true;if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var wasmTable;var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeKeepaliveCounter=0;function keepRuntimeAlive(){return noExitRuntime||runtimeKeepaliveCounter>0}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDLine truncated
return acme;//.ready
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = acme;
else if (typeof define === 'function' && define['amd'])
define([], function() { return acme; });
else if (typeof exports === 'object')
exports["acme"] = acme;
Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.
-18
View File
@@ -1,18 +0,0 @@
var zmac = function(zmac) {
zmac = zmac || {};
var Module=typeof zmac!=="undefined"?zmac:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module["arguments"]=[];Module["thisProgram"]="./this.program";Module["quit"]=(function(status,toThrow){throw toThrow});Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("Module['ENVIRONMENT'] value is not valid. must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){var nodeFS;var nodePath;Module["read"]=function shell_read(filename,binary){var ret;if(!nodeFS)nodeFS=require("fs");if(!nodePath)nodePath=require("path");filename=nodePath["normalize"](filename);ret=nodeFS["readFileSync"](filename);return binary?ret:ret.toString()};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}Module["arguments"]=process["argv"].slice(2);process["on"]("uncaughtException",(function(ex){if(!(ex instanceof ExitStatus)){throw ex}}));process["on"]("unhandledRejection",(function(reason,p){process["exit"](1)}));Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(typeof read!="undefined"){Module["read"]=function shell_read(f){return read(f)}}Module["readBinary"]=function readBinary(f){var data;if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof quit==="function"){Module["quit"]=(function(status,toThrow){quit(status)})}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function shell_read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){Module["readBinary"]=function readBinary(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)};Module["setWindowTitle"]=(function(title){document.title=title})}else{throw new Error("not compiled for this environment")}Module["print"]=typeof console!=="undefined"?console.log.bind(console):typeof print!=="undefined"?print:null;Module["printErr"]=typeof printErr!=="undefined"?printErr:typeof console!=="undefined"&&console.warn.bind(console)||Module["print"];Module.print=Module["print"];Module.printErr=Module["printErr"];for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var STACK_ALIGN=16;function staticAlloc(size){assert(!staticSealed);var ret=STATICTOP;STATICTOP=STATICTOP+size+15&-16;return ret}function dynamicAlloc(size){assert(DYNAMICTOP_PTR);var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;HEAP32[DYNAMICTOP_PTR>>2]=end;if(end>=TOTAL_MEMORY){var success=enlargeMemory();if(!success){HEAP32[DYNAMICTOP_PTR>>2]=ret;return 0}}return ret}function alignMemory(size,factor){if(!factor)factor=STACK_ALIGN;var ret=size=Math.ceil(size/factor)*factor;return ret}function getNativeTypeSize(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return 4}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;Module.printErr(text)}}var asm2wasmImports={"f64-rem":(function(x,y){return x%y}),"debugger":(function(){debugger})};var jsCallStartIndex=1;var functionPointers=new Array(0);var funcWrappers={};function dynCall(sig,ptr,args){if(args&&args.length){return Module["dynCall_"+sig].apply(null,[ptr].concat(args))}else{return ModLine truncated
return zmac;
};
if (typeof exports === 'object' && typeof module === 'object')
module.exports = zmac;
else if (typeof define === 'function' && define['amd'])
define([], function() { return zmac; });
else if (typeof exports === 'object')
exports["zmac"] = zmac;
Binary file not shown.