mirror of
https://github.com/exoticorn/microw8.git
synced 2026-11-13 23:17:19 +01:00
last preparations for 0.1.0 release
This commit is contained in:
1 parent
179b3eaed1
commit
c9ae04e652
8 files changed
+132
-6
No files matched your search
@@ -1,3 +1,5 @@
|
||||
/target
|
||||
.cargo/
|
||||
.vscode/
|
||||
/examples/**/*.wasm
|
||||
/examples/**/*.uw8
|
||||
@@ -1 +1,61 @@
|
||||
See [here](https://exoticorn.github.io/microw8/).
|
||||
# MicroW8
|
||||
|
||||
MicroW8 is a WebAssembly based fantasy console inspired by the likes of [TIC-80](https://tic80.com/), [WASM-4](https://wasm4.org/) and [PICO-8](https://www.lexaloffle.com/pico-8.php).
|
||||
|
||||
The initial motivation behind MicroW8 was to explore whether there was a way to make WebAssembly viable for size-coding. (Size coding being the art of creating tiny (often <= 256 bytes) graphical effects and games.) The available examples so far are all in this space, however, I very carefully made sure that all design decisions make sense from the point of view of bigger projects as well.
|
||||
|
||||
See [here](https://exoticorn.github.io/microw8/) for more information and docs.
|
||||
|
||||
## Specs
|
||||
|
||||
* Screen: 320x240, 256 colors, 60Hz
|
||||
* Modules: Up to 256KB (WASM)
|
||||
* Memory: 256KB
|
||||
* Gamepad input (D-Pad + 4 Buttons)
|
||||
|
||||
## Download
|
||||
|
||||
The download includes
|
||||
|
||||
* `microw8.html`: The web runtime, a small, self-contained html file that can be opened in any modern browser to load and run MicroW8 carts.
|
||||
* `uw8`/`uw8.exe`: The MicroW8 dev tool, including a native runtime.
|
||||
* `examples`: Example source code in CurlyWas and Wat (WebAssembly text format).
|
||||
* `carts`: The examples compiled to `.uw8` carts.
|
||||
|
||||
## uw8 dev tool
|
||||
|
||||
```
|
||||
uw8 run [<options>] <file>
|
||||
|
||||
Runs <file> which can be a binary WebAssembly module, an `.uw8` cart, a wat (WebAssembly text format) source file or a CurlyWas source file.
|
||||
|
||||
Options:
|
||||
|
||||
-w, --watch : Reloads the given file every time it changes on disk.
|
||||
-p, --pack : Pack the file into an .uw8 cart before running it and print the resulting size.
|
||||
-u, --uncompressed : Use the uncompressed uw8 format for packing.
|
||||
-l LEVEL, --level LEVEL : Compression level (0-9). Higher compression levels are really slow.
|
||||
-o FILE, --output FILE : Write the loaded and optionally packed cart back to disk.
|
||||
|
||||
|
||||
uw8 pack [<options>] <infile> <outfile>
|
||||
|
||||
Packs the WebAssembly module or text file, or CurlyWas source file into a .uw8 cart.
|
||||
|
||||
Options:
|
||||
|
||||
-u, --uncompressed : Use the uncompressed uw8 format for packing.
|
||||
-l LEVEL, --level LEVEL : Compression level (0-9). Higher compression levels are really slow.
|
||||
|
||||
|
||||
uw8 filter-exports <infile> <outfile>
|
||||
|
||||
Reads a binary WebAssembly module, removes all exports not used by the MicroW8 platform + everything that is unreachable without those exports and writes the resulting module to <outfile>.
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
* [Fireworks](https://exoticorn.github.io/microw8/v0.1pre5#AgwvgP+M59snqjl4CMKw5sqm1Zw9yJCbSviMjeLUdHus2a3yl/a99+uiBeqZgP/2jqSjrLjRk73COMM6OSLpsxK8ugT1kuk/q4hQUqqPpGozHoa0laulzGGcahzdfdJsYaK1sIdeIYS9M5PnJx/Wk9H+PvWEPy2Zvv7I6IW7Fg==) (127 bytes): Some fireworks to welcome 2022.
|
||||
* [Skip Ahead](https://exoticorn.github.io/microw8/v0.1pre5#AgyfpZ80wkW28kiUZ9VIK4v+RPnVxqjK1dz2BcDoNyQPsS2g4OgEzkTe6jyoAfFOmqKrS8SM2aRljBal9mjNn8i4fP9eBK+RehQKxxGtJa9FqftvqEnh3ez1YaYxqj7jgTdzJ/WAYVmKMovBT1myrX3FamqKSOgMsNedLhVTLAhQup3sNcYEjGNo8b0HZ5+AgMgCwYRGCe//XQOMAaAAzqDILgmpEZ/43RKHcQpHEQwbURfNQJpadJe2sz3q5FlQnTGXQ9oSMokidhlC+aR/IpNHieuBGLhFZ2GfnwVQ0geBbQpTPA==) (229 bytes): A port of my [TIC-80 256byte game](http://tic80.com/play?cart=1735) from LoveByte'21
|
||||
* [OhNoAnotherTunnel](https://exoticorn.github.io/microw8/v0.1pre4#Ag95rdCB5Ww5NofyQaKF4P1mrNRso4azgiem4hK99Gh8OMzSpFq3NsNDo7O7pqln10D11l9uXr/ritw7OEzKwbEfCdvaRnS2Z0Kz0iDEZt/gIqOdvFmxsL1MjPQ4XInPbUJpQUonhQq29oP2omFabnQxn0bzoK7mZjcwc5GetHG+hGajkJcRr8oOnjfCol8RD+ha33GYtPnut+GLe4ktzf5UxZwGs6oT9qqC61lRDakN) (177 bytes): A port of my [entry](http://tic80.com/play?cart=1871) in the Outline'21 bytebattle final
|
||||
* [Technotunnel](https://exoticorn.github.io/microw8/v0.1pre4#AqL8HeK1M9dn2nWNIF5vaq/Vh64pMt5nJIFoFKpBMPUsGtDtpqjo1JbT9LzPhAxCqJ7Yh4TA6oTGd4xhLowf+cWZMY73+7AZmfXJJsBi4cej/hH+4wlAgxFIrnOYnr/18IpnZbsHf0eGm1BhahX74+cVR0TRmNQmYC7GhCNS3mv/3MJn74lCj7t28aBJPjEZhP9fGXdG2u5Egh/Tjdg=) (158 bytes): A port of my [entry](https://tic80.com/play?cart=1873) in the Outline'21 bytebattle quater final
|
||||
@@ -0,0 +1,2 @@
|
||||
/binaries
|
||||
/build
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
# build web runtime
|
||||
pushd ../web
|
||||
rm -rf .parcel-cache
|
||||
yarn parcel build src/index.html
|
||||
popd
|
||||
|
||||
rm -rf build
|
||||
mkdir -p build/microw8-linux
|
||||
mkdir build/microw8-macos
|
||||
mkdir build/microw8-windows
|
||||
|
||||
# unzip binaries build by github actions
|
||||
pushd binaries
|
||||
unzip -o uw8-linux.zip
|
||||
chmod +x uw8
|
||||
mv uw8 ../build/microw8-linux
|
||||
unzip -o uw8-macos.zip
|
||||
chmod +x uw8
|
||||
mv uw8 ../build/microw8-macos
|
||||
unzip -o uw8-windows.zip
|
||||
mv uw8.exe ../build/microw8-windows
|
||||
popd
|
||||
|
||||
for dir in build/*; do
|
||||
mkdir $dir/examples
|
||||
for example in ../examples/curlywas/*.cwa; do
|
||||
cp $example $dir/examples
|
||||
done
|
||||
for example in ../examples/wat/*.wat; do
|
||||
cp $example $dir/examples
|
||||
done
|
||||
|
||||
mkdir $dir/carts
|
||||
for example in $dir/examples/*; do
|
||||
build/microw8-linux/uw8 pack -l 9 $example $dir/carts/$(basename ${example%.*}).uw8
|
||||
done
|
||||
|
||||
cp ../web/dist/index.html $dir/microw8.html
|
||||
cp ../README.md $dir
|
||||
cp ../UNLICENSE $dir
|
||||
done
|
||||
|
||||
VERSION=$(build/microw8-linux/uw8 version)
|
||||
|
||||
cd build
|
||||
tar czf microw8-$VERSION-linux.tgz microw8-linux
|
||||
tar czf microw8-$VERSION-macos.tgz microw8-macos
|
||||
zip -r -9 microw8-$VERSION-windows.zip microw8-windows
|
||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
<!doctype html><html><head><meta charset="utf8"><title>MicroW8</title><link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@500&display=swap" rel="stylesheet"><style>body,canvas,html{margin:0;padding:0}html{background-color:#202024;color:#808070;font-family:Josefin Sans,Verdana,Arial Black,sans-serif}body,html{height:100%}body{display:grid;grid-template-rows:1fr 0fr}#uw8{position:absolute}#uw8 a{font-size:130%}#centered{align-self:center;justify-self:center}a{color:#303630}a:hover{color:#405040}#screen{background-color:#202428;border:4px solid #303040;box-shadow:5px 5px 20px #000;cursor:none;height:240px;image-rendering:pixelated;width:320px}#message,#screen{margin-bottom:8px}.error{color:#e04030}button{background-color:#303440;border:1px solid #404040;border-radius:4px;color:#808070;font-family:inherit;padding:4px}button:hover{background-color:#202010}button:active{background-color:#504450}@media (min-width:680px) and (min-height:620px){#screen{height:480px;width:640px}}@media (min-width:1000px) and (min-height:800px){#screen{height:720px;width:960px}}@media (width:640px) and (height:480px){#screen{border:0;height:480px;margin:0;width:640px}body{overflow:hidden}}</style></head><body> <div id="uw8"> <a href="https://exoticorn.github.io/microw8">MicroW8</a> 0.1.0 </div> <div id="centered"> <canvas id="screen" width="320" height="240"></canvas> <div id="message"></div> <button id="cartButton" style="visibility:hidden">Load cart...</button> </div> <div id="footer"> <a href="http://unlicense.org/" ref="license">Unlicense</a> </div> </body><script type="module">function A(A){return A&&A.__esModule?A.default:A}function e(A,e){let t=A?`${A} bytes`:"Insert cart";e&&(t+=` - <span class="error">${e.replaceAll("<","<")}</span>`),document.getElementById("message").innerHTML=t}let t,B,a=document.getElementById("screen"),r=a.getContext("2d"),n=r.createImageData(320,240),s=A=>new Uint8Array(A),i=A=>new Uint32Array(A),o=0,F=A=>{let e,t="keydown"==A.type;switch(A.code){case"ArrowUp":e=1;break;case"ArrowDown":e=2;break;case"ArrowLeft":e=4;break;case"ArrowRight":e=8;break;case"KeyZ":e=16;break;case"KeyX":e=32;break;case"KeyA":e=64;break;case"KeyS":e=128;break;case"KeyR":t&&l(B)}t?o|=e:o&=~e};async function l(F,c){t&&(t(),t=null);let Q=F.byteLength;if(e(Q),0==Q)return;B=F;let E=window.location.pathname;if(Q<=1024&&!c){let A="";for(let e of s(F))A+=String.fromCharCode(e);E+="#"+btoa(A),E!=window.location.pathname+window.location.hash&&history.pushState(null,null,E)}a.width=a.width;try{let a,c=new WebAssembly.Memory({initial:4,maximum:4}),E=s(c.buffer),g={env:{memory:c}},I=A=>{if(0!=s(A)[0]){E.set(s(A));let e=a.exports.load_uw8(A.byteLength);A=new ArrayBuffer(e),s(A).set(E.slice(0,e))}return A},f=async A=>(await WebAssembly.instantiate(A,g)).instance,w=async A=>f(I(await(await fetch(A)).arrayBuffer()));a=await w(A("data:application/wasm;base64,AGFzbQEAAAABFQRgAX8Bf2ACf38Bf2ADf39%2FAGAAAAIPAQNlbnYGbWVtb3J5AgAEAwkIAAABAgEAAAMGEAN%2FAUEAC38BQQALfwFBAAsHGQIIbG9hZF91dzg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4X%2F9%2FZ66bwxYl1h%2BNAL%2BQh0zt3iSqNerI7l0QMOySt%2FPOFO3hXwdaMgxln646dVGVLPhHQbMoREgNzLIYMv4gBUU6Cr%2BR0QYi3tDAXJ4SoSxKCyLsv7cfb5Cl%2BYC5Jus5xElZgiDlIIHBqFDldTRQ5nBJl5es0ZDmEl3WiHmM1UA8QeePxqNrYic7ifdP3EBFW5S6xR2jJ3ck%2BXX1DdwcNjNkIkxbPKNFOeqWZ%2FJ72Bz14fhYzfrX%2FfCvJQ2mBNrPbSIjF%2B6V1RUKuyzvSVyFXaomCpe3Y3V7yP5iFDf7QCB30gL0F9spf8BoPYv9hjE6Q3ZkqKBvEmZicrDv16JtFEfFeGz74RiGn3in3LRJfDC6flml3%2F7XqPZEDOkp7EYlesgbP3QvOHwrGA75RCRmGCkYt5vQiaDM%2F6Ya1SMp%2B0hSKoL1CaVam1YNyC2eUiph32Ag6cicueJ5xp%2Bg%3D%3D"));for(let A of["acos","asin","atan","atan2","cos","exp","log","sin","tan","pow"])g.env[A]=Math[A];for(let A=9;A<64;++A)g.env["reserved"+A]=()=>{};for(let A=0;A<16;++A)g.env["g_reserved"+A]=0;F=I(F);let h=await w(A("data:;base64,AnevpqDvapimRNPOGhqee07n%2Bv1yTm1n5XES6y7%2BqPUQFqw5livsDo%2Fkram7E1zzZg6qmLzXsUswfnD9AZjEuJOrUjm2TzbQ%2BWO1hv6bvL0OA5NLPFH8ZGmL%2BQuU9%2BzJKrrbrtlCG5CF9XtS0Line truncated
|
||||
@@ -9,6 +9,9 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="uw8">
|
||||
<a href="https://exoticorn.github.io/microw8">MicroW8</a> 0.1.0
|
||||
</div>
|
||||
<div id="centered">
|
||||
<canvas id="screen" width="320" height="240"></canvas>
|
||||
<div id="message"></div>
|
||||
|
||||
+9
-5
@@ -16,15 +16,19 @@ body {
|
||||
grid-template-rows: 1fr 0fr;
|
||||
}
|
||||
|
||||
#uw8 {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
#uw8 a {
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
#centered {
|
||||
align-self: center;
|
||||
justify-self: center;
|
||||
}
|
||||
|
||||
.footer {
|
||||
color: #202420;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #303630;
|
||||
}
|
||||
@@ -69,7 +73,7 @@ button:active {
|
||||
background-color: #504450;
|
||||
}
|
||||
|
||||
@media (min-width: 680px) and (min-height: 560px) {
|
||||
@media (min-width: 680px) and (min-height: 620px) {
|
||||
#screen {
|
||||
width: 640px;
|
||||
height: 480px;
|
||||
|
||||
Reference in new issue
Block a user