Discussion:
Two Silly Questions About 16-bit OS/2
(too old to reply)
Paul S. Person
2007-02-04 20:47:20 UTC
Permalink
As I finish up my tutorial on over-large code segments, I find myself
with two silly questions concerning 16-bit OS/2.

Well, OK, the first isn't that silly:

Would it be as accurate to equate "16-bit OS/2" with "OS/2 1.x" as it
is to equate "16-bit Windows" with "Windowx 3.x"?

I realize that OS/2 2.x and 3.x and 4.x can run 16-bit OS/2 programs,
just as NT 4.0 and XP can run 16-bit Windows programs. That is not the
question; I need to be able to designate the version(s) of OS/2 that
could run 16-bit OS/2 programs but not 32-bit OS/2 programs.

The second one, however, is, I have no doubt, quite silly:

Is there such a thing as a 16-bit OS/2 extender analogous to the
various 32-bit DOS extenders and Win386?

I have never heard of such a thing, and am asserting in the tutorial
that no such thing exists, and it would be nice if that could either
be confirmed or if the existence of such a thing be revealed. This
hypothetical extender, of course, would allow 32-bit programs to be
run on the version or versions of OS/2 which cannot run normal 32-bit
OS/2 programs, just as Win386 allows 32-bit programs to run on Windows
3.x, which is normally restricted to 16-bit programs.
--
"He who should know the history of words
would know all history"
Steven Levine
2007-02-05 06:15:29 UTC
Permalink
In <***@4ax.com>, on 02/04/2007
at 12:47 PM, Paul S. Person <***@ix.netscom.com.invalid> said:

Hi,
Would it be as accurate to equate "16-bit OS/2" with "OS/2 1.x" as it is
to equate "16-bit Windows" with "Windowx 3.x"?
I guess so, if you are only talking about applications and not kernel and
driver level code.
Is there such a thing as a 16-bit OS/2 extender analogous to the various
32-bit DOS extenders and Win386?
No. The OS provides the 32-bit runtime.

Steven
--
--------------------------------------------------------------------------------------------
Steven Levine <***@earthlink.bogus.net> MR2/ICE 2.67 #10183
eCS/Warp/DIY/14.103a_W4 www.scoug.com irc.ca.webbnet.info #scoug (Wed 7pm PST)
--------------------------------------------------------------------------------------------
Michal Necasek
2007-02-05 07:49:35 UTC
Permalink
Post by Paul S. Person
Would it be as accurate to equate "16-bit OS/2" with "OS/2 1.x" as it
is to equate "16-bit Windows" with "Windowx 3.x"?
Yes.
Post by Paul S. Person
I realize that OS/2 2.x and 3.x and 4.x can run 16-bit OS/2 programs,
just as NT 4.0 and XP can run 16-bit Windows programs. That is not the
question; I need to be able to designate the version(s) of OS/2 that
could run 16-bit OS/2 programs but not 32-bit OS/2 programs.
Actually, Windows NT up to version 5.0 (Windows 2000) can run some
16-bit OS/2 programs too.
Post by Paul S. Person
Is there such a thing as a 16-bit OS/2 extender analogous to the
various 32-bit DOS extenders and Win386?
32-bit OS/2 environment is called OS/2 2.0... there never was an
analog of DOS/4G or Win386 that would allow running 32-bit programs on
top of a 16-bit OS. I don't think there were even experiments in this
direction - probably in part because 32-bit OS/2 had been in the works
since 1988 or 1989 at the latest.


Michal
Paul S. Person
2007-02-05 18:12:11 UTC
Permalink
On Mon, 05 Feb 2007 08:49:35 +0100, Michal Necasek
Post by Michal Necasek
Post by Paul S. Person
Would it be as accurate to equate "16-bit OS/2" with "OS/2 1.x" as it
is to equate "16-bit Windows" with "Windowx 3.x"?
Yes.
Post by Paul S. Person
I realize that OS/2 2.x and 3.x and 4.x can run 16-bit OS/2 programs,
just as NT 4.0 and XP can run 16-bit Windows programs. That is not the
question; I need to be able to designate the version(s) of OS/2 that
could run 16-bit OS/2 programs but not 32-bit OS/2 programs.
Actually, Windows NT up to version 5.0 (Windows 2000) can run some
16-bit OS/2 programs too.
I'll try to remember to mention that it in tutorial, since I try and
specify situations where moving to 32-bit programming would not work
(in the context of situations where 16-bit will not work because of
unresolvable code-segment size problems).
Post by Michal Necasek
Post by Paul S. Person
Is there such a thing as a 16-bit OS/2 extender analogous to the
various 32-bit DOS extenders and Win386?
32-bit OS/2 environment is called OS/2 2.0... there never was an
analog of DOS/4G or Win386 that would allow running 32-bit programs on
top of a 16-bit OS. I don't think there were even experiments in this
direction - probably in part because 32-bit OS/2 had been in the works
since 1988 or 1989 at the latest.
Thanks, Michal -- as usual, your response is on-target and clear.
--
"He who should know the history of words
would know all history"
Kevin G. Rhoads
2007-02-05 14:58:40 UTC
Permalink
Post by Paul S. Person
Is there such a thing as a 16-bit OS/2 extender analogous to the
various 32-bit DOS extenders and Win386?
I don't think this is what you had in mind, but many 16 DOS extenders
actually used OS/2 16-bit protected mode console style programs as
the base and supplied a subset of OS/2 16 bit protected mode services
as part of the DOS extender.

So called "family mode" EXEs being just one of the many examples.
Michal Necasek
2007-02-05 15:28:21 UTC
Permalink
Post by Kevin G. Rhoads
Post by Paul S. Person
Is there such a thing as a 16-bit OS/2 extender analogous to the
various 32-bit DOS extenders and Win386?
I don't think this is what you had in mind, but many 16 DOS extenders
actually used OS/2 16-bit protected mode console style programs as
the base and supplied a subset of OS/2 16 bit protected mode services
as part of the DOS extender.
That is true. PharLap's DOS|286 being one of those.

Incidentally, I don't suppose anyone would have a copy of DOS|286? I
was trying to locate a copy for research purposes a while back but this
stuff has a tendency to just fall off the face of the Earth.
Post by Kevin G. Rhoads
So called "family mode" EXEs being just one of the many examples.
I don't think so? Family mode apps did not run in protect mode... I'm
pretty sure they needed to run on 8086.


Michal
Wilton Helm
2007-02-05 18:03:23 UTC
Permalink
Post by Michal Necasek
Incidentally, I don't suppose anyone would have a copy of DOS|286?
I might if you give me more info. Was this an MS release, a third party or
part of DR DOS, etc. I have some floppies lurking with various things of
this sort from 20 or so years ago.

Wilton
Michal Necasek
2007-02-05 18:07:53 UTC
Permalink
Post by Wilton Helm
Post by Michal Necasek
Incidentally, I don't suppose anyone would have a copy of DOS|286?
I might if you give me more info. Was this an MS release, a third party or
part of DR DOS, etc. I have some floppies lurking with various things of
this sort from 20 or so years ago.
It was a 16-bit DOS extender from PharLap (makers of 386|DOS and TNT
extenders), ie. 3rd party. 286|DOS would have been marketed circa 1987-1991.


Michal
Wilton Helm
2007-02-05 19:37:39 UTC
Permalink
Post by Michal Necasek
It was a 16-bit DOS extender from PharLap (makers of 386|DOS and TNT
extenders), ie. 3rd party. 286|DOS would have been marketed circa 1987-1991.
I looked, but I didn't find it. I thought I had some PharLap stuff from
bygone days, but if I did, I've tossed it. I never did much with it, other
than using EMM386 or a similar product to move programs into himem and to
provide work space for a PCB CAD program than needed lots of memory.

