Real mode Interrupts and pointers in Protected Mode 
Author Message
 Real mode Interrupts and pointers in Protected Mode

Hi,

this is a question to all the protected mode specialists out there.

Im just writing a Vesa Svga unit for protected mode. (BP standard
DPMI interface).

What I need to complete the project is some info about calling
real mode interrupts.

Interrupts that dont need Pointers or dont return Pointers are no
problem.

---------------------------------------------------------------------

But when I initialize the Vesa-Interface I have to call the interrupt
with the address of a info-buffer to be filled in the es,di registers.
As my programm runs in protected mode the format of my pointer is :
  selector:offset

I tried to convert this into a real mode address by the following
formula :
  linear address = BaseAddress(selector)+Offset;
  real segment = linear address and $FFFF
  real offset  = linear address div 16;

But as far as I know I cant set the register es with a value, that is
no valid selector.

So I tried the Pascal function Intr from the dos unit.

But as I called the Interrupt my buffer was still empty.

---------------------------------------------------------------------

My second problem are interrupts, that return pointers.

e.g. the Bios Interrupt, that returns the address of the Character
Table.

This interrupt (int 10 , function $1130 , subfunction $03) should
return the address of the table in es:bp.

But when I call the interrupt only the bp register has changed. The
es register is still the same as before. Pehaps this is again the
problem, that a segment register cant hold the value of a real mode
segment.

So how does pascal solve this problem ?
Do they have an extra structure, that contains the real mode segments
after an interrupt call ??

As I know the table is in Segment $C000 I can combine
$C000:bp to the pointer on the table by converting the segment to
a selector. But this is a very bad method to solve this problem.

I would be really happy if anyone could tell me how to fix these
problems

many thanks in advance

   Chris

(Could you please reply by mail and posting , because this group
 is to large for me to download everytime)

--------------------------------------------------------------------------------

Leharstrasse 15    | the bright side | Phone: 06205/13833
68799 Reilingen    |    of life      | WWW  : http://www.*-*-*.com/ ~un7d/



Wed, 18 Jun 1902 08:00:00 GMT  
 Real mode Interrupts and pointers in Protected Mode

Quote:
>this is a question to all the protected mode specialists out there.
>Im just writing a Vesa Svga unit for protected mode. (BP standard
>DPMI interface).
>What I need to complete the project is some info about calling
>real mode interrupts.

.
.
.

To communicate with real mode interrupts you need to have your data
structure allocated in low memory. You can allocate it using GlobalDosAlloc
from WinAPI.

Quote:
>My second problem are interrupts, that return pointers.

.
.
.

There is a procedure for converting a real mode adress to a protected mode
one (allocating a selector), it's as well in WinAPI. I don't remember its
name. Try to look for some unit for work under DPMI - you should find it
e.g. in SWAG.




Wed, 18 Jun 1902 08:00:00 GMT  
 Real mode Interrupts and pointers in Protected Mode

Quote:
>There is a procedure for converting a real mode adress to a protected mode
>one (allocating a selector), it's as well in WinAPI. I don't remember its
>name. Try to look for some unit for work under DPMI - you should find it
>e.g. in SWAG.



The conversion from realmode segments to selectors functions all right.
But the interrupt just doesn't change the es register so I got nothing
to convert.

I am calling the interrupt directly via the inline asm (int $10).

So my question is :
  Is there another function in the WinAPI to call realmode interrupts or is the
  direct way all right.

  (As far as I know the direct way is not possible, because you can't hold
  a realmode seg in es when you are in protected mode.)

bye
  Chris

--
------------------------------------------------------------------------------

Leharstr. 15                                 http://www.uni-karlsruhe.de/~un7d
68799 Reilingen    Germany      
------------------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 Real mode Interrupts and pointers in Protected Mode

Quote:
>There is a procedure for converting a real mode adress to a protected mode
>one (allocating a selector), it's as well in WinAPI. I don't remember its
>name. Try to look for some unit for work under DPMI - you should find it
>e.g. in SWAG.



The conversion from realmode segments to selectors functions all right.
But the interrupt just doesn't change the es register so I got nothing
to convert.

I am calling the interrupt directly via the inline asm (int $10).

So my question is :
  Is there another function in the WinAPI to call realmode interrupts or is the
  direct way all right.

  (As far as I know the direct way is not possible, because you can't hold
  a realmode seg in es when you are in protected mode.)

bye
  Chris

--
------------------------------------------------------------------------------

Leharstr. 15                                 http://www.uni-karlsruhe.de/~un7d
68799 Reilingen    Germany      
------------------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 Real mode Interrupts and pointers in Protected Mode

Quote:
>There is a procedure for converting a real mode adress to a protected mode
>one (allocating a selector), it's as well in WinAPI. I don't remember its
>name. Try to look for some unit for work under DPMI - you should find it
>e.g. in SWAG.



The conversion from realmode segments to selectors functions all right.
But the interrupt just doesn't change the es register so I got nothing
to convert.

I am calling the interrupt directly via the inline asm (int $10).

So my question is :
  Is there another function in the WinAPI to call realmode interrupts or is the
  direct way all right.

  (As far as I know the direct way is not possible, because you can't hold
  a realmode seg in es when you are in protected mode.)

bye
  Chris

--
------------------------------------------------------------------------------

Leharstr. 15                                 http://www.uni-karlsruhe.de/~un7d
68799 Reilingen    Germany      
------------------------------------------------------------------------------



