mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 09:49:12 +02:00
* bugfix in getmodeinfo (SizeOf(TModeInfo) -> SizeOf(TVESAModeInfo))
* as the result of the above bugfix, the graph unit doesn't crash anymore under FPC if compiler with -dsupportVESA, but it doesn't work yet either...
This commit is contained in:
parent
727d5d3100
commit
3f127e3afc
@ -153,7 +153,7 @@ end;
|
|||||||
VESAPtr := pointer(Ptrlong shl 16);
|
VESAPtr := pointer(Ptrlong shl 16);
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
Ptrlong:=Global_Dos_Alloc(sizeof(TVESAInfo));
|
Ptrlong:=Global_Dos_Alloc(sizeof(TVESAInfo));
|
||||||
Getmem(VESAPtr,SizeOf(TVESAInfo));
|
New(VESAPtr);
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
{ Get segment value }
|
{ Get segment value }
|
||||||
RealSeg := word(Ptrlong shr 16);
|
RealSeg := word(Ptrlong shr 16);
|
||||||
@ -177,9 +177,10 @@ end;
|
|||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
GlobalDosFree(word(PtrLong and $ffff));
|
GlobalDosFree(word(PtrLong and $ffff));
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
Global_Dos_Free(word(PtrLong and $ffff));
|
If not Global_Dos_Free(word(PtrLong and $ffff)) then
|
||||||
|
RunError(216);
|
||||||
{ also free the extra allocated buffer }
|
{ also free the extra allocated buffer }
|
||||||
Freemem(VESAPtr,SizeOf(TVESAInfo));
|
Dispose(VESAPtr);
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
exit;
|
exit;
|
||||||
end
|
end
|
||||||
@ -224,9 +225,9 @@ end;
|
|||||||
{ copy VESA mode information to a protected mode buffer and }
|
{ copy VESA mode information to a protected mode buffer and }
|
||||||
{ then free the real mode buffer... }
|
{ then free the real mode buffer... }
|
||||||
Move(VESAPtr^, VESAInfo, sizeof(TVESAInfo));
|
Move(VESAPtr^, VESAInfo, sizeof(TVESAInfo));
|
||||||
Global_Dos_Free(word(PtrLong and $ffff));
|
If not Global_Dos_Free(word(PtrLong and $ffff)) then
|
||||||
Freemem(VESAPtr,SizeOf(TVESAInfo));
|
RunError(216);
|
||||||
|
Dispose(VESAPtr);
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
|
|
||||||
i:=0;
|
i:=0;
|
||||||
@ -249,20 +250,20 @@ end;
|
|||||||
var
|
var
|
||||||
Ptr: longint;
|
Ptr: longint;
|
||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
VESAPtr : ^TModeInfo;
|
VESAPtr : ^TVESAModeInfo;
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
regs : TDPMIRegisters;
|
regs : TDPMIRegisters;
|
||||||
RealSeg: word;
|
RealSeg: word;
|
||||||
begin
|
begin
|
||||||
{ Alllocate real mode buffer }
|
{ Alllocate real mode buffer }
|
||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
Ptr:=GlobalDosAlloc(sizeof(TModeInfo));
|
Ptr:=GlobalDosAlloc(sizeof(TVESAModeInfo));
|
||||||
{ get the selector value }
|
{ get the selector value }
|
||||||
VESAPtr := pointer(longint(Ptr shl 16));
|
VESAPtr := pointer(longint(Ptr shl 16));
|
||||||
if not assigned(VESAPtr) then
|
if not assigned(VESAPtr) then
|
||||||
RunError(203);
|
RunError(203);
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
Ptr:=Global_Dos_Alloc(sizeof(TModeInfo));
|
Ptr:=Global_Dos_Alloc(sizeof(TVESAModeInfo));
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
{ get the segment value }
|
{ get the segment value }
|
||||||
RealSeg := word(Ptr shr 16);
|
RealSeg := word(Ptr shr 16);
|
||||||
@ -280,15 +281,16 @@ end;
|
|||||||
getModeInfo := TRUE;
|
getModeInfo := TRUE;
|
||||||
{ copy to protected mode buffer ... }
|
{ copy to protected mode buffer ... }
|
||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
Move(VESAPtr^, ModeInfo, sizeof(TModeInfo));
|
Move(VESAPtr^, ModeInfo, sizeof(TVESAModeInfo));
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
DosMemGet(RealSeg,0,ModeInfo,sizeof(TModeInfo));
|
DosMemGet(RealSeg,0,ModeInfo,sizeof(TVESAModeInfo));
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
{ free real mode memory }
|
{ free real mode memory }
|
||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
GlobalDosFree(Word(Ptr and $ffff));
|
GlobalDosFree(Word(Ptr and $ffff));
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
Global_Dos_Free(Word(Ptr and $ffff));
|
If not Global_Dos_Free(Word(Ptr and $ffff)) then
|
||||||
|
RunError(216);
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -354,8 +356,8 @@ end;
|
|||||||
{ we have to init everything to zero, since VBE < 1.1 }
|
{ we have to init everything to zero, since VBE < 1.1 }
|
||||||
{ may not setup fields correctly. }
|
{ may not setup fields correctly. }
|
||||||
FillChar(ModeInfo, sizeof(ModeInfo), #0);
|
FillChar(ModeInfo, sizeof(ModeInfo), #0);
|
||||||
GetModeInfo(ModeInfo, Mode);
|
If GetModeInfo(ModeInfo, Mode) And
|
||||||
if (ModeInfo.attr and modeAvail) <> 0 then
|
((ModeInfo.attr and modeAvail) <> 0) then
|
||||||
ModeSupported := TRUE
|
ModeSupported := TRUE
|
||||||
else
|
else
|
||||||
ModeSupported := FALSE;
|
ModeSupported := FALSE;
|
||||||
@ -459,7 +461,7 @@ end;
|
|||||||
Y:= Y + StartYViewPort;
|
Y:= Y + StartYViewPort;
|
||||||
offs := longint(y) * BytesPerLine + x;
|
offs := longint(y) * BytesPerLine + x;
|
||||||
SetReadBank(integer(offs shr 16));
|
SetReadBank(integer(offs shr 16));
|
||||||
GetPixVESA256:=mem[WinWriteSeg : word(offs)];
|
GetPixVESA256:=mem[WinReadSeg : word(offs)];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{************************************************************************}
|
{************************************************************************}
|
||||||
@ -515,7 +517,7 @@ end;
|
|||||||
Y:= Y + StartYViewPort;
|
Y:= Y + StartYViewPort;
|
||||||
offs := longint(y) * BytesPerLine + 2*x;
|
offs := longint(y) * BytesPerLine + 2*x;
|
||||||
SetReadBank(integer(offs shr 16));
|
SetReadBank(integer(offs shr 16));
|
||||||
GetPixVESA32k:=memW[WinWriteSeg : word(offs)];
|
GetPixVESA32k:=memW[WinReadSeg : word(offs)];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetPixVESA64k(x, y : integer): word; far;
|
function GetPixVESA64k(x, y : integer): word; far;
|
||||||
@ -527,7 +529,7 @@ end;
|
|||||||
Y:= Y + StartYViewPort;
|
Y:= Y + StartYViewPort;
|
||||||
offs := longint(y) * BytesPerLine + 2*x;
|
offs := longint(y) * BytesPerLine + 2*x;
|
||||||
SetReadBank(integer(offs shr 16));
|
SetReadBank(integer(offs shr 16));
|
||||||
GetPixVESA64k:=memW[WinWriteSeg : word(offs)];
|
GetPixVESA64k:=memW[WinReadSeg : word(offs)];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DirectPutPixVESA32k(x, y : integer); far;
|
procedure DirectPutPixVESA32k(x, y : integer); far;
|
||||||
@ -682,7 +684,8 @@ end;
|
|||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
GlobalDosFree(word(Ptr and $ffff));
|
GlobalDosFree(word(Ptr and $ffff));
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
Global_Dos_Free(word(Ptr and $ffff));
|
If not Global_Dos_Free(word(Ptr and $ffff)) then
|
||||||
|
RunError(216);
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
|
|
||||||
if word(regs.eax) <> $004F then
|
if word(regs.eax) <> $004F then
|
||||||
@ -750,7 +753,8 @@ end;
|
|||||||
{$ifndef fpc}
|
{$ifndef fpc}
|
||||||
GlobalDosFree(word(Ptr and $ffff));
|
GlobalDosFree(word(Ptr and $ffff));
|
||||||
{$else fpc}
|
{$else fpc}
|
||||||
Global_Dos_Free(word(Ptr and $ffff));
|
If not Global_Dos_Free(word(Ptr and $ffff)) then
|
||||||
|
RunError(216);
|
||||||
{$endif fpc}
|
{$endif fpc}
|
||||||
|
|
||||||
if word(regs.eax) <> $004F then
|
if word(regs.eax) <> $004F then
|
||||||
@ -1406,7 +1410,13 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.5 1999-07-12 13:28:33 jonas
|
Revision 1.6 1999-07-14 13:17:29 jonas
|
||||||
|
* bugfix in getmodeinfo (SizeOf(TModeInfo) -> SizeOf(TVESAModeInfo))
|
||||||
|
* as the result of the above bugfix, the graph unit doesn't crash
|
||||||
|
anymore under FPC if compiler with -dsupportVESA, but it doesn't
|
||||||
|
work yet either...
|
||||||
|
|
||||||
|
Revision 1.5 1999/07/12 13:28:33 jonas
|
||||||
* forgot log tag in previous commit
|
* forgot log tag in previous commit
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user