Wilton
Kevin G. Rhoads
2007-02-05 19:52:54 UTC
Permalink
Post by Michal Necasek
Post by Kevin G. Rhoads
So called "family mode" EXEs being just one of the many examples.
I don't think so? Family mode apps did not run in protect mode... I'm
pretty sure they needed to run on 8086.
Perhaps I misunderstood, but IIRC there were two ways of making an EXE
that could run under both DOS and OS/2 protected mode. The simpler way
was to make both a DOS EXE and a PM EXE and use the DOS EXE as the DOS stub
on the PM EXE. This was often referred to as a dual-mode EXE.

The other was was to make an OS/2 EXE that restricted itself to calls which
were in the Family mode, that OS/2 EXE could then be bound to a special
DOS stub that translated the PM calls to DOS calls -- acting as a very
limited DOS extender. AFAIK the OS/2 EXE was not restricted to OS/2 real
mode (but I could be misremembering), just a very limited subset of the OS/2
(16 bit) PM API.

(searching)
YES -- from the Microsoft FORTRAN 4.1 Update documentation:
"You can create programs that run under DOS or in real and protected modes under
OS/2 by compiling and linking your program for protected mode and binding it.
Binding resolves references to OS/2 dynamic link libraries so the program
runs in both modes and under either operating system."

MS C v6.0 (and later), of course, offerred more options than did FORTRAN.

Sincerely
Kevin
Michal Necasek
2007-02-05 20:26:51 UTC
Permalink
Post by Kevin G. Rhoads
(searching)
"You can create programs that run under DOS or in real and protected modes under
OS/2 by compiling and linking your program for protected mode and binding it.
Binding resolves references to OS/2 dynamic link libraries so the program
runs in both modes and under either operating system."
I'm pretty sure this was just poorly formulated. Family API apps could
run in both real and protected mode - on OS/2. But only real mode in DOS.

I think if you look at the MSC 6 docs, you will see that only real
mode is supported under DOS (there were some runtime globals for
determining the mode).


Michal
Kevin G. Rhoads
2007-02-05 21:07:42 UTC
Permalink
Post by Michal Necasek
I'm pretty sure this was just poorly formulated. Family API apps could
run in both real and protected mode - on OS/2. But only real mode in DOS.
I just rebuilt the SORTDEMO.FOR example using MS Fortran 4.1 as a bound EXE.

The provided batch file compiles for protected mode, then calls bind.
I needed to use v1.3 BIND 'cause the v1.0 that comes with F4.1 had
problems under XP (not surprising).

The resulting bound program is supposed to run under real mode dos,
even though the compilation targeted OS/2 protected mode (I haven't
cross booted DOS 6.22 to test it yet).

I can supply source, protected mode EXE and Bound EXE to anyone
who wants to try them.
Michal Necasek
2007-02-05 21:54:56 UTC
Permalink
Post by Kevin G. Rhoads
The resulting bound program is supposed to run under real mode dos,
even though the compilation targeted OS/2 protected mode (I haven't
cross booted DOS 6.22 to test it yet).
That's right - and there will be no extender in DOS, the executable
will run in real mode.

See for instance the -Fb option of MSC - "This option creates a
program that can run under both OS/2 protected mode and DOS real mode by
'binding' it after compiling and linking." Also see _osmode documentation.


Michal
Kevin G. Rhoads
2007-02-06 14:28:26 UTC
Permalink
Post by Michal Necasek
Post by Kevin G. Rhoads
The resulting bound program is supposed to run under real mode dos,
even though the compilation targeted OS/2 protected mode (I haven't
cross booted DOS 6.22 to test it yet).
That's right - and there will be no extender in DOS, the executable
will run in real mode.
I suspect we are talking at cross purposes here.

FWIW - I built the program as a protected mode exe, then bound it.

Using FORCEDOS under XP, the protected mode exe gives the
This program cannot be run in DOS mode.
response. The same compilation target AFTER binding runs
happily with FORCEDOS. Anyone wants to play with these, I will
e-mail the two EXEs upon request.

Clearly BINDing is adding something, the EXE sizes are significantly
different (sdp.exe is the protected mode EXE, sdb.exe is the bound):
_____________________________________________________________________
Directory of C:\F41

02/05/2007 03:37 PM <DIR> .
02/05/2007 03:37 PM <DIR> ..
02/05/2007 03:37 PM <DIR> BIN
02/05/2007 03:40 PM <DIR> LIB
02/05/2007 03:42 PM <DIR> DEMOS
02/05/2007 03:42 PM <DIR> STARTUP
02/23/1988 08:30 AM 1,353 MAKESORT.BAT
02/23/1988 08:30 AM 29,255 SORTDEMO.FOR
02/05/2007 04:03 PM 168 ms.bat
02/05/2007 04:03 PM 9,401 SORTDEMO.OBJ
02/05/2007 04:01 PM 76 MSD.BAT
02/05/2007 04:03 PM 39,240 sdp.exe
02/05/2007 04:03 PM 74,568 SORTDEMO.EXE
02/05/2007 04:03 PM 74,568 sdb.exe
02/06/2007 09:13 AM 0 dirlist
_____________________________________________________________________
Yet the only difference between sdp.exe and sdb.exe is that sdb was
produced from sdp.exe by BINDing:
c:\f41\bin\fl /Lp sortdemo.for llibfpe.lib
copy sortdemo.exe sdp.exe
c:\f41\bin\bind1p30 sortdemo c:\f41\lib\doscalls.lib c:\f41\lib\api.lib
copy sortdemo.exe sdb.exe

This is NOT a dual-program EXE. I did not build a DOS-only EXE and use it
as the DOS stub to the protected mode EXE. Nor did BIND secretly invoke
the Fortran compiler behind my back to do that for me. I could have done
that, and had two separate EXEs in one file -- but I didn't. SORTDEMO.FOR
was compiled only once, and compile and link options were to target 16 bit
protected mode. BIND then changed the protected mode exe.

Clearly the DOS stub has been replaced and the replacement DOS stub in
sdb.exe allows the protected mode part (essentially sdp.exe) to run
under DOS (or a DOS emulation).

Sounds like a DOS extender to me. One protected mode EXE with a DOS stub
that allows the protected mode EXE to run under DOS -- where doscalls.lib
and api.lib are the DOS extender pieces plus anything built into BIND that
gets added.

Here's what TDUMP has to say about sdb.exe, and then sdp.exe:
__________________________________________________________________________
Turbo Dump Version 4.1 Copyright (c) 1988, 1994 Borland International
Display of File SDB.EXE

Old Executable Header

DOS File Size 12348h ( 74568. )
Load Image Size 860Fh ( 34319. )
Relocation Table entry count 00C6h ( 198. )
Relocation Table address 0040h ( 64. )
Size of header record (in paragraphs) 0043h ( 67. )
Minimum Memory Requirement (in paragraphs) 0B40h ( 2880. )
Maximum Memory Requirement (in paragraphs) FFFFh ( 65535. )
File load checksum F50Dh ( 62733. )
Overlay Number 0000h ( 0. )

Initial Stack Segment (SS:SP) 076B:0080
Program Entry Point (CS:IP) 0773:009F

Relocation Locations (198 Entries)

