From 2f08c6893cf3e161282ed02c1cd4112db455b5d4 Mon Sep 17 00:00:00 2001 From: zongor Date: Sun, 21 Sep 2025 12:50:05 -0700 Subject: [PATCH] Fix hello.asm.lisp, update others --- Makefile | 20 ++++++++++---------- bench/run.sh | 4 ++-- test/add.asm.lisp | 2 +- test/fib.asm.lisp | 2 +- test/hello.asm.lisp | 8 ++++---- test/loop.asm.lisp | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index db75a2b..f5b35fe 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # --- CONFIGURABLE DEFAULTS --- PLATFORM ?= linux -BUILD_MODE ?= debug # 'debug' or 'deploy' +BUILD_MODE ?= debug # 'debug' or 'release' # --- DIRECTORIES --- SRC_DIR := src @@ -24,7 +24,7 @@ CORE_CFLAGS := $(BASE_CFLAGS) -std=c89 -ffreestanding -nostdlib -fno-builtin PLATFORM_CFLAGS := $(BASE_CFLAGS) # --- MODE & PLATFORM SPECIFIC FLAGS --- -ifeq ($(BUILD_MODE), deploy) +ifeq ($(BUILD_MODE), release) CORE_CFLAGS += -O2 -DNDEBUG PLATFORM_CFLAGS += -O2 -DNDEBUG LDFLAGS += -s @@ -49,8 +49,8 @@ ifeq ($(PLATFORM), emscripten) PLATFORM_CFLAGS += -s USE_SDL=2 -s WASM=1 LDFLAGS += -s USE_SDL=2 -s WASM=1 - # For deploy: optimize, strip debug, minimize size - ifeq ($(BUILD_MODE), deploy) + # For release: optimize, strip debug, minimize size + ifeq ($(BUILD_MODE), release) PLATFORM_CFLAGS += -O2 LDFLAGS += -O2 --closure 1 else @@ -74,7 +74,7 @@ VM_SOURCES := \ $(SRC_DIR)/vm/device.c \ $(SRC_DIR)/vm/str.c -ifeq ($(BUILD_MODE), deploy) +ifeq ($(BUILD_MODE), release) PLATFORM_SOURCE := $(ARCH_DIR)/main.c \ $(ARCH_DIR)/devices.c else @@ -91,7 +91,7 @@ PLATFORM_OBJ := $(PLATFORM_SOURCE:$(SRC_DIR)/%.c=$(BUILD_DIR)/%.o) # --- DEPENDENCIES --- DEPS := $(VM_OBJS:.o=.d) $(PLATFORM_OBJ:.o=.d) -.PHONY: all debug deploy clean clean-all help +.PHONY: all debug release clean clean-all help # Default target all: $(TARGET) @@ -100,9 +100,9 @@ all: $(TARGET) debug: BUILD_MODE = debug debug: $(TARGET) -# 'deploy' target — just set BUILD_MODE and build -deploy: BUILD_MODE = deploy -deploy: $(TARGET) +# 'release' target — just set BUILD_MODE and build +release: BUILD_MODE = release +release: $(TARGET) # --- COMPILE VM CORE (freestanding) --- $(BUILD_DIR)/vm/%.o: $(SRC_DIR)/vm/%.c @@ -149,7 +149,7 @@ help: @echo "Targets:" @echo " make -> debug build (default: linux)" @echo " make debug -> same as above" - @echo " make deploy -> optimized, stripped build" + @echo " make release -> optimized, stripped build" @echo " make clean -> clean current platform" @echo " make clean-all→ clean all platforms" @echo "" diff --git a/bench/run.sh b/bench/run.sh index 3b30e41..999d536 100755 --- a/bench/run.sh +++ b/bench/run.sh @@ -41,5 +41,5 @@ print_section "zre ($FILENAME.t.ul)" echo "test input" | time ../build/old/zre -t "$FILENAME.ul" # Undâr Implementation -#print_section "zre ($FILENAME.asm.lisp)" -# echo "test input" | time ../build/linux/zre-linux-release "../test/$FILENAME.asm.lisp" +print_section "undar ($FILENAME.asm.lisp)" +echo "test input" | time ../build/linux/undar-linux-release "../test/$FILENAME.asm.lisp" diff --git a/test/add.asm.lisp b/test/add.asm.lisp index 3da0459..4d3c9c4 100644 --- a/test/add.asm.lisp +++ b/test/add.asm.lisp @@ -6,7 +6,7 @@ (call &add) (pop $0) (int-to-string $1 $0) - (load $3 &terminal-str) + (load-immediate $3 &terminal-str) (string-length $2 $1) (syscall DEVICE-WRITE $3 $1 $2) (halt)) diff --git a/test/fib.asm.lisp b/test/fib.asm.lisp index 606b3ec..634e1d6 100644 --- a/test/fib.asm.lisp +++ b/test/fib.asm.lisp @@ -5,7 +5,7 @@ (call &fib) (pop $0) (int-to-string $1 $0) - (load $2, &terminal-str) + (load-immediate $2, &terminal-str) (string-length $4, $3) (syscall DEVICE-WRITE, $2, $1, $4) (halt)) diff --git a/test/hello.asm.lisp b/test/hello.asm.lisp index 0ba4237..6624d7b 100644 --- a/test/hello.asm.lisp +++ b/test/hello.asm.lisp @@ -1,10 +1,10 @@ ((code (label main - (load $0 &terminal-str) - (load $1 &hello-str) + (load-immediate $0 &terminal-str) + (load-immediate $1 &hello-str) (string-length $2 $1) - (syscall DEVICE_WRITE $0 $1 $2) - (load $3 &new-line) + (syscall DEVICE-WRITE $0 $1 $2) + (load-immediate $3 &new-line) (string-length $4 $3) (syscall DEVICE-WRITE $0 $3 $4) (halt))) diff --git a/test/loop.asm.lisp b/test/loop.asm.lisp index e82f08f..c1e18de 100644 --- a/test/loop.asm.lisp +++ b/test/loop.asm.lisp @@ -11,7 +11,7 @@ (add-int $1 $1 $3) (jump-gt-eq-int $4 $1 $2) (real-to-nat $1 $0) - (load $6 &terminal-str) + (load-immediate $6 &terminal-str) (load $7 &help) (string-length $8 $7) (syscall DEVICE-WRITE $6 $7 $8)