cord8/cord16 unified into one CORD_DEFINE X-macro template with two
instantiations; the rewrite also eliminates the do-nothing else
branches and redundant temporaries from the CORD loops.
negate8/negate16 unified into cord_negate() (width-mask
parameterized); POSTIDIV factored into v20_divide_error_flags() and
postidiv_fix_signs(). The four DIV/IDIV exec handlers are generated
from EXEC_DIV_DEFINE/EXEC_IDIV_DEFINE templates. Magic cycle costs
(80/101/144/165) are named constants.
div.c: 477 -> 291 lines. Verified flag- and cycle-exact against all
635 MOO test files (8088 + V20).
CPU: V20 bit manipulation consolidated from 16 templated handlers into
one parameterized do_bitop() with 16 one-line thunks and a 16-entry
dispatch table.
Video: new shared modules/video_common.h -- crtc_cursor_t embedded in
CGA/EGA/HGC, crtc_cursor_write(), crtc_blink_tick(),
video_attach_frontend(); EGA write modes 0-2 share ega_write_plane().
Tests: setup_pic_machine() fixture collapses 11 test_pic.c sites;
make_ems/make_rtc wrappers inlined.
Frontend: retro_load_game() split into setup_host_interfaces(),
register_disk_control(), and setup_content().
Debug server: table-driven command dispatch with exact cmd matching
(was a 24-branch substring if-chain); run_cycles() reuses
vxt_machine_step(); JSON list handlers use first-flags.
Consistency: unhandled I/O port reads return 0xFF (open bus) across
PIC/PPI/CGA/HGC/EGA; VXT_FLAG_8088_RESERVED renamed to
VXT_FLAG_RESERVED_HIGH; PPI keyboard queue converted to a ring buffer;
machine_step accumulation contract documented; stale comments
refreshed (Odin references, EGA DIP default, cpu_cycles semantics).
Bug fixes:
- pic: honor auto-EOI mode (ICW4 bit 1); ISR bit now only set when
auto-EOI is disabled (previously set unconditionally)
- spec: correct port 0xB0-in polarity (0x00 = hard disk, 0xFF = floppy)
to match both the Odin and C implementations
- debug: gate cga_regs/cga_vram handlers on the video adapter actually
being CGA (returned garbage when EGA/HGC was active)
Dead code removal:
- unused public APIs: vxt_cpu_flush_prefetch, vxt_bus_set_pic,
vxt_uart_registers, vxt_uart_set_error, vxt_disk_bootstrap
- write-only CPU instruction-stream fields + MAX_INSTRUCTION_SIZE
- unused macros VXT_CPU_USE_PREFETCH, MBOX_TOTAL_SIZE
- debug server: g_active_server, single_step, last_segments, SEG_TAG_*
- UART iir field, always-false ega_config stub, empty destroy stubs
(joystick, UART, mouse), exec_wait/exec_esc folded into exec_nop
- frontend: BIOS_ROM_BASE/VXTX_ROM_BASE, mixer HOSTFS_DURATION/
HOSTFS_VOLUME/seek_volume, unreachable clamps, ini_parse return value
- misc dead stores/clamps (hostfs, hgc), dangling comment (cpu.c)
Makefile: drop 12 redundant pattern rules, replace dead check-circle
test with a real compiler check, drop duplicated distclean line,
complete .PHONY, collapse flag lists, develop honors LIBRETRO_OUT.
STATUS.md: correct stale module test counts (110 -> 119).
Update display_version in virtualxt_libretro.info. The version flows
through tools/getversion/export.sh to:
- src/frontend/core.c (library_version reported to libretro frontends)
- tools/package/itch/push-{web,rpi,libretro}.sh (butler --userversion)
- the bare-metal Pi and web builds via the top-level Makefile.
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.
KeyStatusHandlerRaw in the Circle baremetal kernel dropped the
ucModifiers byte and sized the keyboard state arrays to 0x100 entries,
too small for libretro modifier keycodes (RETROK_LSHIFT=304, etc.).
As a result, holding Shift (or Ctrl/Alt) produced no XT scan code in
the shared frontend, so shifted key combinations never worked.
- Translate ucModifiers bits to RETROK_LCTRL/LSHIFT/LALT/RCTRL/RSHIFT/RALT
so the existing RETROK_LSHIFT -> 0x2A / RETROK_RSHIFT -> 0x36 mapping
in src/frontend/core.c fires correctly.
- Resize key_states/key_states_current and the dispatch / input_state
loops from 0x100 to RETROK_LAST so modifier and other high keycodes
fit and are not silently truncated.
- Add bounds guard for mapped raw keycodes.
Also stages long-pending packaging fixes in tools/package/rpi/package-rpi.sh
(Pi 4/5 KERNEL_MAX_SIZE bump, Pi 4 family DTBs, disable_splash, [pi400]
and [cm4] stanzas) and updates docs/STATUS.md.
Verified with 'make rpi' for Pi 3/4/5 and the new kernel images
written to /dev/sda1.
Replaces the synchronous Core 0 bridge with the guest-visible async
polling protocol that was proven working on Pi 3 USB floppy boot.
Core changes:
- Disk controller now handles VXT_DISK_NOT_READY from frontends
- Pending operation state tracks multi-sector transfers
- VXTX BIOS polls port 0xB1 and reads AL/AH from 0xB2/0xB3
- Added floppy_timing / harddrive_timing INI toggles
Circle frontend:
- vfs_read/vfs_write return VXT_DISK_NOT_READY for USB handles
- Core 0 processes blocking USB jobs via usb_disk_process()
- Core 1 BIOS polling loop runs without stalls
Docs:
- Added async completion protocol to SPEC.md
- Updated STATUS.md for verified Pi 3 USB floppy boot
Default Pi config remains safe (no USB passthrough enabled).
On POSTIDIV divide-error, V20 microcode pushes FLAGS where PSZ are
derived from the unsigned quotient byte/word and CF/AF/OF are cleared,
distinct from 8088 which reflects the last CORD subtract. Verified
against hardware-captured data: all 20000 IDIV tests now pass.
V20 MOO suite: 318/320 -> 320/320. CI workaround removed.
Changes:
- Fix V20 AAM divide-by-zero: V20 does not trigger INT 0 for AAM with
base=0, unlike 8088. Fixes v20/D4.MOO.
- Fix fetch.py sparse-checkout re-application on existing repos.
- Update CI to run module + 8088 tests strictly, but allow V20 test
failures with a warning. This makes CI green while we fix the
remaining 2 V20 IDIV failures (F6.7, F7.7).
- Update STATUS.md to document V20 test status and known failures.
Pi 3 bare-metal improvements:
- Offload CRT filter to Core 2 via CRT_FILTER_EXTERNAL compile flag.
Core 1 queues frames; Core 2 worker (RenderThread) processes
asynchronously with 1-frame latency. Trampoline pattern in crt.c/h.
- Add 4:3 letterboxed scaling on Core 2 render thread.
HW framebuffer created once at physical display resolution
(CBcmFrameBuffer auto-detect); largest centered 4:3 rect computed,
black bars cleared once, nearest-neighbor scale into target rect.
- Raise KERNEL_MAX_SIZE to 0x1400000 (20 MB) across Circle Config.mk,
kernel Makefile, and package-rpi.sh to accommodate ~19 MB .bss.
- Add vxt_peripheral_print_status() in src/vxt/peripheral.c that logs
CPU type (8088/V20), frequency, installed peripherals, IO map ranges,
and memory map ranges. Called from retro_load_game() in core.c.
Refs: docs/STATUS.md
Fix four critical issues preventing VirtualXT from booting on Raspberry Pi 3B+:
1. vfs_file_load was a stub returning NULL - implement real VFS-backed
loader using peripheral arena allocator
2. setup_machine_from_ini never wired disk.file_api - refactor to two
passes (instantiate + wire APIs, then configure)
3. Missing vfs_tell in Circle kernel - null pointer crash when disk
mount tried to get file size
4. Libretro VFS seek returns position, but disk module expects POSIX
0/-1 - add adapter in disk_file_seek
Also:
- Add NO_DEFAULT_DISK and NO_SAMPLES build flags for baremetal size
- Replace GLABIOS.ROM with vxtbios.bin in raspberrypi.ini
- Add package-rpi.sh packaging script with cmdline.txt LOGFILE support
- Raise KERNEL_MAX_SIZE to 17 MB for Circle sysinit
- Clean up kernel error handling (halt() instead of error_halt)
- Update STATUS.md with known bugs and recent changes
Replace the 80186 instruction set extension with full NEC V20 support:
- Rename cpu_186.c to cpu_v20.c and add cpu_cycles.c/h for per-CPU
cycle lookup tables indexed by opcode
- Change CPU type from bitmask options to vxt_cpu_type_t enum
(VXT_CPU_8088 / VXT_CPU_V20)
- Add V20-specific instructions: TEST1/CLR1/SET1/NOT1, ROL4/ROR4,
ADD4S/SUB4S/CMP4S, INS/EXT, REPNC/REPC
- Update IDIV to ignore REP prefix quirk on V20
- Update test infrastructure and docs for V20 nomenclature
On real PC/XT hardware, PPI port 0x61 bits 6-7 control keyboard
clock/data lines, not a reset trigger. The removed logic caused an
infinite IRQ1 loop when games cleared speaker bits (e.g. Sopwith),
locking keyboard input and leaving a hanging speaker note.
Also removes kb_reset state and related debug/test code.
Real EGA monitors hardware-remap RGBI value 6 (binary 000110b) by
dimming the green channel, so dark yellow (0xAAAA00) becomes brown
(0xAA5500). EGA-default-palette titles such as Monkey Island rely on
this monitor behavior to render wood and brick in brown rather than
greenish yellow, since they program the attribute controller with the
identity palette (0..7, 0x10..0x17) and never write 0x14 explicitly.
Verified against The Secret of Monkey Island (mode 0x0D): SCUMM Bar
beams, doors, tables and floors now render brown.
Tests: 121 module + 315 CPU pass.
The FreeDOS INT 2Fh redirector wrapper does xchg ax,cx after the handler
returns, so leaving stale CX from a prior rep movsb was being swapped
into AX and corrupting subfunction returns (broke dir Z: volume label
and FindFirst).
Mode 4/5 attribute palette tables now map colors 0-3 to the correct ECD
palette (00,3B,3D,3F) instead of the limited 13/15/17 SCD indices, and
INT 10h AH=0Bh (background/border + 4-color palette select) routes its
BL value through a new cga_to_ega translation table so CGA-compatible
titles like WolfensteinCGA produce correct on-screen colors on EGA.
Tests: 121 module + 315 CPU pass.
Map colors 8-15 to indices 0x38-0x3F (full 64-color palette) instead of
0x10-0x17 (limited SCD palette), fixing yellow/green tint in bright colors.
feat(ppi): add keyboard scancode queue
Prevent scancode loss during rapid input by queuing up to 16 events and
draining them via a 1ms timer callback. Queue survives keyboard reset.
tweak(crt): increase phosphor persistence to 112/256 new, 144/256 old
chore(status): document EGA palette fix and PIT reload behavior
Refactor CGA and HGC modules to use standalone font header files.
Update frontend CRT and core for related display improvements.
Update STATUS.md to reflect changes.
- Read display_version from virtualxt_libretro.info via export.sh
- Pass version as -DVXT_VERSION to frontend CFLAGS
- Update license to BSD-1-Clause and version to 3.0.0
- Document changes in STATUS.md
Restructure the libretro release workflow so that .woodpecker/libretro.yaml
owns all cross-compilation orchestration (Zig, Android NDK, Emscripten) and
writes per-target outputs under dist/libretro/, while package-libretro.sh
only stages those prebuilt artifacts into the itch bundle directory. The
Makefile now accepts LIBRETRO_OUT, LIBRETRO_LINK_MODE, and
LIBRETRO_OBJECT_OUT variables so CI can produce target-native filenames
without a separate link step.
Remove the complex curvature/warp path and its LUT/buffer overhead. The
filter now adapts to source line count (2x upscale for low-line modes,
native height with mild scanlines for EGA 350-line), adds decay-style
phosphor persistence, separable vignette with center black lift, and
subtle animated effects (rolling bar, scanline wobble, noise). Default
frontend options changed to EGA video with CRT filter enabled.
Split option handling into a parse-only refresh_option_values() pass
plus phased apply_option_effects() side effects. Load-time-only options
(boot priority, video adapter, hostfs, ems, rtc) are applied before
machine setup. Runtime-safe options (cpu_turbo, crt_filter) are also
applied on a first-frame refresh and live updates without touching
disk boot configuration mid-POST.
Merge DESIGN.md and ARCHITECTURE.md into a single unified SPEC.md covering
philosophy, architecture, and implementation details. Port the IBM Game
Control Adapter from the Odin codebase using the one-shot RC timing model
with fixes for button state overwrite and floating-point ticker drift.
Audit of design doc vs codebase found the implementation faithful to the
spec with minor deviations. Update DESIGN.md to match the code: PIC
callbacks pic_irq/pic_next, config(section,key,value) signature, interrupt
check inside CPU step, peripheral-manager timer ownership, and subtract-
threshold accumulator behavior. Renumber CPU phase comments 1-7 to match
the spec's decode-dispatch steps. Change timer accumulator from zero-reset
to subtract-threshold with zero-guard for interval=0 timers, reducing
timing drift for real-interval timers like CGA scanline.
The VXTX extension ROM used AND AX,0xC000 when setting up the floppy
controller in the equipment word, which zeroed all bits except 14-15.
This destroyed the video type field (bits 4-5), causing POST to display
'EGA/VGA Graphics' instead of 'CGA Graphics'. Changed mask to 0xFF3E
to only clear floppy-related bits (bit 0, bits 6-7).
Also shifts BIOS POST screen rows up by one to remove extra blank line
between banner and peripheral tree.
- Fix destroy_all() to reset bus maps, store_sr() to use set_segment_register(),
hostfs_config() to filter by section, and UART to use instantiate()
- Remove unused audio_batch_cb, cpu_options, hostfs_set_led, disk_address/linear helpers
- Add shared vxt_linear_address() in common.h, unify disk/hostfs LED via disk_set_led()
- Replace magic numbers with named constants (PATH_MAX_LEN, INI_MAX_SIZE, TARGET_FPS, etc.)
- Shrink CGA CRTC from 256→18 bytes with bounds checks, PIT channels[4]→channels[3]
- Rename hostfs_process_t→vxt_hostfs_process_t, use compound literal vtable init, zero-init reset
- Add shared pic_init_xt() helper, deduplicate PIC init across test_pic/test_pit/test_ppi
- Add license header to test_debug.c, fix stale comments, reorder cast-before-NULL-check
Replace GLaBIOS with custom VirtualXT BIOS (vxtbios.asm), add Motorola
MC146818 RTC module with frontend time sync, and fix MUL/IMUL to update
parity/sign/zero flags matching real 8088 behavior.