diff --git a/src/run-web.html b/src/run-web.html
index ad2e9c9..50d0cb7 100644
--- a/src/run-web.html
+++ b/src/run-web.html
@@ -1 +1 @@
-
uw8-run
\ No newline at end of file
+uw8-run
\ No newline at end of file
diff --git a/src/run_native.rs b/src/run_native.rs
index 41cb5da..a9a982d 100644
--- a/src/run_native.rs
+++ b/src/run_native.rs
@@ -134,6 +134,10 @@ impl super::Runtime for MicroW8 {
let end_frame = platform_instance.get_typed_func::<(), ()>(&mut store, "endFrame")?;
let update = instance.get_typed_func::<(), ()>(&mut store, "upd").ok();
+ if let Some(start) = instance.get_typed_func::<(), ()>(&mut store, "start").ok() {
+ start.call(&mut store, ())?;
+ }
+
let (sound_tx, stream) = if self.disable_audio {
(None, None)
} else {
diff --git a/test/start_fn.cwa b/test/start_fn.cwa
new file mode 100644
index 0000000..6f9edf3
--- /dev/null
+++ b/test/start_fn.cwa
@@ -0,0 +1,5 @@
+include "../examples/include/microw8-api.cwa"
+
+export fn start() {
+ printChar('Test');
+}
diff --git a/web/src/microw8.js b/web/src/microw8.js
index 6f8e2bf..dcdc845 100644
--- a/web/src/microw8.js
+++ b/web/src/microw8.js
@@ -263,6 +263,10 @@ export default function MicroW8(screen, config = {}) {
window.addEventListener('blur', () => updateVisibility(false), { signal: abortController.signal });
updateVisibility(document.hasFocus());
+ if (instance.exports.start) {
+ instance.exports.start();
+ }
+
function mainloop() {
if (!keepRunning) {
return;