Fix/dos mem allocation - #2342
Closed
maximilien-noal wants to merge 3 commits into
Closed
Conversation
maximilien-noal
force-pushed
the
fix/dos_mem_allocation
branch
from
September 5, 2026 12:48
1d4e31e to
3580c50
Compare
maximilien-noal
force-pushed
the
fix/dos_mem_allocation
branch
2 times, most recently
from
September 5, 2026 12:53
e776658 to
bbab09d
Compare
INT 16h may invoke INT 09h while waiting for a keystroke. When the 8042 output buffer is empty, reading port 0x60 returns the previous data byte, causing the same scancode to be processed repeatedly. Check the controller status before reading the keyboard data port.
…location and resizing
maximilien-noal
force-pushed
the
fix/dos_mem_allocation
branch
from
September 5, 2026 12:55
bbab09d to
f35f518
Compare
maximilien-noal
marked this pull request as draft
September 5, 2026 12:56
maximilien-noal
marked this pull request as ready for review
September 5, 2026 12:57
maximilien-noal
marked this pull request as draft
September 5, 2026 13:00
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new compression/resize logic has a couple of correctness/robustness issues (notably missing MCB validity checks in compression and an ignored SplitBlock failure path) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Lite
Comment on lines
+229
to
+233
| // Shrinking MCB | ||
| SplitBlock(block, newSizeInParagraphs); | ||
| block.PspSegment = _sda.CurrentProgramSegmentPrefix; | ||
| CompressMemory(); | ||
| return DosErrorCode.NoError; |
Comment on lines
+563
to
+567
| private void CompressMemory() { | ||
| DosMemoryControlBlock? current = _start; | ||
| while (current is not null && !current.IsLast) { | ||
| DosMemoryControlBlock? next = current.GetNextOrDefault(); | ||
| if (next is null) { |
Comment on lines
326
to
330
| @@ -327,7 +329,11 @@ public void ReduceSizeOfFreeBlock() { | |||
| /// conjoining free blocks of memory. Therefore even though a free memory block can effectively | |||
| /// be allocated by trying to reduce its size, it can never be allocated by trying to increase | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Changes DOS Memory Manager behavior when allocating MCBs
Rationale behind Changes
Fixes DOS Memory Manager behavior so Alone in the Dark works fully now.
Suggested Testing Steps