[fpc-pascal]GPF when accessing DOS memory
Sebastian Schuberth
s.schuberth at gmx.net
Thu Oct 5 13:15:06 CEST 2000
Hi there!
I'm currently modifiying some of my TMT Pascal sources so they to work
with
Free Pascal, too. Unfortunately I get a GPF (runtime error 216) when
executing
to following code, which works fine under TMT:
--8<--(BEGIN vbe.pas)--
Const
VBE2=$32454256;
Type
PDOSMemoryBlock=^DOSMemoryBlock;
DOSMemoryBlock=Record
Segment,Selector:Word;
End;
PCtrlInfoBlock=^CtrlInfoBlock;
CtrlInfoBlock=Packed Record
Signature:Cardinal;
Version:Word;
OEMStringPtr:PChar;
Capabilities:Cardinal;
VideoModePtr:PWord;
TotalMemory:Word;
OEMSoftwareRev:Word;
OEMVendorNamePtr:PChar;
OEMProductNamePtr:PChar;
OEMProductRevPtr:PChar;
Reserved_222:Array[0..221] Of Byte;
OEMData:Array[0..255] Of Byte;
End;
Var
CIB:PCtrlInfoBlock
CIBMem:PDOSMemoryBlock;
{ ... }
New(CIBMem);
{ Allocate DOS memory block and save segment / selector }
If Not dpmiAllocDOSMem(SizeOf(CIB^), at CIBMem^.Segment, at CIBMem^.Selector)
Then Exit;
{ Make CIB point to DOS memory }
CIB:=Ptr(CIBMem^.Segment,0);
{ Write 'VBE2' signature into DOS memory, THIS IS WHERE FPC CRASHES }
CIB^.Signature:=VBE2;
{ ... }
--8<--(END vbe.pas)--
For some reason FPC (or better: GO32V2?) won't let me write into the
allocated DOS
memory area. But why, it works under TMT (which uses PMODE/W). Is there
any DPMI
call I need to insert for FPC? BTW: I don't want to use functions from
the GO32 unit
if possible, because the code should be fully portable. I'd rather
recode the needed
functions myself.
Thanks in advance.
--
Sebastian Schuberth
More information about the fpc-pascal
mailing list