Hi everyone, I’m trying to run js-dos (dosbox) using JSPI instead of Asyncify.
Currently the project uses Asyncify, and throughout all of js-dos there is a single entry point for sleeping called asyncify_sleep. Simplified, it’s just a smart wrapper around emscripten_sleep.
I compile the WebAssembly with these flags:
-sASYNCIFY=1
-sASYNCIFY_WHITELIST=@${TARGETS_DIR}/dosbox-asyncify.txt
With these flags everything works correctly.
To switch to JSPI, I replace them with:
-sJSPI=1
-fwasm-exceptions
For debugging I also add:
--profiling-funcs
-sASSERTIONS=2
The build succeeds, but execution fails with the following error:
SuspendError: trying to suspend without WebAssembly.promising
at wdosbox.wasm.asyncify_sleep (wdosbox.wasm-0070883a:0xaa96)
at wdosbox.wasm.Normal_Loop() (wasm://wasm/wdosbox.wasm-0070883a)
at wdosbox.wasm.DOSBOX_RunMachine() (wasm://wasm/wdosbox.wasm-0070883a)
at wdosbox.wasm.CALLBACK_RunRealInt(unsigned char) (wasm://wasm/wdosbox.wasm-0070883a)
at wdosbox.wasm.device_CON::Read(unsigned char*, unsigned short*) (wasm://wasm/wdosbox.wasm-0070883a)
at wdosbox.wasm.DOS_Device::Read(unsigned char*, unsigned short*) (wasm://wasm/wdosbox.wasm-0070883a)
at wdosbox.wasm.DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool) (wasm://wasm/wdosbox.wasm-0070883a)
at wdosbox.wasm.DOS_Shell::InputCommand(char*) (wasm://wasm/wdosbox.wasm-0070883a)
at wdosbox.wasm.DOS_Shell::Run() (wasm://wasm/wdosbox.wasm-0070883a)
at wdosbox.wasm.SHELL_Init() (wasm://wasm/wdosbox.wasm-0070883a)
Emscripten version:emcc 4.0.21-git (7f262d85168927a47c014f2e5f636482d54c9199)
I also verified that the browser supports JSPI:
Chrome 142.0.7444.162 / Ubuntu 25.10
typeof WebAssembly.promising → 'function'