One of the more interesting things about OS/2 1.x is how it had this interesting idea of how to strattle the bridge between old and new, and it was a very common bridge tactic where you can have a shipping program that can simply run in both the older operating system, and the new one. Naturally there is trade offs, you can’t fully take advantage of all kinds of features on the new side, you will be largely held back on the old side, but all is not lost, there is space for things that fit in the ‘same but bigger’ world where you have an overlap between old and new.
For OS X, this was the Carbon era, for Windows this was the famous Win32s extensions, and for OS/2 it’s the Family API.
As a quick example, allocating memory under MS-DOS may be limited to 640kb, but under OS/2 you have access to so much more memory, the entire capacity of an IBM AT class machine. And this also got OS/2 tools into a lot of MS-DOS developer’s hands as the early compilers and tools were built around the Family API and were able to run on so called legacy environments. Although it was far better to run on OS/2, the advantage 30+ years later is that MS-DOS emulation is more common and prevalent than OS/2, especially on non x86 processors.
Ages ago I had done a very simple video memory dump of the Microsoft Programmer’s Library giving me electronic access to the old documents, and a few queries give these as the Family API building blocks:
DOS
- DosAllocHuge
- DosAllocSeg
- DosBeep
- DosBufReset
- DosCaseMap
- DosChDir
- DosChgFilePtr
- DosCLIAccess
- DosClose
- DosCreateCSAlias
- DosDelete
- DosDevConfig
- DosDevIOCtl
- DosDupHandle
- DosEnumAttribute
- DosErrClass
- DosError
- DosExecPgm
- DosExit
- DosFileLocks
- DosFindClose
- DosFindFirst
- DosFindFirst2
- DosFindNext
- DosFreeSeg
- DosGetCollate
- DosGetCtryInfo
- DosGetDateTime
- DosGetDBCSEv
- DosGetEnv
- DosGetHugeShift
- DosGetMachineMode
- DosGetMessage
- DosGetVersion
- DosHoldSignal
- DosInsMessage
- DosMkDir
- DosMove
- DosNewSize
- DosOpen
- DosPutMessage
- DosQCurDir
- DosQCurDisk
- DosQFHandState
- DosQFileInfo
- DosQFileMode
- DosQFSInfo
- DosQPathInfo
- DosQVerify
- DosRead
- DosReallocHuge
- DosReallocSeg
- DosRmDir
- DosSelectDisk
- DosSetDateTime
- DosSetFHandState
- DosSetFileInfo
- DosSetFileMode
- DosSetFSInfo
- DosSetPathInfo
- DosSetSigHandler
- DosSetVec
- DosSetVerify
- DosSizeSeg
- DosSleep
- DosSubAlloc
- DosSubFree
- DosSubSet
- DosWrite
Keyboard
- KbdCharIn
- KbdFlushBuffer
- KbdGetStatus
- KbdPeek
- KbdSetStatus
- KbdStringIn
Video
- VioGetBuf
- VioGetConfig
- VioGetCurPos
- VioGetMode
- VioGetPhysBuf
- VioGetState
- VioReadCellStr
- VioReadCharStr
- VioScrLock
- VioScrollDn
- VioScrollLf
- VioScrollRt
- VioScrollUp
- VioScrUnLock
- VioSetCurPos
- VioSetCurType
- VioSetMode
- VioSetState
- VioShowBuf
- VioWrtCellStr
- VioWrtCharStr
- VioWrtCharStrAtt
- VioWrtNAttr
- VioWrtNCell
- VioWrtNChar
- VioWrtTTY
I’m sure this is not exhaustive by any stretch. I got the list from a simple query like this:
grep -i 'family api' os2dev.txt | awk '{print $2}' > fam.txt
grep -i 'family api' prgmr[34].txt| awk '{print $3}' >> fam.txt
sort fam.txt | uniq > family.txt
As an added bonus you really don’t have to mess with the API at all, as the LIBC will use it no doubt.
At any rate, using Microsoft C 6.00 (I can’t get the syntax right for 5.1 to save my life, I suspect I need to run it UNDER OS/2 to build for OS/2 properly), you can compile a typical stdio compliant program, and get an OS/2 executable.
The real fun is from the bind program which will convert that OS/2 program to a full Family mode app with the bind program.
And now on MS-DOS (Under OS/2) you can see very quickly that the OS/2 app won’t run, however the family mode one does!
So this is what let’s me run the older SDK tools as I’d simply forgotten about this great mode, letting you run programs in either environment.
Of course the added fun is the 3rd party product Phar Lap’s 286|Dos-Extender that provides some OS/2 services under MS-DOS in addition to greater memory but DLL’s! But that’s for another story.
**EDIT Oh and another edit, here is how to make the OS/2 program ‘window’ compatible with a link time definition file:
and then on the console:
And there we go with some magical flags & def file it’s now marked as being compatible with window mode. So no full screen VIO tricks for you!