-
Notifications
You must be signed in to change notification settings - Fork 157
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
Full implementation of aditional 8086 compatibility mode #34
base: master
Are you sure you want to change the base?
Conversation
I fixed the code errors that prevented it from compiling. Now I've split CodeGen from the 8086 into a separate executable, and compressed the code enough so that it generates an smlrc using -doss exe |
Usage of my modifications: smlrcc -8086 -doss -o hw.exe hw.c generate executable compatible with Intel 8086 If omit -8086 flag, compiler will ignore all my modifications, generating 386 code in 16 Bits |
SMLRC86 in DOS Small and DOS Huge, has a limitation (only compiles with NO_EXTRAS flag) |
v0100/smlrc.c
Outdated
@@ -2886,7 +2890,7 @@ int exprUnary(int tok, int* gotUnary, int commaSeparator, int argOfSizeOf) | |||
{ | |||
tok = GetToken(); | |||
tok = expr(tok, gotUnary, 0); | |||
if (!*gotUnary) | |||
if (!*gotUnary || tok != ']') |
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 this change?
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.
This change ended up in the final Commit, it was part of a unification test with the next IF, to decrease the final size of the executable, can be restored to the previous state.
Such a smlrc isn't any more useful than the full one that uses 80386 instructions/registers and supports 32-bit types. |
I just made this compaction to keep the "-doss" version compilable, I also think I find it unnecessary if you think we can discard a "-doss" version of the compiler, I can return the 8086 code generator code for a version more readable, I intend to gradually implement the 32-bit calculation in 8086, once again it will generate a much larger code than pure 32-bit equivalent, but it will be an alternative for those who want to compile the 8086/8088 as a target. |
- Clean 8086 CodeGen code - Remove irrelevant code from 8086 - Update base code from current main project - Fix 8086 bugs
I cleaned up the 8086 code, and removed all the unnecessary extensions I had made to fit the compiler into the small model. I updated the code base to the most recent one from your project, for now the only output that this CodeGen generates is Tiny and Small, I'm seeing how I will implement a version of Large with multi segments for future versions. |
- Remove shortcuts for Small Model version of compiler
- Changed the names of cg8086 constants - Added error when trying to compile 8086 in unsupported formats
I corrected the naming of the constants to be compatible with the format you use in other CodeGen, I added an error when trying to use OutputFormat incompatible with the -8086 flag, avoiding misuse, I imagine the code is now ready for production. I'm going to start a new branch to test 32-bit integer calculations using 16-bit commands and pointers with segments, I want to do it in a way that uses only CodeGen and not have to change the syntax (I don't intend to add the "far" modifier or do anything different, at most add the MK_FP macro used in old Turbo C/Microsoft C to set the segment). |
…nd of Heap - Add (optional) custom Heap+Stack configuration on Small DOS EXE, generating really small footprint for limited environvments (HP 95LX or IBM PC with < 256K RAM)
I found an error when using smlrcc with the -8086 flag, I fixed it |
My code is based on Pull request 33 from aleexmaftei.
Changes: