Skip to content

Define COMSPEC in the DOS environment block - #2506

Closed
maximilien-noal wants to merge 1 commit into
masterfrom
comspec-env-var
Closed

maximilien-noal wants to merge 1 commit into
masterfrom
comspec-env-var

Conversation

@maximilien-noal

Copy link
Copy Markdown
Member

Description of Changes

COMSPEC added in DosProcessManager constructor: envVars["COMSPEC"] = "Z:\COMMAND.COM" (if not set).

Consequence: env block grows ~23 bytes → allocated before program memory → load segment shifts +1-2 paragraphs. All goldens regenerated, reviewed: pure address/segment/offset renames, same instruction content.

Also updated alongside the golden regeneration:

  • batch_if_errorlevel_dispatches / batch_if_errorlevel_equals_dispatches readability baseline: RegisterReads max 13 → 14. Both COM programs now map to one segment (016E) via a selector node, and ES becomes data-driven (ES = AX), adding exactly one register read. Same instruction content, different address.
  • int_service_calls catalogue oracle byte 0x016D → 0x016F: pure segment rename of the same result byte.

Rationale behind Changes

Many DOS programs read COMSPEC from the environment block to locate the command interpreter (e.g. START in batch files, or programs that re-invoke COMMAND.COM). Spice86 previously left it unset. Defining it as Z:\COMMAND.COM makes the environment block behave like a standard DOS system with a valid command interpreter path.

Suggested Testing Steps

Validation evidence (all run on this branch):

  • dotnet build src/Spice86.sln — Passed: 9 projects, 0 errors, 0 warnings.
  • dotnet test tests/Spice86.Tests --no-build -- --filter-not-class '*SingleStepTest*' — Passed: 7871/7871, 0 failures. (SingleStepTest excluded per repository test rules; CI runs it on Linux.)
  • Golden regeneration: writers enabled, catalogue command run twice serially (--parallel none); second pass made zero golden changes. Writers re-disabled, rebuilt.
  • Golden diff reviewed: 858 files, 29525 insertions(+), 29433 deletions(-) — only segment/offset renames (016D→016E/016F, data segment 0x3A8→0x3A9), no instruction content changes.

Manual check: run any batch program using START or a program that reads COMSPEC via INT 21 AH=38h and confirm it now sees Z:\COMMAND.COM.

Define COMSPEC=Z:\COMMAND.COM in the environment block when the host has not
set it, so DOS programs see a valid command interpreter path.

The larger environment block is allocated before program memory, so
program load segments shift by 1-2 paragraphs. All affected goldens
were regenerated through the catalogue workflow and reviewed: the diff
is pure segment/offset renaming with identical instruction content.

Also updated the two batch_if_errorlevel readability baselines
(RegisterReads max 13 to 14: the new single-segment selector layout
adds one ES = AX register read) and the int_service_calls oracle byte
(0x016D to 0x016F: segment rename of the same result byte).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@maximilien-noal
maximilien-noal deleted the comspec-env-var branch November 15, 2026 14:27
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