-
Notifications
You must be signed in to change notification settings - Fork 18
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
refactor: DOSINT21H loads the initial DOS executable #871
base: master
Are you sure you want to change the base?
Conversation
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>
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. |
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>
73c3b14
to
5086f67
Compare
Signed-off-by: Maximilien Noal <noal.maximilien@gmail.com>
5086f67
to
85bfd02
Compare
Description of Changes
Gives the DOS INT21H class the capability and responsibility to load the host file, if the ProgramExecutor determines that it is a DOS executable (.COM or .EXE file)
Rationale behind Changes
Makes it easier for a potential contributor to implement DOS function INT21H 0x4B (LOAD AND/OR EXECUTE).
Along with the DOS SDA, PSP chains, and eventually TSR support.
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.