0773:0006 0773:000A 0773:000E 0773:0012 0773:0016
0773:001A 0773:0022 0773:0026 0773:002A 0773:002E
0773:0032 0773:0036 0773:003A 0773:003E 0773:0042
0773:0046 0773:004A 0773:004E 0773:0052 0773:0056
0773:005A 0773:005E 0773:0062 0773:0066 0773:006A
0773:006E 0773:0072 0773:0076 0773:007A 0773:007E
0773:0082 0000:0023 0000:0030 0000:00B6 0000:00BE
0000:00D6 0000:01B3 0000:01DC 0000:01E5 0000:025C
0000:0297 0000:02BC 0000:02CE 0000:02D9 0000:031A
0000:0376 0000:038F 0000:051F 0000:05AD 0000:0606
0000:06D2 0000:0863 0000:0927 0000:0946 0000:09DE
0000:09F9 0000:0A14 0000:0BA8 0000:0BC5 0000:0C06
0000:0CE4 0000:0CF1 0000:0D5C 0000:0E84 0249:0014
0249:018F 0249:0194 0249:01D9 0249:024E 0249:0251
0000:0FFF 0000:100D 0000:101A 0000:1032 0000:10FC
0000:112A 0000:1207 0824:0132 0824:0249 0773:00AF
0773:05CA 0773:063C 0773:06DA 0773:07F5 0773:08C1
0000:1381 0000:13B6 0239:000A 0000:142A 0000:1454
0000:146A 0249:03E6 0249:04B0 0249:04E8 0249:04F5
0249:05F2 0249:0629 0249:0780 0249:078A 0249:079C
0249:07C8 0249:0807 0249:0813 0249:081F 0249:0826
0249:0847 0249:088C 0249:08A4 0249:0967 0249:0A07
0249:0BEE 0249:0D05 0249:0D91 0249:0D94 0249:0E6B
0249:0E7B 0249:0EAF 0249:0ECF 045C:0004 045C:00E0
045C:0113 045C:016B 045C:018D 045C:01C2 045C:0208
045C:0302 045C:0307 0249:1162 0249:122F 0249:12AB
0249:1421 0249:14B0 0249:14CC 0249:158B 0249:162C
0249:164A 0249:1711 0249:1747 0249:17A5 0249:17AD
0249:17ED 0249:18D7 0249:1913 0249:1963 0249:19B1
0249:1A24 0249:1A42 0249:1A72 0249:1A75 0249:1A7E
0249:1A91 0249:1AAB 0249:1AAE 0249:1AB7 0249:1AD8
0249:1ADD 0249:1B13 0249:1B19 0249:1B2E 0000:1C25
0000:1D4A 0000:1E82 0000:1EB7 0249:1BFE 0249:1C26
0249:1C53 0249:1C5F 0249:1C88 0249:1C92 0249:1C9A
0249:1C9D 0249:1CB7 0249:1D49 0249:1DB1 0249:1DF3
0249:1E22 0249:1E42 0249:1E68 0249:1E7B 045C:03B9
0249:1EFD 0249:1F86 0249:1F93 0249:1FA7 0249:1FDF
0249:2021 0249:2053 0249:2072 0249:209E 0249:20D0
0249:20EF 0000:1F73 0000:2061 0000:206E 0000:209C
0000:21E9 0000:21FB 0000:226A


New Executable header
Operating system OS/2
File Load CRC 0A272B4CFh
Program Entry Point (CS:IP) 0001:1BF6
Initial Stack Pointer (SS:SP) 0008:3660
Auto Data Segment Index 0008h ( 8. )
Initial Local Heap Size 0000h ( 0. )
Initial Stack Size 0000h ( 0. )
Segment count 0008h ( 8. )
Module reference count 0003h ( 3. )
Moveable Entry Point Count 0000h ( 0. )
File alignment unit size 0200h ( 512. )
DOS File Size 12348h ( 74568. )
Linker Version 5.01
Program Flags
DGROUP : multiple (unshared)
Global initializaton : No
Protected mode only : No
Application type : Unknown
Self Loading : Yes
Errors in image : No
Module type : Application
Other EXE Flags
Support for long file names : No
Segment Table Offset: 893Fh Length: 0040h
Resource Table Offset: 897Fh Length: 0000h
Resident Names Table Offset: 897Fh Length: 000Ch
Module Reference Table Offset: 898Bh Length: 0006h
Imported Names Table Offset: 8991h Length: 009Ch
Entry Table Offset: 8A2Dh Length: 0002h
Nonresident Names Table Offset: 8A2Fh Length: 0010h


Segment Table offset: 893Fh

Segment Number: 01h
Segment Type: CODE Alloc Size : 72D2h
Sector Offset: 0046h File length: 72D1h
80286 DPL Bits: 3 Discard Priority: 00
Attributes: Relocations

Segment Number: 02h
Segment Type: DATA Alloc Size : 000Ch
Sector Offset: 0084h File length: 000Bh
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 03h
Segment Type: DATA Alloc Size : 073Dh
Sector Offset: 0085h File length: 073Dh
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 04h
Segment Type: DATA Alloc Size : 0170h
Sector Offset: 0089h File length: 0014h
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 05h
Segment Type: DATA Alloc Size : 0004h
Sector Offset: 0000h File length: 0000h
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 06h
Segment Type: DATA Alloc Size : 015Eh
Sector Offset: 0000h File length: 0000h
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 07h
Segment Type: DATA Alloc Size : 0008h
Sector Offset: 008Ah File length: 0007h
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 08h
Segment Type: DATA Alloc Size : 3660h
Sector Offset: 008Bh File length: 0C4Eh
80286 DPL Bits: 3 Discard Priority: 00
Attributes: Relocations


No Resource table present

Resident Name Table offset: 897Fh
Module Name: 'SORTDEMO'


Module Reference Table offset: 898Bh
Module 1: DOSCALLS
Module 2: KBDCALLS
Module 3: VIOCALLS


Imported Names Table offset: 8991h
name offset
DOSCALLS 0001h
KBDCALLS 000Ah
KBDCHARIN 0013h
VIOCALLS 001Dh
VIOGETCURPOS 0026h
VIOGETMODE 0033h
VIOREADCELLSTR 003Eh
VIOSCROLLDN 004Dh
VIOSETCURPOS 0059h
VIOSETMODE 0066h
VIOWRTCELLSTR 0071h
VIOWRTCHARSTRATT 007Fh
VIOWRTNCELL 0090h


Entry Table offset: 8A2Dh

Non-Resident Name Table offset: 8A2Fh
Module Description: 'SORTDEMO.EXE'


Segment Relocation Records

Segment 0001h relocations

