Conversation
Added INT 16h AH=05h (Store Keystroke) support and refactored input handling to use a device-level stuffahead buffer for synthesized input (e.g., DSR responses), matching NANSI priority and bypassing key reassignment. ConsoleDevice now flushes both stuffahead and BIOS keyboard buffers. Improved extended key and backspace handling. ESC[0p now installs the default Ctrl+PrintScreen→Ctrl+P mapping. Added integration tests for key reassignment, buffer flushing, and DSR response correctness.
Implemented support for NANSI-specific modes in SetResetMode: - Mode 99 toggles pseudo cursor behavior via _vga.CursorEmulation. - Mode 43 reinitializes text mode, loads 8x8 font for 80x43 layout, sets cursor shape, and homes the cursor.
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors the DOS CON device implementation to follow FreeDOS/NANSI semantics (ANSI escape parsing, key reassignment, and “stuffahead” input), and adds integration tests to validate key parts of the new console behavior.
Changes:
- Reworks
ConsoleDeviceinto an ANSI-aware console driver with a parser state machine and a shared “stuffahead” queue for synthesized input. - Adds an
AnsiState+AnsiSequenceHandlersplit to separate parsing state from CSI command execution (cursor, erase, insert/delete, DSR, key reassignment). - Extends INT 16h support (AH=05h “Store Keystroke”) and updates INT 21h AH=0Ch flushing to clear device-level buffered input.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Spice86.Tests/Dos/DosInt21IntegrationTests.cs | Adds integration tests covering keyboard reassignment reset, INT 21h flush behavior, and DSR cursor position responses. |
| src/Spice86.Core/Emulator/OperatingSystem/Devices/ConsoleDevice.cs | Major console driver refactor: ANSI parser phases, stuffahead buffering, key reassignment lookup, and updated read/write behavior. |
| src/Spice86.Core/Emulator/OperatingSystem/Devices/AnsiState.cs | Introduces shared mutable state for ANSI parsing/execution (params, attributes, wrap flag, key redefinitions). |
| src/Spice86.Core/Emulator/OperatingSystem/Devices/AnsiSequenceHandler.cs | Implements CSI command execution against VGA + injects DSR responses into the stuffahead buffer. |
| src/Spice86.Core/Emulator/InterruptHandlers/Input/Keyboard/KeyboardInt16Handler.cs | Adds INT 16h AH=05h handler to enqueue keystrokes into the BIOS keyboard buffer. |
| src/Spice86.Core/Emulator/InterruptHandlers/Dos/DosInt21Handler.cs | Extends AH=0Ch flushing to also flush stdin device buffers (clearing console stuffahead). |
|
@copilot apply changes based on the comments in this thread and double check with https://github.com/FDOS/ansi before doing any fix or "enhancement". |
…am, doc comments Agent-Logs-Url: https://github.com/OpenRakis/Spice86/sessions/e68cc385-7468-48b5-a8ce-faf00c55ba4b Co-authored-by: maximilien-noal <1087524+maximilien-noal@users.noreply.github.com>
Applied all changes from the review thread in commit 10b1edf, cross-checked against the FreeDOS NANSI source (
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Description of Changes
Refactors the DOS console driver from FreeDOS code.
Rationale behind Changes
The current console driver was derived from DOSBox, and was hard to follow.
New code is object oriented, documented, and actually understood.
Suggested Testing Steps
Already tested against master with FreeDOS's EDIT.EXE program without issue.
Some integration tests were added.