news:2c7c72eb-f9a5-4d00...@googlegroups.com...
...
[from the other post]
> => Does this means in DOS mode default mode is PIC(8259) mode,
> NOT APIC mode ? right ? (then I can focus on other aspects to solve
> my problem...)
>
Yes. (I believe so.)
> > The mention of DOS32/A suggests this is a DPMI application. Are you
> > compiling for 16-bit RM DOS as "wcl/l=dos" or for 32-bit DOS PM DPMI
> > as "wcl386/l=dos4g" ?
>
> => I have some questions about above statement and please point out
> the mistakes for corrections because I am the newbie on DOS extender...
>
> First after checking "all" my makefiles I found keyword "dos4g" is
>NOT used. The content of my "main" make file is as follows(part):
It appears you're using 'wpp386' which is the compiler for C++ where the
target is os2 ("/l=os2") and using 'wlink' to link.
Is this for OS2? I assumed this was for DOS because of the DOS32/A ... Or,
is this for DOS because of the DOS32/A but via OS2 objects ... ?
Well, there's no C++ equivalent to the 'wcl386' combination (i.e., PM C
compiler 'wcc386' and linker 'wlink'). If there was an equivalent of
'wpp386' and 'wlink', it'd be named wpl386'. If it did exist, what you're
basically doing with your link files is 'wpl386/l=os2' and then stubbing
with DOS32/A. See the "wc*.exe" and "wp*.exe" files in 'binw'.
> Thus I will say I found no "dos4g" in my makefile...! Could I ask
> why "wcl386/l=dos4g" is required if installing PM handler ?
As you can see from your link files, it's definately not required. I was
just trying to find out if you were building a 16-bit DOS or 32-bit DPMI
application. It seems you're building for OS2 and DOS DPMI?
The "/l=dos4g" is the default way of building a DPMI application for DOS.
I'm not familiar with OS2. From what I gather, OS2 might support two types
of 32-bit applications: 32-bit OS2 applications and DOS DPMI (32-bit). But,
I'm not sure...
You're using 'stub' directive in one of the linker files to build using
DOS32/A as a replacement stub. You could also unstub DOS4GW
and restub with DOS32/A.
> Second I want to know why using "dos4g" instead of "dos32a" ?
> (I am using DOS/32a and not dos4g or dos4gw...)
DOS4GW comes with OpenWatcom. OpenWatcom also has command line
options ("/l=dos4g") to build for it for 'wcl386' (C not C++). See pguide.
> Do I lose something ?
No, I think your setup is probably correct. I made some assumptions about
your setup. Because of wpp386, you probably had to use linker files to
link, since there is no "wpl386".
I would question why you're building a DOS and DPMI application by stubbing
an OS2 LE. I don't understand that. OpenWatcom will build for DOS and
build DOS4GW (DPMI) applications directly. So, if you're not using OS2,
you might consider reworking your linker files.
Someday, you might try changing the "format os2 le" to "format dos" and
adding a "system dos4g". The "system" directive has a number of OS2 options
also. See lguide.
> => Does above mean: I have to setup both the PM and RM handlers, that is,
> bimodal interrupt support ?
No, but you can, if that's needed...
Most of the time, you only need one interrupt routine and usually only for
one mode, either RM or PM but typically not both. Sometimes, you need a
routine for both modes (PM and RM). For that, you'll install one handler if
one is not already installed (i.e., BIOS interrupt). Then, you'll install a
callback for the other handler. The callback switches modes and calls the
other handler in the other mode. You only need two handlers if the RM and
PM routines need to be different or the two handlers have identical
functionality for speed. I.e., RM interrupt calls BIOS and PM interrupt is
custom code or has debugging info or you need to eliminate callback
overhead.
E.g., if you're using the a BIOS RM interrupt routine for an interrupt and
you need the routine for PM too, you'll install a callback for PM. So, if
an interrupt occurs in RM, the original RM routine is called. If an
interrupt occurs in PM, the PM interrupt routine switches to RM and calls
the RM interrupt. Once finished, it returns to PM.
E.g., if you're installing an interrupt for PM and there is no RM interrupt
routine, you'll install a callback for RM. So, if an interrupt occurs in
PM, then the PM interrupt routine is called. If an interrupt occurs in RM,
the RM interrupt switches to PM and calls the PM routine. Once finished, it
returns to RM.
So, for any interrupt with DPMI:
RM interrupt routine - no PM interrupt routine (*)
RM interrupt routine - PM callback (calls RM interrupt)
no RM interrupt routine - PM interrupt routine
RM callback (calls PM interrupt) - PM interrupt routine
RM interrupt routine - PM interrupt routine
no RM interrupt routine - no PM interrupt routine (**)
(*) usually the default, i.e., for BIOS and DOS interrupts in RM
(**) default for RM interrupts without a routine
Whether the RM or PM interrupt is called depends on which mode the cpu is in
when the interrupt occurs. With DPMI, the DPMI host is switching between RM
and PM, repeatedly, quickly. Some of this is because there are a few
interrupts that are redirected per the DPMI specification. For DPMI
applications, many of the interrupt routines that people use are BIOS and
DOS which are RM interrupts. So, using a PM callback to RM is common. PM
interrupt routines have to be written by you, just like additional RM
interrupt routines. Or, PM callbacks have to be installed by you. Except
for DPMI calls, no interrupts are installed in PM. You must do it.
> => I did not use the int386x() but I used assembly language
> by #pragma aux ... to implement DPMI calls(int 31h)
That'll work. I prefer what's provided by OpenWatcom when available. I
hope that's more compatible, more complete, more tested, etc. #pragma aux
the last time I looked was thoroughly undocumented and had some quirks.
Also, for DJGPP, I noticed some of the DPMI assembly routines were quite
large.
> => I used DPMI calls 0x204 and 0x205 to get/set
> interrupt vector but still failed before...
Well, good luck. Start simple. Test RM. Test PM.
I personally had a variety of issues when first attempting DPMI. I just had
to work through them. I found I had problems with certain DJGPP functions,
but others worked well. So, I avoid those. DPMI does have some intracies
too, especially if accessing via assembly. E.g., wrong mode, saving stacks,
...
Rod Pemberton