type offset target
OFFS 0EFFh os #4 additive
OFFS 1547h os #4 additive
OFFS 1556h os #4 additive
OFFS 1565h os #4 additive
OFFS 1574h os #4 additive
OFFS 1583h os #4 additive
OFFS 1592h os #4 additive
OFFS 15A1h os #4 additive
OFFS 15B0h os #4 additive
OFFS 15BFh os #4 additive
OFFS 15CEh os #4 additive
OFFS 15DDh os #4 additive
OFFS 15ECh os #4 additive
OFFS 15FBh os #4 additive
OFFS 160Ah os #4 additive
OFFS 1619h os #4 additive
OFFS 1628h os #4 additive
OFFS 1637h os #4 additive
OFFS 1646h os #4 additive
OFFS 1655h os #4 additive
OFFS 1664h os #4 additive
OFFS 1673h os #4 additive
PTR 00FDh 0001h:10F9h
PTR 450Ah 0001h:287Ah
PTR 4138h 0001h:137Ch
PTR 4CD3h 0001h:247Ch
PTR 11C1h 0001h:0680h
PTR 1C50h 0001h:0000h
PTR 013Dh VIOCALLS.VIOWRTCELLSTR
BASE 4BA9h 0003h:0000h
PTR 1DC8h DOSCALLS.5
PTR 3002h 0001h:1A86h
PTR 0196h 0001h:0387h
PTR 076Ch 0001h:0B87h
PTR 12AFh 0001h:0C07h
PTR 2E4Ch 0001h:1A07h
PTR 20FBh DOSCALLS.137
PTR 29A0h DOSCALLS.138
PTR 1BE4h 0001h:298Ch
PTR 23E9h 0001h:248Eh
PTR 063Dh VIOCALLS.VIOWRTCHARSTRATT
PTR 0461h 0001h:3C0Fh
PTR 1DA9h 0001h:1E12h
BASE 120Eh 0007h:0000h additive
OFFS 05F1h os #5 additive
OFFS 05ECh os #5 additive
OFFS 05E8h os #5 additive
OFFS 0858h os #5 additive
OFFS 0853h os #5 additive
OFFS 084Eh os #5 additive
OFFS 0849h os #5 additive
OFFS 0845h os #5 additive
OFFS 0F18h os #5 additive
OFFS 0F13h os #5 additive
OFFS 0F10h os #5 additive
OFFS 0F0Ah os #5 additive
OFFS 0F06h os #5 additive
OFFS 0F03h os #5 additive
OFFS 0ED1h os #5 additive
OFFS 0EC9h os #5 additive
OFFS 0EC4h os #5 additive
OFFS 0EC0h os #5 additive
OFFS 0EA5h os #5 additive
OFFS 0EA1h os #5 additive
OFFS 0E7Eh os #5 additive
PTR 11E1h 0001h:1018h
OFFS 1455h os #5 additive
OFFS 1461h os #5 additive
OFFS 146Dh os #5 additive
OFFS 1479h os #5 additive
OFFS 1485h os #5 additive
OFFS 1491h os #5 additive
OFFS 149Dh os #5 additive
OFFS 14A9h os #5 additive
OFFS 14B5h os #5 additive
OFFS 14C1h os #5 additive
OFFS 14CDh os #5 additive
OFFS 14D9h os #5 additive
OFFS 14E5h os #5 additive
OFFS 14F1h os #5 additive
OFFS 14FDh os #5 additive
OFFS 1509h os #5 additive
OFFS 1515h os #5 additive
OFFS 1521h os #5 additive
OFFS 152Dh os #5 additive
OFFS 1539h os #5 additive
BASE 1E3Eh 0008h:0000h
OFFS 1741h os #5 additive
OFFS 1750h os #5 additive
OFFS 1755h os #5 additive
OFFS 1758h os #5 additive
OFFS 175Bh os #5 additive
OFFS 179Ah os #5 additive
OFFS 179Dh os #5 additive
OFFS 17B3h os #5 additive
OFFS 17B7h os #5 additive
OFFS 17BAh os #5 additive
OFFS 1A00h os #5 additive
OFFS 1A5Ch os #5 additive
OFFS 1A6Bh os #5 additive
OFFS 1A6Fh os #5 additive
OFFS 1A73h os #5 additive
OFFS 54AEh os #5 additive
PTR 4C3Ah 0001h:2718h
BASE 3D44h 0001h:3C9Eh
PTR 111Ch KBDCALLS.KBDCHARIN
PTR 45F7h 0001h:219Ch
PTR 1C37h 0001h:1E9Eh
OFFS 2D45h DOSCALLS.135
PTR 0C51h VIOCALLS.VIOWRTNCELL
PTR 0672h DOSCALLS.32
PTR 4AD3h 0001h:2920h
PTR 0FBFh DOSCALLS.33
PTR 4A47h 0001h:23A2h
PTR 268Ch DOSCALLS.34
PTR 10AFh 0001h:12A5h
PTR 0601h 0001h:29A6h
PTR 26D7h DOSCALLS.38
PTR 1213h 0001h:0CA7h
PTR 4EB8h DOSCALLS.39
PTR 49F8h 0001h:22A8h
PTR 1C32h 0001h:1F2Ah
PTR 4D61h DOSCALLS.43
PTR 0E97h 0001h:13B0h
PTR 1C25h DOSCALLS.49
PTR 065Fh DOSCALLS.50
PTR 7257h 0001h:20B2h
PTR 2E3Dh 0001h:14B2h
PTR 3DDCh 0001h:2334h
PTR 4E39h DOSCALLS.52
PTR 0016h VIOCALLS.VIOGETCURPOS
PTR 4B31h 0001h:23B7h
OFFS 05F5h os #6 additive
OFFS 085Ch os #6 additive
OFFS 0EAAh os #6 additive
OFFS 1458h os #6 additive
OFFS 1464h os #6 additive
OFFS 1470h os #6 additive
OFFS 147Ch os #6 additive
OFFS 1488h os #6 additive
OFFS 1494h os #6 additive
OFFS 14A0h os #6 additive
OFFS 14ACh os #6 additive
OFFS 14B8h os #6 additive
OFFS 14C4h os #6 additive
OFFS 14D0h os #6 additive
OFFS 14DCh os #6 additive
OFFS 14E8h os #6 additive
OFFS 14F4h os #6 additive
OFFS 1500h os #6 additive
OFFS 150Ch os #6 additive
OFFS 1518h os #6 additive
OFFS 1524h os #6 additive
OFFS 1530h os #6 additive
OFFS 153Ch os #6 additive
OFFS 154Bh os #6 additive
OFFS 155Ah os #6 additive
OFFS 1569h os #6 additive
OFFS 1578h os #6 additive
OFFS 1587h os #6 additive
OFFS 1596h os #6 additive
OFFS 15A5h os #6 additive
OFFS 15B4h os #6 additive
OFFS 15C3h os #6 additive
OFFS 15D2h os #6 additive
OFFS 15E1h os #6 additive
OFFS 15F0h os #6 additive
OFFS 15FFh os #6 additive
OFFS 160Eh os #6 additive
OFFS 161Dh os #6 additive
OFFS 162Ch os #6 additive
OFFS 163Bh os #6 additive
OFFS 164Ah os #6 additive
OFFS 1659h os #6 additive
OFFS 1668h os #6 additive
OFFS 1677h os #6 additive
OFFS 1746h os #6 additive
OFFS 175Eh os #6 additive
OFFS 17A2h os #6 additive
OFFS 17BFh os #6 additive
OFFS 1A60h os #6 additive
OFFS 54A6h os #6 additive
PTR 4A15h 0001h:2938h
PTR 1E70h 0001h:1E38h
PTR 2625h 0001h:2638h
PTR 231Fh DOSCALLS.58
PTR 27EAh DOSCALLS.59
PTR 115Ah 0001h:0F3Ch
PTR 2946h DOSCALLS.60
PTR 2E47h 0001h:14BEh
PTR 4544h 0001h:28C0h
PTR 0946h 0001h:1342h
PTR 468Eh 0001h:2742h
PTR 004Ch VIOCALLS.VIOGETMODE
PTR 2E2Dh 0001h:1544h
PTR 72BDh DOSCALLS.68
PTR 07C0h 0001h:0AC5h
PTR 27C6h DOSCALLS.70
PTR 11A1h 0001h:074Ah
PTR 4AE5h 0001h:214Bh
PTR 2849h DOSCALLS.75
PTR 2801h DOSCALLS.77
PTR 003Ch VIOCALLS.VIOREADCELLSTR
PTR 1098h 0001h:12CFh
PTR 08DCh 0001h:0E50h
PTR 3399h 0001h:7250h
PTR 0E84h 0001h:1A52h
PTR 3CF8h 0001h:22D2h
PTR 00F8h 0001h:07D4h
PTR 4AB3h 0001h:20D6h
OFFS 1796h os #3 additive
OFFS 17AFh os #3 additive
OFFS 19FCh os #3 additive
PTR 1D30h DOSCALLS.89
PTR 115Fh 0001h:095Ah
PTR 1C15h DOSCALLS.92
PTR 1360h VIOCALLS.VIOSCROLLDN
PTR 3D49h 0001h:295Fh
PTR 0868h 0001h:0EE2h
BASE 1BF3h 0001h:1B66h
PTR 124Dh 0001h:0165h
PTR 39A1h 0001h:1B66h
PTR 1180h 0001h:02E7h
PTR 1E2Fh 0001h:1E68h
PTR 110Bh VIOCALLS.VIOSETCURPOS
BASE 59F6h 0004h:0164h
PTR 29C9h 0001h:26EEh
PTR 1E26h 0001h:1DEEh
PTR 1C2Dh 0001h:1CEEh
PTR 1C56h 0001h:1D6Fh
BASE 4BB1h 0003h:0370h
PTR 00A1h VIOCALLS.VIOSETMODE
PTR 1222h 0001h:0576h
PTR 7273h 0001h:22F6h
PTR 43EBh 0001h:28F6h
Relocations: 235

