I only have a vague goal, so take this with a grain of salt.
Basically with the benefit of hindsight, I would like to have bought (or rented time on perhaps - I had only just started working in 1986) an 80386 computer in 1986 or close, and written a Win32 clone (what PDOS/386 is currently). I do need some supporting software though, like a C compiler. I had access to a mainframe running MVS/XA, so cross-compiling could have been done. Basically the hardware existed, and I "just" need software support - and it's not a "lot" of software to support the "minimal" goals I have in mind.
And what I am looking for is for those Win32 applications (a subset - where I set the rules), to still run on Windows 11, and now I have a new "opportunity" - it appears that those Win32 applications, if carefully written, can be run on a fairly minimal layer upon 64-bit UEFI (itself an OS, basically). This involves running 32-bit code on LM64, something that was nominally not possible, but now the jury is basically out on the definition of "possible".
Here is what I have ...
This is a simple Win32 program designed to call puts, as provided by msvcrt.dll. It is written in assembler instead of C because I don't currently have a C compiler capable of generating the required assembler:
https://sourceforge.net/p/pdos/gitcode/ ... demo32.asm
I have this loader code (search for the second occurrence of w32puts):
https://sourceforge.net/p/pdos/gitcode/ ... /exeload.c
And this is the assembler stub that is referenced:
https://sourceforge.net/p/pdos/gitcode/ ... 32hack.asm
I have tested this on both qemu and real hardware. But it's still proof of concept, and I'm not sure if I'm missing anything.
There will be issues for something like printf, where I don't know how many parameters there are. I could potentially get around that by making it mandatory for (my) Win32 executables to call getmainargs and if argc is (faked to be) greater than x'80000000' (I did something similiar in PDPCLIB for the Amiga) then it means that argv is also faked, and is a structure, and you need to go there to fetch the real values of argc and argv, as well as a "global" variable that contains the number of arguments when you call a variable-argument function. The compiler would generate code to say that if that global pointer is not NULL then set it to the argument count, otherwise, take no action as you are running under a normal Win32 environment.
You can download a disk image containing the system from http://pdos.org at the bottom of the University Challenge x64 section.
Basically I could have started programming in C90 in 1986, and produced 32-bit executables that worked fine then, and still work fine now, with minimal fuss on a UEFI machine, and not be dependent on Microsoft.
I mainly needed some "rules" on how to write 32-bit code. Knowing in advance that the x64 would obsolete something as basic as push eax. ie AMD could have set out this "roadmap" in 1986.
I'm mainly wanting to know of any show-stoppers. I thought there might have been one when my code was working on qemu but not real hardware, but 2 fixes later it started working on real hardware. ie - are there any instructions that are not available and cannot be worked around? printf was another example of something I initially thought I couldn't reasonably work around - but I think (haven't proven) that it can be worked around.
Basically with the benefit of hindsight, I would like to have bought (or rented time on perhaps - I had only just started working in 1986) an 80386 computer in 1986 or close, and written a Win32 clone (what PDOS/386 is currently). I do need some supporting software though, like a C compiler. I had access to a mainframe running MVS/XA, so cross-compiling could have been done. Basically the hardware existed, and I "just" need software support - and it's not a "lot" of software to support the "minimal" goals I have in mind.
And what I am looking for is for those Win32 applications (a subset - where I set the rules), to still run on Windows 11, and now I have a new "opportunity" - it appears that those Win32 applications, if carefully written, can be run on a fairly minimal layer upon 64-bit UEFI (itself an OS, basically). This involves running 32-bit code on LM64, something that was nominally not possible, but now the jury is basically out on the definition of "possible".
Here is what I have ...
This is a simple Win32 program designed to call puts, as provided by msvcrt.dll. It is written in assembler instead of C because I don't currently have a C compiler capable of generating the required assembler:
https://sourceforge.net/p/pdos/gitcode/ ... demo32.asm
I have this loader code (search for the second occurrence of w32puts):
https://sourceforge.net/p/pdos/gitcode/ ... /exeload.c
And this is the assembler stub that is referenced:
https://sourceforge.net/p/pdos/gitcode/ ... 32hack.asm
I have tested this on both qemu and real hardware. But it's still proof of concept, and I'm not sure if I'm missing anything.
There will be issues for something like printf, where I don't know how many parameters there are. I could potentially get around that by making it mandatory for (my) Win32 executables to call getmainargs and if argc is (faked to be) greater than x'80000000' (I did something similiar in PDPCLIB for the Amiga) then it means that argv is also faked, and is a structure, and you need to go there to fetch the real values of argc and argv, as well as a "global" variable that contains the number of arguments when you call a variable-argument function. The compiler would generate code to say that if that global pointer is not NULL then set it to the argument count, otherwise, take no action as you are running under a normal Win32 environment.
You can download a disk image containing the system from http://pdos.org at the bottom of the University Challenge x64 section.
Basically I could have started programming in C90 in 1986, and produced 32-bit executables that worked fine then, and still work fine now, with minimal fuss on a UEFI machine, and not be dependent on Microsoft.
I mainly needed some "rules" on how to write 32-bit code. Knowing in advance that the x64 would obsolete something as basic as push eax. ie AMD could have set out this "roadmap" in 1986.
I'm mainly wanting to know of any show-stoppers. I thought there might have been one when my code was working on qemu but not real hardware, but 2 fixes later it started working on real hardware. ie - are there any instructions that are not available and cannot be worked around? printf was another example of something I initially thought I couldn't reasonably work around - but I think (haven't proven) that it can be worked around.