From eded8b60b7a2626281bce8de5c5497dcb88b473f Mon Sep 17 00:00:00 2001 From: Jason Hilder Date: Thu, 25 Jun 2026 06:24:24 +0200 Subject: [PATCH] Updated main to be wasm friendly. Updated code to use an init, update, shutdown and should_run proc. To get it ready to use wasm for the web build requires this structure. --- src/{ => main_desktop}/main.odin | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) rename src/{ => main_desktop}/main.odin (76%) diff --git a/src/main.odin b/src/main_desktop/main.odin similarity index 76% rename from src/main.odin rename to src/main_desktop/main.odin index bcca549..693700d 100644 --- a/src/main.odin +++ b/src/main_desktop/main.odin @@ -3,8 +3,8 @@ package main import "core:log" import "core:mem" -import emu "machine" -import sim "simulator" +import emu "../machine" +import sim "../simulator" DEV :: #config(DEV, false) @@ -22,9 +22,22 @@ main :: proc() { // Init the emu 8 "cpu" system := emu.init() + s := sim.Simulator { + machine = &system, + rom_loaded = false, + paused = true, + step = false, + cpu_hz = 700, + disasm_follow = true, + } - // Initilize sim, gui etc - sim.run_simulator(&system) + sim.init(&s) + + for sim.should_run() { + sim.update(&s) + } + + sim.shutdown(&s) when DEV { if len(track.allocation_map) > 0 {