Segment 0008h relocations

type offset target
PTR 0A16h 0004h:0164h
PTR 0A1Ah 0001h:167Dh
PTR 0294h 0002h:0000h
BASE 0A22h 0005h:0000h additive
PTR 0354h 0008h:02D4h
PTR 02A8h 0002h:0006h
PTR 0358h 0008h:02D6h
BASE 0A20h 0006h:0000h additive
BASE 0A1Eh 0007h:0000h additive
BASE 0510h 0008h:0000h
BASE 0A36h 0008h:0681h
PTR 035Ch 0008h:02E3h
BASE 0A38h 0008h:0683h
PTR 0360h 0008h:02ECh
PTR 0364h 0008h:02F7h
PTR 0368h 0008h:0302h
PTR 0394h 0008h:0384h
BASE 0A3Ah 0008h:0626h
PTR 0978h 0008h:0A08h
BASE 0A34h 0008h:062Ah additive
PTR 0A08h 0001h:3CC4h
PTR 0A12h 0001h:4D44h
PTR 036Ch 0008h:030Dh
PTR 02A0h 0008h:2C0Eh
PTR 0370h 0008h:0315h
PTR 0374h 0008h:031Dh
PTR 0378h 0008h:0327h
PTR 028Ch 0008h:2BA8h
PTR 037Ch 0008h:0330h
PTR 0A0Ch 0001h:1BE9h
PTR 0380h 0008h:033Dh
Relocations: 31
_______________________________________________________________________
Turbo Dump Version 4.1 Copyright (c) 1988, 1994 Borland International
Display of File SDP.EXE

Old Executable Header

DOS File Size 9948h ( 39240. )
Load Image Size 9908h ( 39176. )
Relocation Table entry count 0000h ( 0. )
Relocation Table address 0040h ( 64. )
Size of header record (in paragraphs) 0004h ( 4. )
Minimum Memory Requirement (in paragraphs) 0000h ( 0. )
Maximum Memory Requirement (in paragraphs) FFFFh ( 65535. )
File load checksum 0000h ( 0. )
Overlay Number 0000h ( 0. )

Initial Stack Segment (SS:SP) 0000:00B8
Program Entry Point (CS:IP) 0000:0000


New Executable header
Operating system OS/2
File Load CRC 028FC95BCh
Program Entry Point (CS:IP) 0001:1BF6
Initial Stack Pointer (SS:SP) 0008:3660
Auto Data Segment Index 0008h ( 8. )
Initial Local Heap Size 0000h ( 0. )
Initial Stack Size 0000h ( 0. )
Segment count 0008h ( 8. )
Module reference count 0003h ( 3. )
Moveable Entry Point Count 0000h ( 0. )
File alignment unit size 0200h ( 512. )
DOS File Size 9948h ( 39240. )
Linker Version 5.01
Program Flags
DGROUP : multiple (unshared)
Global initializaton : No
Protected mode only : No
Application type : Unknown
Self Loading : No
Errors in image : No
Module type : Application
Other EXE Flags
Support for long file names : No
Segment Table Offset: 00C0h Length: 0040h
Resource Table Offset: 0100h Length: 0000h
Resident Names Table Offset: 0100h Length: 000Ch
Module Reference Table Offset: 010Ch Length: 0006h
Imported Names Table Offset: 0112h Length: 009Ch
Entry Table Offset: 01AEh Length: 0002h
Nonresident Names Table Offset: 01B0h Length: 0010h


Segment Table offset: 00C0h

Segment Number: 01h
Segment Type: CODE Alloc Size : 72D2h
Sector Offset: 0001h File length: 72D1h
80286 DPL Bits: 3 Discard Priority: 00
Attributes: Relocations

Segment Number: 02h
Segment Type: DATA Alloc Size : 000Ch
Sector Offset: 003Fh File length: 000Bh
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 03h
Segment Type: DATA Alloc Size : 073Dh
Sector Offset: 0040h File length: 073Dh
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 04h
Segment Type: DATA Alloc Size : 0170h
Sector Offset: 0044h File length: 0014h
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 05h
Segment Type: DATA Alloc Size : 0004h
Sector Offset: 0000h File length: 0000h
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 06h
Segment Type: DATA Alloc Size : 015Eh
Sector Offset: 0000h File length: 0000h
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 07h
Segment Type: DATA Alloc Size : 0008h
Sector Offset: 0045h File length: 0007h
80286 DPL Bits: 3 Discard Priority: 00
Attributes:

Segment Number: 08h
Segment Type: DATA Alloc Size : 3660h
Sector Offset: 0046h File length: 0C4Eh
80286 DPL Bits: 3 Discard Priority: 00
Attributes: Relocations


No Resource table present

Resident Name Table offset: 0100h
Module Name: 'SORTDEMO'


Module Reference Table offset: 010Ch
Module 1: DOSCALLS
Module 2: KBDCALLS
Module 3: VIOCALLS


Imported Names Table offset: 0112h
name offset
DOSCALLS 0001h
KBDCALLS 000Ah
KBDCHARIN 0013h
VIOCALLS 001Dh
VIOGETCURPOS 0026h
VIOGETMODE 0033h
VIOREADCELLSTR 003Eh
VIOSCROLLDN 004Dh
VIOSETCURPOS 0059h
VIOSETMODE 0066h
VIOWRTCELLSTR 0071h
VIOWRTCHARSTRATT 007Fh
VIOWRTNCELL 0090h


Entry Table offset: 01AEh

Non-Resident Name Table offset: 01B0h
Module Description: 'SORTDEMO.EXE'


Segment Relocation Records

Segment 0001h relocations

