Board index » delphi » Real Mode from Protected Mode: Accessing an RMode TSR from PMode

Real Mode from Protected Mode: Accessing an RMode TSR from PMode

We are having great difficulty with project that requires us to locate a
real-mode TSR that intercepts the keyboard interrupt, and change one byte
in that TSR's data segment allowing us to control the TSR.  We have been
successful in doing this if our test program is compiled in real mode,
but the final product must be compiled in Protected mode.  We have had no
success in getting this to wotk with a PMode program.

When we try to use the address from the INT #21 call, we point off to
somewhere useless.  We need some way to 1) interpret the Segment
Descriptor we receive in a manner that is useful, 2) find a way to put a
portion of our protected mode program into real mode, manage the TSR,
then return to protected mode, or 3) find another answer.  

We are looking at using both Borland Pascal 7.0 and Turbo Assembler 3.2
linked together for our answer (but solutions not requiring TA 3.2 very
welcome)!

Help please!

Daniel Bragg

 

Re:Real Mode from Protected Mode: Accessing an RMode TSR from PMode


On Thu, 27 Feb 1997 16:42:58 -0800, Daniel Bragg

Quote
<chro...@samart.co.th> wrote:
>We are having great difficulty with project that requires us to locate a
>real-mode TSR that intercepts the keyboard interrupt, and change one byte
>in that TSR's data segment allowing us to control the TSR.  We have been
>successful in doing this if our test program is compiled in real mode,
>but the final product must be compiled in Protected mode.  We have had no
>success in getting this to wotk with a PMode program.

>When we try to use the address from the INT #21 call, we point off to
>somewhere useless.  We need some way to 1) interpret the Segment
>Descriptor we receive in a manner that is useful, 2) find a way to put a
>portion of our protected mode program into real mode, manage the TSR,
>then return to protected mode, or 3) find another answer.  

  Two usefull functions here are:
1) GlobalDOSAlloc (int 31h, fn 0100h) and
2) Segment2Selector (int 31h, fn 0002h)

Quote

>We are looking at using both Borland Pascal 7.0 and Turbo Assembler 3.2
>linked together for our answer (but solutions not requiring TA 3.2 very
>welcome)!

>Help please!

>Daniel Bragg

********************************
*   EB0A90486921203A290A0D24   *
*      BA0310B409CD21CD20      *
********************************

Re:Real Mode from Protected Mode: Accessing an RMode TSR from PMode


On Thu, 27 Feb 1997 11:25:56 GMT,

Quote
nin...@redline.ru  <nin...@redline.ru> wrote:
>On Thu, 27 Feb 1997 16:42:58 -0800, Daniel Bragg
><chro...@samart.co.th> wrote:

>>We are having great difficulty with project that requires us to locate a
>>real-mode TSR that intercepts the keyboard interrupt, and change one byte
>>in that TSR's data segment allowing us to control the TSR.  We have been
>>successful in doing this if our test program is compiled in real mode,
>>but the final product must be compiled in Protected mode.  We have had no
>>success in getting this to wotk with a PMode program.

The easiest way might be to have your TSR hook itself to an unused
software INT and have it accept data though this INT.  You can pass
the control byte in a register.  You can make INT calls in prot mode
and the RTM code properly reflects it as a real-mode INT.

If that is not the way you want to go, then you'll have to write some
rather complex code to peek at memory to find your TSR and directly
set the value.  You'll need to use the DPMI calls to set up a
descriptor.  Not particularly easy but it can be done.

-----------------------------------------------------------------------
George R. Gonzalez                        g...@boombox.micro.umn.edu
Sr. Sys. Programmer                       University of Minnesota

Re:Real Mode from Protected Mode: Accessing an RMode TSR from PMode


Quote
Daniel Bragg wrote:

> We are having great difficulty with project that requires us to locate a
> real-mode TSR that intercepts the keyboard interrupt, and change one byte
> in that TSR's data segment allowing us to control the TSR.  We have been
> successful in doing this if our test program is compiled in real mode,
> but the final product must be compiled in Protected mode.  We have had no
> success in getting this to wotk with a PMode program.

> When we try to use the address from the INT #21 call, we point off to
> somewhere useless.  We need some way to 1) interpret the Segment
> Descriptor we receive in a manner that is useful, 2) find a way to put a
> portion of our protected mode program into real mode, manage the TSR,
> then return to protected mode, or 3) find another answer.

> We are looking at using both Borland Pascal 7.0 and Turbo Assembler 3.2
> linked together for our answer (but solutions not requiring TA 3.2 very
> welcome)!

> Help please!

> Daniel Bragg

--
Give a smile...Get a smile :)
**********************************
        Lars Indresaeter
      Mailto:lindr...@sn.no
One of my classmates made a similar programm. He used GetIntVec and Keep
to keep it resident..
You probably know allready that you need IntVec no. 9.
If you intend to change the contenst of the prog. then you need an
external file where you can write a status. And then use a IF
statement..
Good luck.. Remember that in protected mode you have only base memory.
So if you are going go use an external file exept from the TSR, stay
within 0 - 640k...
Hope it makes sense, and that it can be any help..

Other Threads