From df1cb1a7ee5be224eff357b3cbe290add5934056 Mon Sep 17 00:00:00 2001 From: David Konsumer Date: Sun, 15 Sep 2024 13:41:35 -0700 Subject: [PATCH] got basic as working --- cart/as/README.md | 4 +++- cart/as/asconfig.json | 16 ---------------- cart/as/null0.ts | 22 +--------------------- cart/as/package-lock.json | 16 ++++++++++++++-- cart/as/package.json | 9 ++++++--- cart/as/src/{index.ts => main.ts} | 4 ++-- cart/as/{src => }/tsconfig.json | 6 ++---- docs/cart/example-as.null0 | Bin 0 -> 15914 bytes docs/null0.js | 4 ---- null0_api/src/null0_api_wamr.h | 6 +++--- 10 files changed, 31 insertions(+), 56 deletions(-) delete mode 100644 cart/as/asconfig.json rename cart/as/src/{index.ts => main.ts} (69%) rename cart/as/{src => }/tsconfig.json (58%) create mode 100644 docs/cart/example-as.null0 diff --git a/cart/as/README.md b/cart/as/README.md index 4040be8..a472bad 100644 --- a/cart/as/README.md +++ b/cart/as/README.md @@ -1,5 +1,7 @@ This is an example null0 cart written in [assemblyscript](https://www.assemblyscript.org/). +You can make your own by editing files in [src/](src). `npm run build` will build your cart in `build/`. Change the package-name in package.json to change the name of the cart. + ## TODO -- look into [better build](https://github.com/notnullgames/null0-ideas/blob/main/projects/assemblyscript/tools/build.mjs) +- look into [better cross-plaform build](https://github.com/notnullgames/null0-ideas/blob/main/projects/assemblyscript/tools/build.mjs) diff --git a/cart/as/asconfig.json b/cart/as/asconfig.json deleted file mode 100644 index b72c80b..0000000 --- a/cart/as/asconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "targets": { - "release": { - "outFile": "build/main.wasm", - "textFile": "build/main.wat", - "sourceMap": true, - "optimizeLevel": 3, - "shrinkLevel": 0, - "converge": false, - "noAssert": false - } - }, - "options": { - "bindings": "esm" - } -} diff --git a/cart/as/null0.ts b/cart/as/null0.ts index 4fea8ba..6f93cd4 100644 --- a/cart/as/null0.ts +++ b/cart/as/null0.ts @@ -1,22 +1,2 @@ // include this in your null0 cart -// asc src/index.ts --target release --use trace=_null0_trace --use abort=_null0_abort --use seed=_null0_seed --lib ./null0.ts - -// log a string -@external("null0", "trace") -declare function _null0_real_trace(text: ArrayBuffer): void - -// these are called by language -// https://www.assemblyscript.org/concepts.html#special-imports -// TODO: would WASI help with these? - -export function _null0_trace(message: String): void { - _null0_real_trace(String.UTF8.encode(message, true)); -} - -export function _null0_abort(message: String, fileName: String, line: u32, column: u32): void { - _null0_real_trace(String.UTF8.encode("ABORT: " + message, true)); -} - -export function _null0_seed(): f64 { - return 1.0; -} +// asc --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json --lib ./null0.ts src/main.ts diff --git a/cart/as/package-lock.json b/cart/as/package-lock.json index eddbf24..a3c4f00 100644 --- a/cart/as/package-lock.json +++ b/cart/as/package-lock.json @@ -1,17 +1,29 @@ { - "name": "@null0/example-as", + "name": "example-as", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@null0/example-as", + "name": "example-as", "version": "0.0.0", "license": "MIT", "devDependencies": { + "@assemblyscript/wasi-shim": "^0.1.0", "assemblyscript": "^0.27.29" } }, + "node_modules/@assemblyscript/wasi-shim": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@assemblyscript/wasi-shim/-/wasi-shim-0.1.0.tgz", + "integrity": "sha512-fSLH7MdJHf2uDW5llA5VCF/CG62Jp2WkYGui9/3vIWs3jDhViGeQF7nMYLUjpigluM5fnq61I6obtCETy39FZw==", + "dev": true, + "license": "Apache-2.0", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/assemblyscript" + } + }, "node_modules/assemblyscript": { "version": "0.27.29", "resolved": "https://registry.npmjs.org/assemblyscript/-/assemblyscript-0.27.29.tgz", diff --git a/cart/as/package.json b/cart/as/package.json index e5f987c..0322ab0 100644 --- a/cart/as/package.json +++ b/cart/as/package.json @@ -1,13 +1,16 @@ { - "name": "@null0/example-as", + "name": "example-as", + "private": true, "version": "0.0.0", "scripts": { - "build": "asc src/index.ts --exportStart=_null0_init --target release --use trace=_null0_trace --use abort=_null0_abort --use seed=_null0_seed --lib ./null0.ts && mkdir -p build/cart/assets && cp build/main.wasm build/cart && cp src/assets/* build/cart/assets && cd build/cart && zip -r ../example.null0 .", - "start": "../../build/host/null0 ./build/example.null0", + "build": "asc --config ./node_modules/@assemblyscript/wasi-shim/asconfig.json --lib ./null0.ts --optimizeLevel 3 --outFile build/cart/main.wasm src/main.ts", + "postbuild": "mkdir -p build/cart/assets && cp src/assets/* build/cart/assets && cd build/cart && zip -r ../${npm_package_name}.null0 . && cp ../${npm_package_name}.null0 ../../../../docs/cart/", + "start": "../../build/host/null0 ./build/${npm_package_name}.null0", "prestart": "npm run build" }, "license": "MIT", "devDependencies": { + "@assemblyscript/wasi-shim": "^0.1.0", "assemblyscript": "^0.27.29" }, "type": "module", diff --git a/cart/as/src/index.ts b/cart/as/src/main.ts similarity index 69% rename from cart/as/src/index.ts rename to cart/as/src/main.ts index 8fdc3bc..5fe29d6 100644 --- a/cart/as/src/index.ts +++ b/cart/as/src/main.ts @@ -1,9 +1,9 @@ // called when the cart is loaded export function load(): void { - trace("hello from AS"); + console.log("hello from AS"); } // called on every frame export function update(): void { - trace("update"); + console.log("update"); } diff --git a/cart/as/src/tsconfig.json b/cart/as/tsconfig.json similarity index 58% rename from cart/as/src/tsconfig.json rename to cart/as/tsconfig.json index e28fcf2..4a6705d 100644 --- a/cart/as/src/tsconfig.json +++ b/cart/as/tsconfig.json @@ -1,6 +1,4 @@ { "extends": "assemblyscript/std/assembly.json", - "include": [ - "./**/*.ts" - ] -} \ No newline at end of file + "include": ["./src/**/*.ts"] +} diff --git a/docs/cart/example-as.null0 b/docs/cart/example-as.null0 new file mode 100644 index 0000000000000000000000000000000000000000..7efa633166913f42ce58cb1b4b51483ddcdfd5ab GIT binary patch literal 15914 zcmaL8W3*^Xw#Q zUEHAo070Gs0RaA!I<2l_tu2OCy=_PbE zmy$}%Y;oZ7v$De}LU}LAZ;~&sAs^0r)K4kilu!w#ORpG5T^6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6)V$Hk&WM?%`hKM}Sk8H|?;-Ly=q@ zxwM#Hsh?wVm!8_izw(pjuf0k?DC{T|JjWF{F8SV@?(BnzdWOWod43~|53aN&>SV6s z2ztqtJ``tJ0PKujWc1K8BLPkNL@tQ1!D(eC?1jYco0qh@V&d%q2}Kr)UJX9=)H3WG z>FH7roMl;RG1!KagtP+vnO=l%dK=P$GnT@+I=;6!u0}P2Zp z%DQ0!amY}2N!`S1V+c*ossle}^xH)JXb-qo516LB?)5BpuLmg3K-kTeWXX#fqE^20 zFbGXZ+9j(-+paF=&g5yT&h%1qCOVXTRTvU)wt*PT3)*{3kHAe48(Dj#7>HB~c;}tO z8~v2Lc%O3IO+OAa*bS*?W2>I;+)ds0hS0rGgFnnh2AS|wskDsMmQR1ReUhXsdwtw{ zmT#`0yUN0mvbc0elk@1AgofP3gX`-?DQ-)m+x#0FH52cBy|T;#48|Y${h6`%fku^tC4Fr!E+N*mkbCc;z;N_hyklZ53`y&`1_qn*I;#ElmH0jgs84Xw_ z+hrl_xM4>QMYSYL#R%-h4~x`7O>udoz7A*oq;h@+v7SJf(O~c$sZx#8ST*N38M>Ke zNS0Lr<6;NYJ1VaTR$vex=3Dx4ef8p^qLVU|brmCM)haiSJf z?T9g_;a#q_8B)Vw=Gl{%OX@%k>pur`5(RQYIkBG%7+zm=G1oT-0u)N%2Y*7Z>eK}7 z$MYSv>dou)U%Z4$!(qdJP6Z>*@MeDj<)r|DaDo3zZvWrS(dhq6zF*}3@AUs+l?MI4 ztkVCRcK=_v|C9Xxf5O27TnpIzVZUy+CU;qHu{x$yv_P-kg X{!f*Hg8lnT!2h)Of8JO;|9<@s@+8ID literal 0 HcmV?d00001 diff --git a/docs/null0.js b/docs/null0.js index 547f560..1623a5c 100755 --- a/docs/null0.js +++ b/docs/null0.js @@ -134,10 +134,6 @@ export async function setupCart( out.cart = cart; - if (cart._null0_init) { - cart._null0_init(); - } - if (cart._start) { cart._start(); } diff --git a/null0_api/src/null0_api_wamr.h b/null0_api/src/null0_api_wamr.h index aaaab30..7ae8080 100755 --- a/null0_api/src/null0_api_wamr.h +++ b/null0_api/src/null0_api_wamr.h @@ -833,13 +833,13 @@ bool null0_init() { cart_keyUp = wasm_runtime_lookup_function(module_inst, "keyUp"); cart_keyDown = wasm_runtime_lookup_function(module_inst, "keyDown"); - // this is for AS, since it needs a seperate function called + // this is for hosts that seperate init wasm_function_inst_t cart_init = NULL; - cart_init = wasm_runtime_lookup_function(module_inst, "_null0_init"); + cart_init = wasm_runtime_lookup_function(module_inst, "load"); if (cart_init != NULL) { if (!wasm_runtime_call_wasm(exec_env, cart_init, 0, NULL)) { // not fatal, but this will help with troubleshooting - printf("init: %s\n", wasm_runtime_get_exception(module_inst)); + printf("load: %s\n", wasm_runtime_get_exception(module_inst)); } }