type offset target
OFFS 0EFFh os #4 additive
OFFS 1547h os #4 additive
OFFS 1556h os #4 additive
OFFS 1565h os #4 additive
OFFS 1574h os #4 additive
OFFS 1583h os #4 additive
OFFS 1592h os #4 additive
OFFS 15A1h os #4 additive
OFFS 15B0h os #4 additive
OFFS 15BFh os #4 additive
OFFS 15CEh os #4 additive
OFFS 15DDh os #4 additive
OFFS 15ECh os #4 additive
OFFS 15FBh os #4 additive
OFFS 160Ah os #4 additive
OFFS 1619h os #4 additive
OFFS 1628h os #4 additive
OFFS 1637h os #4 additive
OFFS 1646h os #4 additive
OFFS 1655h os #4 additive
OFFS 1664h os #4 additive
OFFS 1673h os #4 additive
PTR 00FDh 0001h:10F9h
PTR 450Ah 0001h:287Ah
PTR 4138h 0001h:137Ch
PTR 4CD3h 0001h:247Ch
PTR 11C1h 0001h:0680h
PTR 1C50h 0001h:0000h
PTR 013Dh VIOCALLS.VIOWRTCELLSTR
BASE 4BA9h 0003h:0000h
PTR 1DC8h DOSCALLS.5
PTR 3002h 0001h:1A86h
PTR 0196h 0001h:0387h
PTR 076Ch 0001h:0B87h
PTR 12AFh 0001h:0C07h
PTR 2E4Ch 0001h:1A07h
PTR 20FBh DOSCALLS.137
PTR 29A0h DOSCALLS.138
PTR 1BE4h 0001h:298Ch
PTR 23E9h 0001h:248Eh
PTR 063Dh VIOCALLS.VIOWRTCHARSTRATT
PTR 0461h 0001h:3C0Fh
PTR 1DA9h 0001h:1E12h
BASE 120Eh 0007h:0000h additive
OFFS 05F1h os #5 additive
OFFS 05ECh os #5 additive
OFFS 05E8h os #5 additive
OFFS 0858h os #5 additive
OFFS 0853h os #5 additive
OFFS 084Eh os #5 additive
OFFS 0849h os #5 additive
OFFS 0845h os #5 additive
OFFS 0F18h os #5 additive
OFFS 0F13h os #5 additive
OFFS 0F10h os #5 additive
OFFS 0F0Ah os #5 additive
OFFS 0F06h os #5 additive
OFFS 0F03h os #5 additive
OFFS 0ED1h os #5 additive
OFFS 0EC9h os #5 additive
OFFS 0EC4h os #5 additive
OFFS 0EC0h os #5 additive
OFFS 0EA5h os #5 additive
OFFS 0EA1h os #5 additive
OFFS 0E7Eh os #5 additive
PTR 11E1h 0001h:1018h
OFFS 1455h os #5 additive
OFFS 1461h os #5 additive
OFFS 146Dh os #5 additive
OFFS 1479h os #5 additive
OFFS 1485h os #5 additive
OFFS 1491h os #5 additive
OFFS 149Dh os #5 additive
OFFS 14A9h os #5 additive
OFFS 14B5h os #5 additive
OFFS 14C1h os #5 additive
OFFS 14CDh os #5 additive
OFFS 14D9h os #5 additive
OFFS 14E5h os #5 additive
OFFS 14F1h os #5 additive
OFFS 14FDh os #5 additive
OFFS 1509h os #5 additive
OFFS 1515h os #5 additive
OFFS 1521h os #5 additive
OFFS 152Dh os #5 additive
OFFS 1539h os #5 additive
BASE 1E3Eh 0008h:0000h
OFFS 1741h os #5 additive
OFFS 1750h os #5 additive
OFFS 1755h os #5 additive
OFFS 1758h os #5 additive
OFFS 175Bh os #5 additive
OFFS 179Ah os #5 additive
OFFS 179Dh os #5 additive
OFFS 17B3h os #5 additive
OFFS 17B7h os #5 additive
OFFS 17BAh os #5 additive
OFFS 1A00h os #5 additive
OFFS 1A5Ch os #5 additive
OFFS 1A6Bh os #5 additive
OFFS 1A6Fh os #5 additive
OFFS 1A73h os #5 additive
OFFS 54AEh os #5 additive
PTR 4C3Ah 0001h:2718h
BASE 3D44h 0001h:3C9Eh
PTR 111Ch KBDCALLS.KBDCHARIN
PTR 45F7h 0001h:219Ch
PTR 1C37h 0001h:1E9Eh
OFFS 2D45h DOSCALLS.135
PTR 0C51h VIOCALLS.VIOWRTNCELL
PTR 0672h DOSCALLS.32
PTR 4AD3h 0001h:2920h
PTR 0FBFh DOSCALLS.33
PTR 4A47h 0001h:23A2h
PTR 268Ch DOSCALLS.34
PTR 10AFh 0001h:12A5h
PTR 0601h 0001h:29A6h
PTR 26D7h DOSCALLS.38
PTR 1213h 0001h:0CA7h
PTR 4EB8h DOSCALLS.39
PTR 49F8h 0001h:22A8h
PTR 1C32h 0001h:1F2Ah
PTR 4D61h DOSCALLS.43
PTR 0E97h 0001h:13B0h
PTR 1C25h DOSCALLS.49
PTR 065Fh DOSCALLS.50
PTR 7257h 0001h:20B2h
PTR 2E3Dh 0001h:14B2h
PTR 3DDCh 0001h:2334h
PTR 4E39h DOSCALLS.52
PTR 0016h VIOCALLS.VIOGETCURPOS
PTR 4B31h 0001h:23B7h
OFFS 05F5h os #6 additive
OFFS 085Ch os #6 additive
OFFS 0EAAh os #6 additive
OFFS 1458h os #6 additive
OFFS 1464h os #6 additive
OFFS 1470h os #6 additive
OFFS 147Ch os #6 additive
OFFS 1488h os #6 additive
OFFS 1494h os #6 additive
OFFS 14A0h os #6 additive
OFFS 14ACh os #6 additive
OFFS 14B8h os #6 additive
OFFS 14C4h os #6 additive
OFFS 14D0h os #6 additive
OFFS 14DCh os #6 additive
OFFS 14E8h os #6 additive
OFFS 14F4h os #6 additive
OFFS 1500h os #6 additive
OFFS 150Ch os #6 additive
OFFS 1518h os #6 additive
OFFS 1524h os #6 additive
OFFS 1530h os #6 additive
OFFS 153Ch os #6 additive
OFFS 154Bh os #6 additive
OFFS 155Ah os #6 additive
OFFS 1569h os #6 additive
OFFS 1578h os #6 additive
OFFS 1587h os #6 additive
OFFS 1596h os #6 additive
OFFS 15A5h os #6 additive
OFFS 15B4h os #6 additive
OFFS 15C3h os #6 additive
OFFS 15D2h os #6 additive
OFFS 15E1h os #6 additive
OFFS 15F0h os #6 additive
OFFS 15FFh os #6 additive
OFFS 160Eh os #6 additive
OFFS 161Dh os #6 additive
OFFS 162Ch os #6 additive
OFFS 163Bh os #6 additive
OFFS 164Ah os #6 additive
OFFS 1659h os #6 additive
OFFS 1668h os #6 additive
OFFS 1677h os #6 additive
OFFS 1746h os #6 additive
OFFS 175Eh os #6 additive
OFFS 17A2h os #6 additive
OFFS 17BFh os #6 additive
OFFS 1A60h os #6 additive
OFFS 54A6h os #6 additive
PTR 4A15h 0001h:2938h
PTR 1E70h 0001h:1E38h
PTR 2625h 0001h:2638h
PTR 231Fh DOSCALLS.58
PTR 27EAh DOSCALLS.59
PTR 115Ah 0001h:0F3Ch
PTR 2946h DOSCALLS.60
PTR 2E47h 0001h:14BEh
PTR 4544h 0001h:28C0h
PTR 0946h 0001h:1342h
PTR 468Eh 0001h:2742h
PTR 004Ch VIOCALLS.VIOGETMODE
PTR 2E2Dh 0001h:1544h
PTR 72BDh DOSCALLS.68
PTR 07C0h 0001h:0AC5h
PTR 27C6h DOSCALLS.70
PTR 11A1h 0001h:074Ah
PTR 4AE5h 0001h:214Bh
PTR 2849h DOSCALLS.75
PTR 2801h DOSCALLS.77
PTR 003Ch VIOCALLS.VIOREADCELLSTR
PTR 1098h 0001h:12CFh
PTR 08DCh 0001h:0E50h
PTR 3399h 0001h:7250h
PTR 0E84h 0001h:1A52h
PTR 3CF8h 0001h:22D2h
PTR 00F8h 0001h:07D4h
PTR 4AB3h 0001h:20D6h
OFFS 1796h os #3 additive
OFFS 17AFh os #3 additive
OFFS 19FCh os #3 additive
PTR 1D30h DOSCALLS.89
PTR 115Fh 0001h:095Ah
PTR 1C15h DOSCALLS.92
PTR 1360h VIOCALLS.VIOSCROLLDN
PTR 3D49h 0001h:295Fh
PTR 0868h 0001h:0EE2h
BASE 1BF3h 0001h:1B66h
PTR 124Dh 0001h:0165h
PTR 39A1h 0001h:1B66h
PTR 1180h 0001h:02E7h
PTR 1E2Fh 0001h:1E68h
PTR 110Bh VIOCALLS.VIOSETCURPOS
BASE 59F6h 0004h:0164h
PTR 29C9h 0001h:26EEh
PTR 1E26h 0001h:1DEEh
PTR 1C2Dh 0001h:1CEEh
PTR 1C56h 0001h:1D6Fh
BASE 4BB1h 0003h:0370h
PTR 00A1h VIOCALLS.VIOSETMODE
PTR 1222h 0001h:0576h
PTR 7273h 0001h:22F6h
PTR 43EBh 0001h:28F6h
Relocations: 235

