diff --git a/bin/makefile-emscripten.wasm-wasm b/bin/makefile-emscripten.wasm-wasm index 2007eec..f092375 100644 --- a/bin/makefile-emscripten.wasm-wasm +++ b/bin/makefile-emscripten.wasm-wasm @@ -1,6 +1,6 @@ # Options for Emscripten, WASM and SDL -CC = emcc -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH $(CLANG_CFLAGS) +CC = emcc $(CLANG_CFLAGS) XFILES = $(OBJECTDIR)sdl.o @@ -11,9 +11,9 @@ OPTFLAGS = -O2 -g3 DFLAGS = $(XFLAGS) -DRELEASE=351 LD = emcc -LDFLAGS = -sUSE_SDL=2 --preload-file $(SYSOUT)@full.sysout +LDFLAGS = -sUSE_SDL=2 -sASYNCIFY -sALLOW_MEMORY_GROWTH --preload-file $(SYSOUT)@full.sysout LDELDFLAGS = OBJECTDIR = ../$(RELEASENAME)/ -default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl.js +default : ../$(OSARCHNAME)/ldesdl.js diff --git a/emscripten.wasm/ldesdl.html b/src/lde.html similarity index 100% rename from emscripten.wasm/ldesdl.html rename to src/lde.html diff --git a/src/timer.c b/src/timer.c index 2cb14c2..08a5874 100644 --- a/src/timer.c +++ b/src/timer.c @@ -73,11 +73,6 @@ extern int ether_fd; extern DspInterface currentdsp; #endif /* XWINDOW */ -#ifdef MAIKO_OS_EMSCRIPTEN -/* We can't touch the system clock */ -#define settimeofday(tv, tz) -#endif - #define LISP_UNIX_TIME_DIFF 29969152 #define LISP_ALTO_TIME_MASK 0x80000000 #define UNIX_ALTO_TIME_DIFF 2177452800U @@ -293,6 +288,8 @@ void subr_settime(LispPTR args[]) dosday.year = uxtime.tm_year; dosday.dayofweek = uxtime.tm_wday; _dos_setdate(&dosday); +#elif defined(MAIKO_OS_EMSCRIPTEN) + (void)args[0]; #else struct timeval timev; timev.tv_sec = *((int *)NativeAligned4FromLAddr(args[0])) - UNIX_ALTO_TIME_DIFF; diff --git a/src/unixfork.c b/src/unixfork.c index 929e4d4..366495f 100644 --- a/src/unixfork.c +++ b/src/unixfork.c @@ -45,11 +45,6 @@ int flushing = 0; #endif -#ifdef MAIKO_OS_EMSCRIPTEN -/* We don't have any shell */ -#define getusershell() NULL -#endif - /* Used to communicate between Unix subprocesses and LISP */ static long StartTime; /* Time, for creating pipe filenames */ diff --git a/src/xc.c b/src/xc.c index 644e00d..907b16b 100644 --- a/src/xc.c +++ b/src/xc.c @@ -20,6 +20,9 @@ /* */ /************************************************************************/ +#ifdef MAIKO_OS_EMSCRIPTEN +#include +#endif #include #include #include @@ -33,10 +36,6 @@ #include #endif /* DOS */ -#ifdef __EMSCRIPTEN__ -#include /* Defines emscripten_sleep */ -#endif /* __EMSCRIPTEN__ */ - #include "lispemul.h" #include "emlglob.h" #include "address.h" @@ -187,9 +186,6 @@ static int pseudoTimerAsyncCountdown = MAIKO_TIMER_ASYNC_EMULATION_INSNS_COUNTDO void dispatch(void) { InstPtr pccache; -#ifdef __EMSCRIPTEN__ - int cycles = 0; -#endif #if defined(OPDISP) static const void* optable[256] = { @@ -268,9 +264,6 @@ op_ufn : { /* DISPATCH "LOOP" */ nextopcode: -#ifdef __EMSCRIPTEN__ - if (++cycles % 1000000 == 0) emscripten_sleep(1); -#endif #ifdef MYOPTRACE if ((struct fnhead *)NativeAligned4FromLAddr(0x2ed600) == FuncObj) { quick_stack_check(); @@ -296,6 +289,9 @@ nextopcode: Irq_Stk_End = 0; #if defined(MAIKO_EMULATE_ASYNC_INTERRUPTS) IO_Signalled = TRUE; +#endif +#ifdef MAIKO_OS_EMSCRIPTEN + emscripten_sleep(1); #endif pseudoTimerAsyncCountdown = insnsCountdownForTimerAsyncEmulation; }