Files
Andreas T Jonsson fc6c3fb473 fix(web,libretro): align default video adapter and CPU speed across builds
Web UI: video button defaulted to EGA in HTML/JS while the runtime
defaults to CGA, leaving the label out of sync at page load (first click
was a silent no-op). Fixed by setting `videoState = 'CGA'`, the button
label to `Video: CGA`, and reordering the cycle to `['CGA', 'HGC', 'EGA']`.
Added a `Turbo` toggle (`Turbo: 4.77` default / `Turbo: 10.0`)
live-applied via new `wasm_set_turbo` and the existing `?cpu=4.77` /
`?cpu=10` URL parameter.

Libretro: default CPU speed was 10 MHz (turbo enabled). Now defaults to
4.77 MHz (turbo disabled) to match the web build. Descriptor at
`core.c:743` swapped to `disabled|enabled`; fall-through default at
`core.c:1399` set to `CPU_FREQ_477`. First-time installs see the new
default; existing users keep their saved option. The RPi bare-metal
build inherits the new default because its env callback returns false
for `GET_VARIABLE`.

docs/STATUS.md: added entries and consolidated the Boot Diagnostics /
Gotchas / EGA Notes / Known Limitations sections into a unified Notes
section.
2026-06-10 10:10:50 +02:00

77 lines
3.0 KiB
Makefile

# VirtualXT -- Web frontend Makefile
#
# Builds a standalone web frontend using Emscripten.
# The emulator core (src/frontend/core.c) is compiled unchanged;
# this Makefile only adds tools/web/main.c as the libretro host glue.
#
# Usage:
# make -C tools/web
# or from project root:
# make web
CC = emcc
AR = emar
CFLAGS = -std=gnu11 -Wall -Wextra -Wpedantic -I../../src -I../../tools/libretro -O2
EMFLAGS = -s WASM=1 \
-s MODULARIZE=1 \
-s EXPORT_NAME="VirtualXTModule" \
-s ALLOW_MEMORY_GROWTH=1 \
-s NO_EXIT_RUNTIME=1 \
-s INITIAL_MEMORY=33554432 \
-s EXPORTED_FUNCTIONS='["_wasm_initialize","_wasm_run","_wasm_send_key","_wasm_send_mouse","_wasm_create_vfs_file","_wasm_mount_disk","_wasm_load_hd","_wasm_framebuffer_ptr","_wasm_framebuffer_width","_wasm_framebuffer_height","_wasm_framebuffer_pitch","_wasm_audio_read","_wasm_disk_led_active","_wasm_set_options","_wasm_string_alloc","_wasm_string_free","_wasm_set_crt","_wasm_set_noise","_wasm_set_video","_wasm_set_turbo","_wasm_reset","_wasm_reload","_wasm_hostfs_clear","_wasm_hostfs_add_file","_wasm_hostfs_set_root","_wasm_hostfs_set_launch_path","_malloc","_free"]' \
-s EXPORTED_RUNTIME_METHODS='["ccall","cwrap","HEAPU8"]'
CORE_SRCS := ../../src/utils/utils.c \
../../src/vxt/peripheral.c ../../src/vxt/cpu.c ../../src/vxt/alu.c \
../../src/vxt/div.c ../../src/vxt/machine.c ../../src/vxt/cpu_v20.c \
../../src/vxt/cpu_cycles.c ../../src/vxt/cpu_remap.c \
../../src/modules/module_table.c \
../../src/modules/rom/rom.c ../../src/modules/disk/disk.c \
../../src/modules/chipset/chipset.c ../../src/modules/chipset/pic.c \
../../src/modules/chipset/pit.c ../../src/modules/chipset/dma.c \
../../src/modules/chipset/ppi.c \
../../src/modules/cga/cga.c \
../../src/modules/ega/ega.c \
../../src/modules/hgc/hgc.c \
../../src/modules/uart/uart.c \
../../src/modules/mouse/mouse.c \
../../src/modules/joystick/joystick.c \
../../src/modules/hostfs/hostfs.c \
../../src/modules/ems/ems.c \
../../src/modules/rtc/rtc.c
FRONT_SRCS := ../../src/frontend/core.c \
../../src/frontend/ini.c \
../../src/frontend/crt.c \
../../src/frontend/audio_mixer.c
WEB_SRCS := main.c
SRCS := $(CORE_SRCS) $(FRONT_SRCS) $(WEB_SRCS)
# Build objects in a local build/ dir to avoid conflicts with root Makefile
BUILD_DIR := build
OBJS := $(patsubst %.c,$(BUILD_DIR)/%.o,$(notdir $(SRCS)))
# VPATH lets make find source files by basename
VPATH := $(sort $(dir $(SRCS)))
OUT_JS := virtualxt.js
OUT_WASM:= virtualxt.wasm
.PHONY: all clean
all: $(OUT_JS)
$(OUT_JS): $(OBJS)
$(CC) $(EMFLAGS) -o $@ $(OBJS)
$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)
$(CC) $(CFLAGS) -c -o $@ $<
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
clean:
rm -rf $(BUILD_DIR) $(OUT_JS) $(OUT_WASM)