Segment 0008h relocations

type offset target
PTR 0A16h 0004h:0164h
PTR 0A1Ah 0001h:167Dh
PTR 0294h 0002h:0000h
BASE 0A22h 0005h:0000h additive
PTR 0354h 0008h:02D4h
PTR 02A8h 0002h:0006h
PTR 0358h 0008h:02D6h
BASE 0A20h 0006h:0000h additive
BASE 0A1Eh 0007h:0000h additive
BASE 0510h 0008h:0000h
BASE 0A36h 0008h:0681h
PTR 035Ch 0008h:02E3h
BASE 0A38h 0008h:0683h
PTR 0360h 0008h:02ECh
PTR 0364h 0008h:02F7h
PTR 0368h 0008h:0302h
PTR 0394h 0008h:0384h
BASE 0A3Ah 0008h:0626h
PTR 0978h 0008h:0A08h
BASE 0A34h 0008h:062Ah additive
PTR 0A08h 0001h:3CC4h
PTR 0A12h 0001h:4D44h
PTR 036Ch 0008h:030Dh
PTR 02A0h 0008h:2C0Eh
PTR 0370h 0008h:0315h
PTR 0374h 0008h:031Dh
PTR 0378h 0008h:0327h
PTR 028Ch 0008h:2BA8h
PTR 037Ch 0008h:0330h
PTR 0A0Ch 0001h:1BE9h
PTR 0380h 0008h:033Dh
Relocations: 31
Michal Necasek
2007-02-06 15:01:01 UTC
Permalink
Post by Kevin G. Rhoads
Post by Michal Necasek
That's right - and there will be no extender in DOS, the executable
will run in real mode.
I suspect we are talking at cross purposes here.
Could be.
Post by Kevin G. Rhoads
FWIW - I built the program as a protected mode exe, then bound it.
Right, that is how binding works - the protected mode (ie. OS/2)
executable is used as input.
Post by Kevin G. Rhoads
Clearly BINDing is adding something, the EXE sizes are significantly
It is adding a NE loader and a miniature OS/2 API emulator.
Post by Kevin G. Rhoads
Clearly the DOS stub has been replaced and the replacement DOS stub in
sdb.exe allows the protected mode part (essentially sdp.exe) to run
under DOS (or a DOS emulation).
That is correct.
Post by Kevin G. Rhoads
Sounds like a DOS extender to me. One protected mode EXE with a DOS stub
that allows the protected mode EXE to run under DOS -- where doscalls.lib
and api.lib are the DOS extender pieces plus anything built into BIND that
gets added.
But it's not a DOS extender. Under DOS the 'protected mode' executable
will *not* run in protected mode.

Try this:

----
#include <stdio.h>
#include <stdlib.h>

void main( void )
{
printf( "_osmode = %d", _osmode );
}
----

Build with 'cl -Lp -Fb test.c' (on MSC 6.0 at least). Now, if you're
on Windows 2000 like me and run test.exe, it will print '1'. Run it
through forcedos and it'll print '0'.

Or even better, try port I/O, like reading from port 0x80. When run as
OS/2 executable, the program will (predictably) crash. When run as DOS
executable, it will happily run.


Michal
Kevin G. Rhoads
2007-02-06 15:32:10 UTC
Permalink
Post by Michal Necasek
Post by Kevin G. Rhoads
Clearly the DOS stub has been replaced and the replacement DOS stub in
sdb.exe allows the protected mode part (essentially sdp.exe) to run
under DOS (or a DOS emulation).
That is correct.
Post by Kevin G. Rhoads
Sounds like a DOS extender to me. One protected mode EXE with a DOS stub
that allows the protected mode EXE to run under DOS -- where doscalls.lib
and api.lib are the DOS extender pieces plus anything built into BIND that
gets added.
But it's not a DOS extender. Under DOS the 'protected mode' executable
will *not* run in protected mode.
So what exactly is your contention here? We agree that the protected mode
EXE is somehow being run under DOS -- are you asserting that it is running
in real mode?
Post by Michal Necasek
Now, if you're
on Windows 2000 like me and run test.exe, it will print '1'. Run it
through forcedos and it'll print '0'.
OK, I copied the source, built it with MS C 6 per your command line and
I get:
_osmode = 0
whether I run it directly or via FORCEDOS. I suspect that MS has probably
removed the last vestige of OS/2 16 protected mode support from XP, but it
is still in 2000. Even so, so what? What is this intended to prove?

The osmode variable is set by the RTL and I expect the RTL says different
things depending on whether it is running under a protected mode OS or
under protected mode via DOS extension.

I submit that all that this test proves is what the RTL is willing to report
to the EXE. The real question is whether the protected mode EXE is running
under protected mode or real mode -- and I suggest that it can't be running
under real mode, and that MS docs say you can't use CV.EXE but must use CVP.EXE
to debug bound EXEs is supporting evidence for that claim.
Post by Michal Necasek
Or even better, try port I/O, like reading from port 0x80. When run as
OS/2 executable, the program will (predictably) crash. When run as DOS
executable, it will happily run.
I don't disagree with, but I will note that Win32 PE EXEs, when bound
to a PharLap 386DOS or TNT-DOS extender, will be permitted direct access
to things they are thoroughly blocked from when run as native PE console
mode EXEs. I have less experience with OS/2, but suspect the same may
well apply.

You can take an 32 bit console mode PE EXE, bind it to the PharLap
extender, and it will run as an extended DOS EXE under DOS and as a Win32
PE EXE (native) under NT/2000/XP -- but if you bugger the DOS stub signature
by switching MZ to ZM, it will run as a DOS extended EXE even under Win32.
This trick has been used to get older 32 bit extended DOS EXEs to properly
run under NT/2000/XP when they use direct hardware access tricks.

But I am certain that 32 bit protected mode object code does not run in
16 bit real mode -- and yet it is permitted the same liberties of direct
hardware that DOS programs are when run as an extended DOS program. And
will be denied those liberties when run as a native protected mode program.
It is not the protected mode, but whether the OS "thinks" the EXE is a DOS
EXE or a native EXE that controls whether privileged access is allowed or
denied.

