Skip to content

v86: fix windowed DOS box clobbering VBE; add DOS-box probe scenario#359

Merged
felixrieseberg merged 1 commit into
mainfrom
claude/frosty-jones
Apr 12, 2026
Merged

v86: fix windowed DOS box clobbering VBE; add DOS-box probe scenario#359
felixrieseberg merged 1 commit into
mainfrom
claude/frosty-jones

Conversation

@felixrieseberg
Copy link
Copy Markdown
Owner

What

Rebuilds libv86.js from felixrieseberg/v86@windows95-base, which now carries the vga-defer-vbe-disable-v86 fix.

Why

Opening any MS-DOS program turned the screen into vertical planar-garbage stripes. Root cause: the windowed DOS VM's INT 10h reflects to vgabios in V86 mode; vgabios's mode-set begins by writing dispi[4]=0. Win9x's VDD virtualises the standard VGA ports (3B0–3DF) for windowed VMs but passes 1CE/1CF straight through, so the VBE-disable reaches the hardware while the rest of the mode-set is captured into the VM's virtual register file. v86 then dropped out of LFB rendering with the legacy registers still holding the SVGA values.

The v86 fix defers clearing svga_enabled when dispi[4] is cleared from V86 mode (EFLAGS.VM set) until a legacy attribute_mode write actually reaches the hardware — which a real passthrough mode-set does on the very next register, but the windowed-VM leak never does.

Also

  • debug-harness.ts: new WIN95_PROBE_DOSBOX=1 scenario (open command, type dir, optionally WIN95_PROBE_DOSBOX_ALTENTER=1 to fullscreen) — this is the regression test.
  • WIN95_PROBE_VGATRACE=1: opt-in VGA I/O tracer that wraps io.ports[] (not the VGAScreen.portXXX_write methods, which are captured by-value at registration) and dumps [port, op, value, "eip VMPE cplN"] tuples to /tmp/win95-vgatrace.json. The EIP+CPU-mode column is what pinned the leak on V86-mode vgabios at C000:2C8x.
  • Skill docs updated for the new fork branch and probe env vars.

Verified

  • Windowed DOS box: desktop stays at 1024×768 with the prompt rendered in a window; dir output visible
  • Alt+Enter → fullscreen: proper 80×25 text mode with content
  • tools/probe-boot.sh: 2/3 SUCCESS, 1 FAIL_VXDLINK (matches pre-fix baseline)

Upstream PR for the v86 side will be opened separately from felixrieseberg/v86:vga-defer-vbe-disable-v86.

Rebuilds libv86.js from felixrieseberg/v86@windows95-base, which now
carries vga-defer-vbe-disable-v86: when a windowed DOS VM's vgabios
writes dispi[4]=0, Win9x's VDD passes that through (it doesn't know
about ports 1CE/1CF) while virtualising the rest of the mode-set, so
v86 used to drop out of LFB rendering with the legacy registers still
holding SVGA values and the screen turned to planar garbage. The fix
defers the disable until a legacy attribute-mode write actually
reaches the hardware.

debug-harness: WIN95_PROBE_DOSBOX=1 opens command from Run, types
dir, optionally Alt+Enters (WIN95_PROBE_DOSBOX_ALTENTER=1).
WIN95_PROBE_VGATRACE=1 wraps the VGA io.ports[] entries (not the
VGAScreen methods, which are captured by-value at registration) and
dumps [port, op, value, eip+VM/PE/CPL] tuples to
/tmp/win95-vgatrace.json — that EIP/mode column is what pinned the
leak on V86-mode vgabios at C000:2C8x.
@felixrieseberg felixrieseberg merged commit 766497b into main Apr 12, 2026
8 checks passed
@felixrieseberg felixrieseberg deleted the claude/frosty-jones branch April 12, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant