[fpc-pascal]BIOS PnP function far call (go32v2)

Nikolay Nikolov nickysn1983 at netscape.net
Tue Sep 9 16:15:58 CEST 2003

Lubomir.Cabla at cssz.cz wrote:

>under GO32V2 i want to call BIOS PnP function with entry point
>        db $FF,$1E; dw PnP_EntryPoint
>        call DWord ptr [PnP_EntryPoint]
>but always i got error "SIGSEGV - segmentation violation".
>PnP_EntryPoint (type pointer) is normally somewhere in BIOS area at
>But i don't know how can i do that
>-> "make a readable and writable data segment descriptor".
>And the second problem is how can i make a pointer
>"PnP_EntryPoint" to this real memory area.
>Under real DOS with BP7 it is O.K.
Read the docs for the go32 unit (in doc\units.pdf) or some protected 
mode / DPMI tutorial.

You can create descriptors with the allocate_ldt_descriptors function. 
Then you can use other functions to set the access rights and limit of 
the descriptor, etc...

In BP7 it works, because you're in real mode. In FPC/go32v2 you're in 
protected mode so you can't call directly code that was designed to run 
in real mode. You should use the DPMI services. Some newer BIOS 
functions can be called directly from protected mode (as well as real 
mode), but they require that you set up some special code and data 
segment descriptors. (the VBE3 functions support that, I guess the PnP 
functions are the same, although I never used them) All this can be done 
using DPMI (the go32 unit) but you should know how protected mode works. :)

More information about the fpc-pascal mailing list