Wed, 18 Jun 1902 08:00:00 GMT  
 Real mode Interrupts and pointers in Protected Mode

Quote:
> >There is a procedure for converting a real mode adress to a protected mode
> >one (allocating a selector), it's as well in WinAPI. I don't remember its
> >name. Try to look for some unit for work under DPMI - you should find it
> >e.g. in SWAG.


> The conversion from realmode segments to selectors functions all right.
> But the interrupt just doesn't change the es register so I got nothing
> to convert.

> I am calling the interrupt directly via the inline asm (int $10).

> So my question is :
>   Is there another function in the WinAPI to call realmode interrupts or is
> the   direct way all right.

>   (As far as I know the direct way is not possible, because you can't hold
>   a realmode seg in es when you are in protected mode.)

Have a look at this: (from R. Brown's Interrupt List 48)

INT 31 0300 - DPMI 0.9+ - SIMULATE REAL MODE INTERRUPT

available only in protected mode

Category: E - DOS extenders

Inp.:
        AX = 0300h
        BL = interrupt number
        BH = flags
            bit 0: reset the interrupt controller and A20 line (DPMI 0.9)
                    reserved, must be 0 (DPMI 1.0+)
            others: reserved, must be 0
        CX = number of words to copy from protected mode to real mode stack
        ES:(E)DI = selector:offset of real mode call structure (see #2298)
Return: CF clear if successful
            real mode call structure modified (all fields except SS:SP, CS:IP
            filled with return values from real mode interrupt)
        CF set on error
            AX = error code (DPMI 1.0+) (8012h,8013h,8014h,8021h)(see #2293)
        protected mode stack unchanged

Notes:  16-bit programs use ES:DI as pointer, 32-bit programs use ES:EDI
        CS:IP in the real mode call structure is ignored for this call,
        instead, the indicated interrupt vector is used for the address
        the flags in the call structure are pushed on the real mode stack to
        form an interrupt stack frame, and the trace and interrupt flags are
        clear on entry to the handler
        DPMI will provide a small (30 words) real mode stack if SS:SP is zero
        the real mode handler must return with the stack in the same state as
        it was on being called
SeeAlso: AX=0302h,AX=FF01h,INT 21/AX=2511h,INT 21/AH=E3h"OS/286"
SeeAlso: INT 2C/AX=0026h,INT 2F/AX=FB42h/BX=000Dh
---
31 0300 Format of DPMI real mode call structure:

Copy to Main

Table 2298
Format of DPMI real mode call structure:
Offset  Size    Description    
 00h    DWORD   EDI
 04h    DWORD   ESI
 08h    DWORD   EBP
 0Ch    DWORD   reserved (00h)
 10h    DWORD   EBX
 14h    DWORD   EDX
 18h    DWORD   ECX
 1Ch    DWORD   EAX
 20h    WORD    flags
 22h    WORD    ES
 24h    WORD    DS
 26h    WORD    FS
 28h    WORD    GS
 2Ah    WORD    IP
 2Ch    WORD    CS
 2Eh    WORD    SP
 30h    WORD    SS
INT 31 0300
Copied from Ralf Brown's Interrupt List

================================================================================

================================================================================



Wed, 18 Jun 1902 08:00:00 GMT  
 Real mode Interrupts and pointers in Protected Mode

Quote:

>  Is there another function in the WinAPI to call realmode interrupts or is the
>  direct way all right.

I'm not sure about the video interrupt, but INT 21 (DOS) that are
'documented' can be accessed directly (you still need GlobalDosAlloc
btw) and 'undocumented' (not known by the DPMI server) interrupts
must be accessed by a DPMI call. Try accessing it directly. If it
GPFs, you will probably need that call.

-----------------------------
Jonathan L. Zarate  
http://www.mailhost.net/~jlz/



Wed, 18 Jun 1902 08:00:00 GMT  
 Real mode Interrupts and pointers in Protected Mode

Quote:

>>There is a procedure for converting a real mode adress to a protected mode
>>one (allocating a selector), it's as well in WinAPI. I don't remember its
>>name. Try to look for some unit for work under DPMI - you should find it
>>e.g. in SWAG.


>The conversion from realmode segments to selectors functions all right.
>But the interrupt just doesn't change the es register so I got nothing
>to convert.
>I am calling the interrupt directly via the inline asm (int $10).
>So my question is :
>  Is there another function in the WinAPI to call realmode interrupts or is the
>  direct way all right.
>  (As far as I know the direct way is not possible, because you can't hold
>  a realmode seg in es when you are in protected mode.)
>bye
>  Chris
>--
>------------------------------------------------------------------------------

>Leharstr. 15                                 http://www.uni-karlsruhe.de/~un7d
>68799 Reilingen    Germany      
>------------------------------------------------------------------------------

You should take a look at 'Turbopower FTP'  : look for a file called
'EZDPMI' all the hardwork already done. Should solve all your
problems. Mapping realmode address and etc. If you can't find the file
let me know.

Hope this helps,



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Protected mode VS Real mode ???

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

3. Protected mode vs. Real mode

4. Vesa unit for all 256 and 65K color modes (protected,real mode)

5. Real mode > protected mode, BGI error :-(

6. real mode interrupt detection

7. Detecting Protected/Real mode

8. Protected mode interrupt registers and stack?

9. protected mode and interrupts ???

10. real /protected mode

11. Interrupts in Protected Mode

 

 
Powered by phpBB® Forum Software