-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: DOS LOAD AND/OR EXEC and DOS process management #871
base: master
Are you sure you want to change the base?
Conversation
Krondor loads and runs. But I don't think an interrupt handler is the right place for this file loading is it? I'm also not quite sure how this makes it easier to implement DOS function INT21H 0x4B. |
src/Spice86.Core/Emulator/InterruptHandlers/Dos/DosInt21Handler.cs
Outdated
Show resolved
Hide resolved
Dosbox does this : Call the command processor, which eventually calls dos int21h 0x4b to execute a DOS program with a DOS path and args as parameters given via CPU registers. It also handles the SDA structure, PSP chains, DOS process management, TSRs and such. What we do currently on master: We completely side step the dos kernel and dos int handlers and the usage of a DOS path. We directly load an executable in memory from an absolute host path, with class that are foreign to the OperatingSystem namespace. We don't have the SDA, DOS process management, TSR support, etc. What this does: What I see as the first step : call the dos int21h class to load the DOS program, from an absolute host path. It's a little bit better, because the rest of the modifications will be done in the dos kernel and the dos int21h handler. |
@@ -776,13 +776,13 @@ public DosFileOperationResult RemoveDirectory(string dosDirectory) { | |||
|
|||
return DosFileOperationResult.NoValue(); | |||
} catch (IOException e) { | |||
triedToDeleteCurrentDir = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is deleting the currentDir really the only cause for IOExceptions when deleting a directory?
fullHostPath, e); | ||
} | ||
} | ||
|
||
return PathNotFoundError(dosDirectory); | ||
return triedToDeleteCurrentDir ? RemoveCurrentDirError(dosDirectory) : PathNotFoundError(dosDirectory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not return this at the end of the codeblock where that boolean is set?
The way I imagine it, we'd have a "FileLoader" class (or set of classes) that are used by both the int21handler and the ProgramExecutor. |
I can do that. |
5086f67
to
85bfd02
Compare
4deb7d6
to
95849f2
Compare
5fee758
to
a1d32fd
Compare
521dd48
to
4e768c3
Compare
SetCarryFlag(false, calledFromVm); | ||
return; | ||
} | ||
DosExecParameterBlock dosExecParameterBlock = new DosExecParameterBlock(Memory, MemoryUtils.ToPhysicalAddress(State.ES, State.BX)); |
Check warning
Code scanning / CodeQL
Useless assignment to local variable Warning
dosExecParameterBlock
Just like on a real DOS implementation. This makes it easier to implement the following: - The SDA - PSP chains - DOS function INT21H 0x4B (Load and/or exec file) and eventually, TSR support. Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
948b4a1
to
5fbcb8c
Compare
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
de7680d
to
2141bc9
Compare
EDIT: For context, the previous description was essentially 'refactor: make the DOS INT21H load and execute the initial program', and the PR was limited to only just that. It isn't anymore, as it wasn't enough.
Description of Changes
Implements LOAD AND/OR EXEC (DOS INT21H function 0x4B) and DOS process management.
Rationale behind Changes
Makes LOAD AND/OR EXEC, used by a lot of DOS games, work. Also a lot of critical DOS kernel structures are present and initialized in emulated memory now, which at least makes our DOS implementation more like an expected one.
Suggested Testing Steps
Test this with your favorite game.
It should still load, even if you set a preferred start segment in the config, or even use program arguments.
Dune still works.