mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
fix isButtonTriggered in web runtime, release v0.1pre4
This commit is contained in:
Binary file not shown.
@@ -230,6 +230,13 @@ global mut bgColor = 0;
|
|||||||
global mut graphicsText = 0;
|
global mut graphicsText = 0;
|
||||||
|
|
||||||
export fn printChar(char: i32) {
|
export fn printChar(char: i32) {
|
||||||
|
loop chars {
|
||||||
|
printSingleChar(char & 255);
|
||||||
|
branch_if (char := char #>> 8): chars;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn printSingleChar(char: i32) {
|
||||||
if char == 4 | char == 5 {
|
if char == 4 | char == 5 {
|
||||||
graphicsText = char == 5;
|
graphicsText = char == 5;
|
||||||
return;
|
return;
|
||||||
@@ -238,6 +245,15 @@ export fn printChar(char: i32) {
|
|||||||
if char == 10 | (!graphicsText & textCursorX >= 320) {
|
if char == 10 | (!graphicsText & textCursorX >= 320) {
|
||||||
textCursorX = 0;
|
textCursorX = 0;
|
||||||
textCursorY = textCursorY + 8;
|
textCursorY = textCursorY + 8;
|
||||||
|
if !graphicsText & textCursorY >= 240 {
|
||||||
|
textCursorY = 240 - 8;
|
||||||
|
let i: i32;
|
||||||
|
loop scroll_copy {
|
||||||
|
i!120 = i!(120 + 320 * 8);
|
||||||
|
branch_if (i := i + 4) < 320 * (240 - 8): scroll_copy;
|
||||||
|
}
|
||||||
|
rectangle(0 as f32, (240 - 8) as f32, 320 as f32, 8 as f32, bgColor);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
* [v0.1pre1](v0.1pre1)
|
* [v0.1pre1](v0.1pre1)
|
||||||
* [v0.1pre2](v0.1pre2)
|
* [v0.1pre2](v0.1pre2)
|
||||||
* [v0.1pre3](v0.1pre3)
|
* [v0.1pre3](v0.1pre3)
|
||||||
|
* [v0.1pre4](v0.1pre4)
|
||||||
|
|
||||||
## Spec
|
## Spec
|
||||||
|
|
||||||
@@ -40,6 +41,7 @@ Other imports provided by the platform, also all in module `env`:
|
|||||||
* `fn hline(left: i32, right: i32, y: i32, color: i32)`
|
* `fn hline(left: i32, right: i32, y: i32, color: i32)`
|
||||||
* `fn rectangle(x1: f32, y1: f32, x2: f32, y2: f32, color: i32)`
|
* `fn rectangle(x1: f32, y1: f32, x2: f32, y2: f32, color: i32)`
|
||||||
* `fn circle(cx: f32, cy: f32, radius: f32, color: i32)`
|
* `fn circle(cx: f32, cy: f32, radius: f32, color: i32)`
|
||||||
|
* `fn line(x1: f32, y1: f32, x2: f32, y2: f32, color: i32)`
|
||||||
|
|
||||||
* `fn time() -> f32`
|
* `fn time() -> f32`
|
||||||
* `fn isButtonPressed(btn: i32) -> i32`
|
* `fn isButtonPressed(btn: i32) -> i32`
|
||||||
@@ -48,6 +50,9 @@ Other imports provided by the platform, also all in module `env`:
|
|||||||
* `fn printChar(char: i32)`
|
* `fn printChar(char: i32)`
|
||||||
* `fn printString(ptr: i32)`
|
* `fn printString(ptr: i32)`
|
||||||
* `fn printInt(num: i32)`
|
* `fn printInt(num: i32)`
|
||||||
|
* `fn setTextColor(color: i32)`
|
||||||
|
* `fn setBackgroundColor(color: i32)`
|
||||||
|
* `fn setCursorPosition(x: i32, y: i32)`
|
||||||
|
|
||||||
### Memory map
|
### Memory map
|
||||||
|
|
||||||
@@ -85,7 +90,7 @@ types with up to 5 parameters (i32 or f32) where the
|
|||||||
`f32` parameters always preceed the `i32` parameters.
|
`f32` parameters always preceed the `i32` parameters.
|
||||||
Then it includes all imports that MicroW8 provides,
|
Then it includes all imports that MicroW8 provides,
|
||||||
a function section with a single function of type
|
a function section with a single function of type
|
||||||
`(i32) -> void` and an export section that exports
|
`() -> void` and an export section that exports
|
||||||
the first function in the file under the name `upd`.
|
the first function in the file under the name `upd`.
|
||||||
|
|
||||||
#### Format version `02`:
|
#### Format version `02`:
|
||||||
@@ -111,9 +116,10 @@ Writing code for MicroW8 in C, Rust, AssemblyScript etc. should absolutely
|
|||||||
possible but no examples are provided, yet.
|
possible but no examples are provided, yet.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
* [Skip Ahead](v0.1pre3#Agj9nQYWw+yYP6xi7SUL2urlNtvh2dOZFuYL4PUxAUz5qqATDey0JsAVat2VQKEOyXK1bE+3WiFK0GGhdi4VAd8Tlf3YuU7xfvvBwN4oNuIoY29jbbuEnEnPZFjC4ym9L2QDUmig+RsF++FubWcyqOt7CAFGNEaAiMISCIM43bfPQriE6sD3orstkMjH3LPOqeuUPpitgzaIsAf860CYHlrAG2t5CSjRGobcPLJ+CSeYjzZSLYs7+u2xpthsfoIvBnk1+xxwEWYfZOJ3Madfo5BME5nceVCQVOEBMCTLSE+xVCkyelOW) (231 bytes): A port of my [TIC-80 256byte game](http://tic80.com/play?cart=1735) from LoveByte'21
|
* [Skip Ahead](v0.1pre4#AiP94km33q5hBFbBcKl2W1ZMY67wHByUz15/qRHIr71Dvq8bTVux/DXZzSTKU5MufRXxnGEn6mOul4dil/5WLT1Y+Y/4TGd1E3U4rQaxlpcKObxc5YLdr4xo6jyBND96a569LoECv6Q4EIqxJi+3QPE21r/++js41XsBLr44X/O2XpP3kHQva3B8o6duD5WkLCf7PhsxjTBeND1ADIaJe05JCrBim18RPY9VYFmltqQ9gVzbxE/ZpojR/GJ4aCbx0hRn73RPhpA7Cd4jk0AVSOeRx+7kuHrLzpaeqeYWK5pYd/4Rv+8=) (230 bytes): A port of my [TIC-80 256byte game](http://tic80.com/play?cart=1735) from LoveByte'21
|
||||||
* [OhNoAnotherTunnel](v0.1pre3#Apr9u4e6Rsy7tRABjq4o7dCGPLQR9dVTSGK9FWXemB7tybsZHT+TxtfHlarRbcekGcg7qZY/eK6/VVCp9ceNBXlh4v0QGS63LTzfEjb8XC4jg5KifbYBodSIS0DPVjwq32PbgjL2+C+QOCx6ZxqRYP0KQpcTxuBUKx1NXVM2EV4l0rEWBQW9SjLcbURKHYaRLcI4FOcLOfASFiQ4wFWgEBA0VD6hGdemN0tPYp9BfUaN) (177 bytes): A port of my [entry](http://tic80.com/play?cart=1871) in the Outline'21 bytebattle final
|
* [OhNoAnotherTunnel](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](v0.1pre3#AkL/tETJ+XRrvcB8gD9brftZ26zjwEsiATnAd+szCtw3Haq41srEMFO8aDS71c2CX8W87RQ9EY3V+YuTn/2CPRfn6CpgxMHUnIxOEWhVDRULXeYGP70dTiL8tYLAc8LrBWay9h8jCX/4Jbb39XVnISlZNd7In4Mts9LvSkSIz/E0sBfhjwp65aeoSU8BNFZpyKlxU+u5DdBtuxx3bFE=) (158 bytes): A port of my [entry](https://tic80.com/play?cart=1873) in the Outline'21 bytebattle quater final
|
* [Technotunnel](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
|
||||||
|
* [Font & Palette](v0.1pre4#AgKaeeOuwg5gCKvFIeiitEwMpUI2rymEcu+DDB1vMu9uBoufvUxIr4Y5p4Jj2ukoNO4PE7QS5cN1ZyDMCRfSzYIGZxKlN2J6NKEWK7KVPk9wVUgn1Ip+hsMinWgEO8ETKfPuHoIa4kjI+ULFOMad7vd3rt/lh1Vy9w+R2MXG/7T61d3c7C6KY+eQNS0eW3ys4iU8R6SycuWZuuZ2Sg3Qxp826s+Kt+2qBojpzNOSoyFqyrVyYMTKEkSl0BZOj59Cs1hPm5bq0F1MmVhGAzMhW9V4YeAe): Just a simple viewer for the default font and palette.
|
||||||
* [Technotunnel B/W](v0.1pre2#AQrDAQHAAQIBfwp9A0AgAUEAsiABQcACb7JDmhkgQ5MiBCAEIASUIAFBwAJtQfgAa7IiBSAFlJKRIgaVIgcgByAAskHQD7KVIgIQAEPNzEw/lCIDlCAHIAeUIAOUIAOUQQGykiADIAOUk5GSIgiUIAOTQQqylCACkiIJqCAFIAaVIAiUQQqylCACkiIKqHMgCEEyspQgBpUiCyACkkEUspSocUEFcbJBArIgC5OUQRaylJeoOgB4IAFBAWoiAUGA2ARIDQALCw==) (199 bytes uncompressed): A port of my [entry](https://tic80.com/play?cart=1873) in the Outline'21 bytebattle quater final (older MicroW8 version with monochrome palette)
|
* [Technotunnel B/W](v0.1pre2#AQrDAQHAAQIBfwp9A0AgAUEAsiABQcACb7JDmhkgQ5MiBCAEIASUIAFBwAJtQfgAa7IiBSAFlJKRIgaVIgcgByAAskHQD7KVIgIQAEPNzEw/lCIDlCAHIAeUIAOUIAOUQQGykiADIAOUk5GSIgiUIAOTQQqylCACkiIJqCAFIAaVIAiUQQqylCACkiIKqHMgCEEyspQgBpUiCyACkkEUspSocUEFcbJBArIgC5OUQRaylJeoOgB4IAFBAWoiAUGA2ARIDQALCw==) (199 bytes uncompressed): A port of my [entry](https://tic80.com/play?cart=1873) in the Outline'21 bytebattle quater final (older MicroW8 version with monochrome palette)
|
||||||
* [XorScroll](v0.1pre2#AQovAS0BAX8DQCABIAFBwAJvIABBCm1qIAFBwAJtczoAeCABQQFqIgFBgNgESA0ACws=) (50 bytes uncompressed): A simple scrolling XOR pattern. Fun fact: This is the pre-loaded effect when entering a bytebattle.
|
* [XorScroll](v0.1pre2#AQovAS0BAX8DQCABIAFBwAJvIABBCm1qIAFBwAJtczoAeCABQQFqIgFBgNgESA0ACws=) (50 bytes uncompressed): A simple scrolling XOR pattern. Fun fact: This is the pre-loaded effect when entering a bytebattle.
|
||||||
* [CircleWorm](v0.1pre2#AQp7AXkCAX8CfUEgEA0DQCABskEEspUiAkECspUgALJBiCeylSIDQQWylJIQAEEBspJBoAGylCACQQOylSADQQSylJIQAEEBspJB+ACylCADQRGylCACQQKylJIQAEECspJBELKUIAFBAmxBP2oQEiABQQFqIgFBP0gNAAsL) (126 bytes uncompressed): Just a test for the circle fill function.
|
* [CircleWorm](v0.1pre2#AQp7AXkCAX8CfUEgEA0DQCABskEEspUiAkECspUgALJBiCeylSIDQQWylJIQAEEBspJBoAGylCACQQOylSADQQSylJIQAEEBspJB+ACylCADQRGylCACQQKylJIQAEECspJBELKUIAFBAmxBP2oQEiABQQFqIgFBP0gNAAsL) (126 bytes uncompressed): Just a test for the circle fill function.
|
||||||
1
site/static/v0.1pre4/index.html
Normal file
1
site/static/v0.1pre4/index.html
Normal file
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
|||||||
<section>
|
<section>
|
||||||
<h1 class="text-center heading-text">A WebAssembly based sizecoding platform</h1>
|
<h1 class="text-center heading-text">A WebAssembly based sizecoding platform</h1>
|
||||||
</section>
|
</section>
|
||||||
<a href="v0.1pre3">
|
<a href="v0.1pre4">
|
||||||
<div class="demonstration-gif" style="width:640px;height:512px;background-color:black"></div>
|
<div class="demonstration-gif" style="width:640px;height:512px;background-color:black"></div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ async function runModule(data) {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
let instantiate = async (data) => new WebAssembly.Instance(await WebAssembly.compile(data), importObject);
|
let instantiate = async (data) => (await WebAssembly.instantiate(data, importObject)).instance;
|
||||||
|
|
||||||
let loadModuleURL = async (url) => instantiate(loadModuleData(await (await fetch(url)).arrayBuffer()));
|
let loadModuleURL = async (url) => instantiate(loadModuleData(await (await fetch(url)).arrayBuffer()));
|
||||||
|
|
||||||
@@ -194,6 +194,7 @@ async function runModule(data) {
|
|||||||
u32Mem[16] = now - startTime;
|
u32Mem[16] = now - startTime;
|
||||||
u32Mem[17] = pad | gamepad;
|
u32Mem[17] = pad | gamepad;
|
||||||
instance.exports.upd();
|
instance.exports.upd();
|
||||||
|
platform_instance.exports.endFrame();
|
||||||
|
|
||||||
let palette = U32(memory.buffer.slice(0x13000, 0x13000 + 1024));
|
let palette = U32(memory.buffer.slice(0x13000, 0x13000 + 1024));
|
||||||
for (let i = 0; i < 320 * 240; ++i) {
|
for (let i = 0; i < 320 * 240; ++i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user