OS/2, eCS & ArcaOS - Technical > Programming
native mainframe mini-clone
kerravon:
I have previously posted here and mentioned that PDOS/386 from pdos.org supports the OS/2 API to a limited extent (enough to run C90-compliant programs).
I have 3 distinct (complete rewrites - sort of) versions of PDOS. One is PDOS-generic - which is portable.
So to put that "portable" claim to the test, I have it running on multiple environments, including the mainframe (z/Arch).
And because it turns out that the basic APIs can be written in terms of C90 (sort of), e.g. DosRead() calling fread() on another environment, it stands to reason that it should be possible to get OS/2 working on z/PDOS-generic.
It's not as simple as it sounds (mainly getting the tools
into shape), but it was indeed possible.
Here is what it looks like (not especially that the "LX" is
in EBCDIC, which is what the mainframe traditionally
uses):
enter a command
hexdump os2.exe 0 100
about to call app at address 04F0C680
000000 D4E90000 00000000 04000000 00000000 MZ..............
000010 00000000 00000000 40000000 00000000 ........ .......
000020 00000000 00000000 00000000 00000000 ................
000030 00000000 00000000 00000000 40000000 ............ ...
000040 D3E70000 00000000 02000100 00000000 LX..............
000050 00020000 13000000 01000000 14C80000 .............H..
000060 02000000 ....
return from app is hex 0
enter a command
os2 abc def
about to call app at address 04F2D3E4
welcome to pdptest
main function is at 04F21ED0
allocating 10 bytes
m1 is 04ECE7E4
allocating 20 bytes
m2 is 04ECE834
stack is around 00080E78
printing arguments
argc = 3
arg 0 is <os2>
arg 1 is <abc>
arg 2 is <def>
return from app is hex 0
enter a command
Note that this is native z/Arch (or S/370) instructions, not 80386.
I also have the Windows API, including msvcrt.dll, for smaller executables.
Available at https://pdos.org/zpg.zip
You'll need an appropriate emulator (unless you have real hardware) - I provide Hercules/380 and mfemul.
I believe OS/2 was ported to other non-80836 environments, but not the mainframe.
If anyone is interested and wants more information, please let me know.
BFN. Paul.
Martin Iturbide:
Hello Paul
I'm sorry to be slow on this subject, but I want to make sure I understand it.
1) PDOS (Public Domain Operating System) (https://www.pdos.org/)
It looks like DOS in the the command prompt and basic operating commands, but it is not DOS.
As far as I can read it runs on Mainframe hardware and some VMs.
The license is Public Domain, all source code is available.
PDOS comes in different flavors, and one is PDOS/386 which supports the OS/2 API (to a limited extent)
PDOS is created by you, right?
So, I guess I need to understand/learn more about PDOS first.
2) I guess you are trying to run (or accomplished to run) a small compiled OS/2 application made in C90 in z/PDOS, which is the PDOS running on the mainframe (maybe using the Hercules/380 emulator)?
3) You want to know if there is interest on this?
From the side of running OS/2 applications (even if they are small), and learning and documenting more about the OS/2 API, I have interest.
I can help with some basic testing and trying the VMs, but for the lower level development it is out of my league. But it opens up my curiosity.
Regards
kerravon:
--- Quote from: Martin Iturbide on September 07, 2025, 05:46:23 pm ---Hello Paul
I'm sorry to be slow on this subject, but I want to make sure I understand it.
1) PDOS (Public Domain Operating System) (https://www.pdos.org/)
It looks like DOS in the the command prompt and basic operating commands, but it is not DOS.
--- End quote ---
That's actually a funny question. What exactly IS "DOS"? If Microsoft had produced a 32-bit version of DOS - what would it have looked like? If Microsoft had ported DOS to ARM - what would it have looked like? At what point is "DOS" no longer "DOS"? ARM uses different instructions, so INT 21H can't be used as-is. IF 8086 DR-DOS fails to reproduce a bug in 8086 MSDOS, does it cease being "DOS"? If you look at the MSDOS 4 source code, there is some code that calls a DosWrite(). This is similar but not identical to the OS/2 function of the same name. If you call DosWrite (a wrapper on the MSDOS INT 21H call) instead of calling the INT 21H yourself, does that mean that you are no longer writing a DOS program?
--- Quote ---As far as I can read it runs on Mainframe hardware and some VMs.
--- End quote ---
There are 3 completely separate rewrites from scratch. So z/PDOS for the mainframe came before z/PDOS-generic. z/Windows is available for the latter.
--- Quote ---The license is Public Domain, all source code is available.
PDOS comes in different flavors, and one is PDOS/386 which supports the OS/2 API (to a limited extent)
--- End quote ---
That was the case until yesterday. Now it's on the mainframe too.
--- Quote ---PDOS is created by you, right?
--- End quote ---
Probably about 70% of the OS and C library are mine. None of the linker pdld is mine, but that's included in the source tree. Ditto pdas and pdmake.
--- Quote ---So, I guess I need to understand/learn more about PDOS first.
2) I guess you are trying to run (or accomplished to run) a small compiled OS/2 application made in C90 in z/PDOS, which is the PDOS running on the mainframe (maybe using the Hercules/380 emulator)?
--- End quote ---
Yes - accomplished - correct.
--- Quote ---3) You want to know if there is interest on this?
From the side of running OS/2 applications (even if they are small), and learning and documenting more about the OS/2 API, I have interest.
I can help with some basic testing and trying the VMs, but for the lower level development it is out of my league. But it opens up my curiosity.
--- End quote ---
Note that the applications don't need to be small. I have made gcc 3.2.3 C90-compliant. That's 400,000 lines of C code. So you can have an OS/2 application - 80386 or z/Arch - that is 2-3 MB in size. I think I already did that for the 80386. It's still called gccwin.exe for historical reasons, but it's an OS/2 application.
I just checked - yes I did:
D:\devel\gcc\gcc>grep LX os2.mak
os2.mak: # Produce OS/2 LX executable
I haven't done the same thing for z/PDOS-generic aka z/Windows aka z/OS2. But no technical barrier that I am aware of. I currently produce a native z/PDOS-generic executable. I'm more likely to switch to z/Windows COFF using msvcrt.dll than OS/2, but so far I haven't done either. It hasn't been a priority to do either.
BFN. Paul.
Martin Iturbide:
Hello Paul
What do you suggest me to try out PDOS and run an OS/2 binary executable to complete my test?
I have PCs (not mainframe hardware). Can I install PDOS on VirtualBox over Windows and boot PDOS, and from there run a command line OS/2 executable?
Regards
kerravon:
--- Quote from: Martin Iturbide on September 08, 2025, 10:36:40 pm ---What do you suggest me to try out PDOS and run an OS/2 binary executable to complete my test?
I have PCs (not mainframe hardware). Can I install PDOS on VirtualBox over Windows and boot PDOS, and from there run a command line OS/2 executable?
--- End quote ---
Hi Martin. Which OS/2 mini-clone do you want to run? The 80386 mini-clone or the mainframe mini-clone (noting that without some sort of original OS/2 on the mainframe, it's not really a clone).
With regards to the 80386 version, you can indeed run PDOS/386 (pdos.zip) under Virtualbox under Windows and run (certain) valid OS/2 80386 executables.
As you noted, you don't have mainframe hardware, so in order to run mainframe software you will need an emulator. You can either run Hercules/380 under Windows (ie download herc32.zip or herc64.zip), or you can run mfemul.exe, which is included on the PDOS/386 disk (in the "dos" directory). You then need zpg.zip, which is the mainframe version of PDOS-generic, and it already includes a test OS/2 executable, called os2.exe, so just type in "os2". There is also a "win32.exe" and "win64.exe" test programs. And you can recompile your own.
So let me know which of those things you wish to do and download the appropriate thing and tell me how far you got and I should be able to resolve any issue.
Navigation
[0] Message Index
[#] Next page
Go to full version