Perhaps we need something to dump the E-Flags to settle the issue definitively?
japheth
2007-02-06 17:03:24 UTC
Permalink
are you asserting that it is running in real mode?
According to Ray Duncan "Advanced OS/2 programming" it runs indeed in real-mode:
-----------------------------------------------------------------------------
Using BIND and API.LIB

The BIND utility converts a protected mode segmented executable file into
a file that can be executed in either protected mode or real mode. BIND
accomplishes this somewhat magical feat by appending a real mode loader to
the program, along with a real mode routine specific to each API service
that it uses. When the file is used in real mode, the API-specific
procedures remap the API call parameters into MS-DOS or ROM BIOS function
calls. When the file is loaded in protected mode, the real mode loader and
other routines appended by BIND are simply ignored.

The BIND utility can process any protected mode program. However, for the
file to be executed successfully, it must meet the following conditions:

þ The program cannot use any OS/2 kernel services that are not members of
the Family API when it is running in real mode.

þ The entire program and the code appended to it by BIND must fit into
the available "conventional" memory space (below 640 KB).
-----------------------------------------------------------------------------

Regretably I don't find the API.LIB file currently, then I would verify that
with a simple asm program. Displaying the value of CS might give a better hint
than the flags register.
Michal Necasek
2007-02-06 17:32:22 UTC
Permalink
Post by japheth
Regretably I don't find the API.LIB file currently, then I would verify
that with a simple asm program. Displaying the value of CS might give a
better hint than the flags register.
The most conclusive test would be running the executable on an 8086 :)
Even a 80186 would do. But the oldest I have is a 286 (which, in fact,
can run OS/2 1.x).

API.LIB was shipped with most MS language products around 1988-1990,
notably MSC 6.0 and MASM 6.0.


Michal
Frank Beythien
2007-02-06 19:43:40 UTC
Permalink
On Tue, 6 Feb 2007 17:03:24 UTC japheth <***@japheth.de> wrote:

----------------------------------------------------------------------
-------
Post by japheth
Regretably I don't find the API.LIB file currently, then I would verify that
with a simple asm program. Displaying the value of CS might give a better hint
than the flags register.
It comes with OS/2 DDK masm 6.0. Do you want it?

CU/2
--
Frank Beythien fBeythien AT gmx.de
Michal Necasek
2007-02-06 17:22:41 UTC
Permalink
Post by Kevin G. Rhoads
So what exactly is your contention here? We agree that the protected mode
EXE is somehow being run under DOS -- are you asserting that it is running
in real mode?
Exactly.

In fact, look up the BIND documentation. It says (QuickHelp, MSC 6.0):
"BIND converts protected-mode programs to run in real mode as well as
protected mode."
Post by Kevin G. Rhoads
OK, I copied the source, built it with MS C 6 per your command line and
_osmode = 0
whether I run it directly or via FORCEDOS. I suspect that MS has probably
removed the last vestige of OS/2 16 protected mode support from XP, but it
is still in 2000. Even so, so what? What is this intended to prove?
That the same executable can run in real and protected mode. And yes,
the OS/2 support was removed in XP.
Post by Kevin G. Rhoads
I submit that all that this test proves is what the RTL is willing to report
to the EXE. The real question is whether the protected mode EXE is running
under protected mode or real mode -- and I suggest that it can't be running
under real mode, and that MS docs say you can't use CV.EXE but must use CVP.EXE
to debug bound EXEs is supporting evidence for that claim.
No. I'm pretty sure the reason for CVP is that CV doesn't understand
NE modules.
Post by Kevin G. Rhoads
I don't disagree with, but I will note that Win32 PE EXEs, when bound
to a PharLap 386DOS or TNT-DOS extender, will be permitted direct access
to things they are thoroughly blocked from when run as native PE console
mode EXEs. I have less experience with OS/2, but suspect the same may
well apply.
It might, but there's no extender in play here ;)
Post by Kevin G. Rhoads
But I am certain that 32 bit protected mode object code does not run in
Perhaps we need something to dump the E-Flags to settle the issue definitively?
Yes, except in NT, the system will of course be in protected mode all
the time. However, one might check the V86 flag. My tests indicate (not
surprisingly) that when run in the W2K OS/2 subsystem, the V86 flag is
not set. Using forcedos, the V86 flag, as well as VIF flag, is set.

To get the high word of eflags, I used this code:

__asm {
_emit 0x66
pushf
pop ax
pop ax
mov eflags_hi,ax
}

Convinced now? :)


Michal
Kevin G. Rhoads
2007-02-06 17:44:15 UTC
Permalink
Post by Michal Necasek
Post by Kevin G. Rhoads
So what exactly is your contention here? We agree that the protected mode
EXE is somehow being run under DOS -- are you asserting that it is running
in real mode?
Exactly.
"BIND converts protected-mode programs to run in real mode as well as
protected mode."
....
Convinced now? :)
Yes, convinced. And happy to have learned something. Even if archaic arcana.

Thanks Michal & Japheth for your input.
japheth
2007-02-06 17:46:07 UTC
Permalink
Post by Michal Necasek
However, one might check the V86 flag. My tests indicate (not
surprisingly) that when run in the W2K OS/2 subsystem, the V86 flag is
not set. Using forcedos, the V86 flag, as well as VIF flag, is set.
__asm {
_emit 0x66
pushf
pop ax
pop ax
mov eflags_hi,ax
}
Convinced now? :)
No, reading the v86 flag in ring 3 proves nothing. Indeed this flag is kind of
"write-only", because it can only be accessed in ring 0, and when the cpu is
in ring 0, the flag will be 0.

in v86-mode and IOPL=3 (the most "honest" environment for getting EFL) a try
to read the v86-flag will always return 0.
Michal Necasek
2007-02-06 17:52:04 UTC
Permalink
Post by japheth
No, reading the v86 flag in ring 3 proves nothing.
Well, sure, under NT the program could be run under an emulator and
ultimately nothing proves anything for sufficient level of pedantry.
Post by japheth
Indeed this flag is
kind of "write-only", because it can only be accessed in ring 0, and
when the cpu is in ring 0, the flag will be 0.
Under NT, I think we can safely dismiss the possibility of the app
running at ring 0.
Post by japheth
in v86-mode and IOPL=3 (the most "honest" environment for getting EFL) a
try to read the v86-flag will always return 0.
OK... but when the V86 flag *is* set, what does that mean?


Michal
japheth
2007-02-06 18:28:42 UTC
Permalink
Post by Michal Necasek
OK... but when the V86 flag *is* set, what does that mean?
Ok, admitted, if V86 is set it is ensured that EFL is "virtual". And since EFL
can only be virtual in v86-mode ...
Paul S. Person
2007-02-05 18:16:09 UTC
Permalink
On Mon, 05 Feb 2007 14:58:40 +0000, "Kevin G. Rhoads"
Post by Kevin G. Rhoads
Post by Paul S. Person
Is there such a thing as a 16-bit OS/2 extender analogous to the
various 32-bit DOS extenders and Win386?
I don't think this is what you had in mind, but many 16 DOS extenders
actually used OS/2 16-bit protected mode console style programs as
the base and supplied a subset of OS/2 16 bit protected mode services
as part of the DOS extender.
Not really, no. I had in mind something that would allow 32-bit OS/2
code to run on 16-bit-only OS/2. Which I did not expect would exist,
but wanted (and have received) confirmation of the non-existence of
such a thing so that the tutorial's statements would be as accurate as
possible.

As I said, it was a /silly/ question!
--
"He who should know the history of words
would know all history"
Loading...