Skip to content
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

EXE Loader #315

Merged
merged 14 commits into from
Dec 11, 2020
Merged

EXE Loader #315

merged 14 commits into from
Dec 11, 2020

Conversation

enusbaum
Copy link
Member

@enusbaum enusbaum commented Dec 8, 2020

  • Added the ability to run an EXE file using the -exe Command Line switch
  • Moved Interrupt Handlers to their own class w/ Interface of InterruptHandler
  • Implemented Handlers for INT 21h and 1Ah
  • Added Loading of MZ EXE Files (Headers + Program Loading)
  • Several new Opcodes for EXE Support and enhanced existing ones

- Code + Data Segments Identified and Loaded
- Code Segment Decompiled Properly with Relocation Applied for Data Segment
- Extracted Interrupts into their own Interrupt Handlers
- Passing Interrupt Handlers into the CPU Core
- Defined PSP Struct
- Modified EXE Loader to setup PSP and Environemt Variable Segments
- Added MEMORY as supported target for CALL
- Added INT 1Ah
- Additional INT 21h APIs
- Set values to match DOSBox return values for several Interrupts
- Only return a valid address if running in an EXE context
- Otherwise, throw an exception
@enusbaum
Copy link
Member Author

enusbaum commented Dec 8, 2020

Currently runs and executed a simple C program compiled with Turbo C:

#include <stdio.h>

int main()
{
   printf("Hello World!");
   return 0;
}

Prints the result using INT 21h 0x40 and exits with code 0

MBBSEmu/CPU/CPUCore.cs Show resolved Hide resolved
MBBSEmu/CPU/CPUCore.cs Outdated Show resolved Hide resolved
MBBSEmu/DOS/ExeRuntime.cs Show resolved Hide resolved
MBBSEmu/DOS/ExeRuntime.cs Show resolved Hide resolved
MBBSEmu/DOS/ExeRuntime.cs Show resolved Hide resolved
MBBSEmu/DOS/Interrupts/Int21h.cs Outdated Show resolved Hide resolved
MBBSEmu/DOS/Interrupts/Int21h.cs Show resolved Hide resolved
MBBSEmu/Disassembler/MZFile.cs Outdated Show resolved Hide resolved
MBBSEmu/Memory/IMemoryCore.cs Outdated Show resolved Hide resolved
MBBSEmu/Memory/MemoryCore.cs Outdated Show resolved Hide resolved
@@ -3,6 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>preview</LangVersion>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! Got a little YOLO there

@enusbaum enusbaum merged commit e4c6e0a into master Dec 11, 2020
@enusbaum enusbaum deleted the exe-loading branch December 29, 2020 17:55
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.

2 participants