* changed name of modeinfo variable to vesamodeinfo and fixed

associated errors (fillchar(modeinfo,sizeof(tmodeinfo),#0) instead
    of sizeof(TVesamodeinfo) etc)
  * changed several sizeof(type) to sizeof(varname) to avoid similar
    errors in the future
This commit is contained in:
Jonas Maebe 1999-09-26 13:31:06 +00:00
parent d6c22004f4
commit aa5751acbc
6 changed files with 117 additions and 69 deletions

View File

@ -2065,7 +2065,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768; mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.MaxX := 319; mode.MaxX := 319;
@ -2102,7 +2102,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 65536; mode.MaxColor := 65536;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.MaxX := 319; mode.MaxX := 319;
@ -2139,7 +2139,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256; mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE; mode.DirectColor := FALSE;
mode.MaxX := 639; mode.MaxX := 639;
@ -2180,7 +2180,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256; mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.MaxX := 639; mode.MaxX := 639;
mode.MaxY := 479; mode.MaxY := 479;
@ -2220,7 +2220,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768; mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.MaxX := 639; mode.MaxX := 639;
@ -2257,7 +2257,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 65536; mode.MaxColor := 65536;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.MaxX := 639; mode.MaxX := 639;
@ -2294,7 +2294,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 16; mode.MaxColor := 16;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := FALSE; mode.DirectColor := FALSE;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.MaxX := 799; mode.MaxX := 799;
@ -2331,7 +2331,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256; mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE; mode.DirectColor := FALSE;
mode.MaxX := 799; mode.MaxX := 799;
@ -2372,7 +2372,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768; mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.MaxX := 799; mode.MaxX := 799;
@ -2409,7 +2409,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 65536; mode.MaxColor := 65536;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.MaxX := 799; mode.MaxX := 799;
@ -2446,7 +2446,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 16; mode.MaxColor := 16;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE; mode.DirectColor := FALSE;
mode.MaxX := 1023; mode.MaxX := 1023;
@ -2483,7 +2483,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256; mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE; mode.DirectColor := FALSE;
mode.MaxX := 1023; mode.MaxX := 1023;
@ -2524,7 +2524,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768; mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.MaxX := 1023; mode.MaxX := 1023;
@ -2562,7 +2562,7 @@ const CrtAddress: word = 0;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1023; mode.MaxX := 1023;
mode.MaxY := 767; mode.MaxY := 767;
@ -2598,7 +2598,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 16; mode.MaxColor := 16;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := FALSE; mode.DirectColor := FALSE;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1279; mode.MaxX := 1279;
@ -2635,7 +2635,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256; mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := FALSE; mode.DirectColor := FALSE;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1279; mode.MaxX := 1279;
@ -2676,7 +2676,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768; mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1279; mode.MaxX := 1279;
@ -2713,7 +2713,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 65536; mode.MaxColor := 65536;
{ the ModeInfo is automatically set if the mode is supported } { the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. } { by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages; mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := TRUE; mode.DirectColor := TRUE;
mode.PaletteSize := mode.MaxColor; mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1279; mode.MaxX := 1279;
@ -2746,7 +2746,14 @@ const CrtAddress: word = 0;
{ {
$Log$ $Log$
Revision 1.19 1999-09-24 22:52:38 jonas Revision 1.20 1999-09-26 13:31:06 jonas
* changed name of modeinfo variable to vesamodeinfo and fixed
associated errors (fillchar(modeinfo,sizeof(tmodeinfo),#0) instead
of sizeof(TVesamodeinfo) etc)
* changed several sizeof(type) to sizeof(varname) to avoid similar
errors in the future
Revision 1.19 1999/09/24 22:52:38 jonas
* optimized patternline a bit (always use hline when possible) * optimized patternline a bit (always use hline when possible)
* isgraphmode stuff cleanup * isgraphmode stuff cleanup
* vesainfo.modelist now gets disposed in cleanmode instead of in * vesainfo.modelist now gets disposed in cleanmode instead of in

View File

@ -2807,9 +2807,6 @@ end;
var
ExitSave: pointer;
begin begin
{$ifdef logging} {$ifdef logging}
assign(debuglog,'grlog.txt'); assign(debuglog,'grlog.txt');
@ -2837,19 +2834,25 @@ begin
{ This installs an exit procedure which cleans up the mode list...} { This installs an exit procedure which cleans up the mode list...}
ExitSave := ExitProc; ExitSave := ExitProc;
ExitProc := @CleanMode; ExitProc := @CleanMode;
{$ifdef testsave}
savevideostate;
{$endif testsave}
end. end.
SetGraphBufSize SetGraphBufSize
SetBkColor
DetectGraph
{ DetectGraph() }
{ SetBkColor() }
{ {
$Log$ $Log$
Revision 1.28 1999-09-25 11:48:43 jonas Revision 1.29 1999-09-26 13:31:06 jonas
* changed name of modeinfo variable to vesamodeinfo and fixed
associated errors (fillchar(modeinfo,sizeof(tmodeinfo),#0) instead
of sizeof(TVesamodeinfo) etc)
* changed several sizeof(type) to sizeof(varname) to avoid similar
errors in the future
Revision 1.28 1999/09/25 11:48:43 jonas
+ detectgraph + detectgraph
* small change to internalellipsedefault so less pixels are * small change to internalellipsedefault so less pixels are
calculated twice calculated twice

View File

@ -272,16 +272,16 @@
hp:=pchar(font); hp:=pchar(font);
{ Move to EOF in prefix header } { Move to EOF in prefix header }
while (hp[i] <> chr($1a)) do Inc(i); while (hp[i] <> chr($1a)) do Inc(i);
move(hp[i+1],FHeader,sizeof(TFHeader)); move(hp[i+1],FHeader,sizeof(FHeader));
move(hp[Prefix_Size],header,sizeof(THeader)); move(hp[Prefix_Size],header,sizeof(Header));
{ check if the font name is already allocated? } { check if the font name is already allocated? }
i:=Prefix_Size+sizeof(THeader)+1; i:=Prefix_Size+sizeof(Header)+1;
for b:=1 to installedfonts do for b:=1 to installedfonts do
begin begin
if fonts[b].name=FHeader.Font_name then if fonts[b].name=FHeader.Font_name then
begin begin
move(FHeader,fonts[b].PHeader,sizeof(TFHeader)); move(FHeader,fonts[b].PHeader,sizeof(FHeader));
move(Header,fonts[b].Header,sizeof(THeader)); move(Header,fonts[b].Header,sizeof(Header));
move(hp[i],Fonts[b].Offsets[Fonts[b].Header.First_Char],Fonts[b].Header.Nr_chars*sizeof(integer)); move(hp[i],Fonts[b].Offsets[Fonts[b].Header.First_Char],Fonts[b].Header.Nr_chars*sizeof(integer));
Inc(i,Fonts[b].Header.Nr_chars*sizeof(integer)); Inc(i,Fonts[b].Header.Nr_chars*sizeof(integer));
move(hp[i],Fonts[b].Widths[Fonts[b].Header.First_Char],Fonts[b].Header.Nr_chars*sizeof(byte)); move(hp[i],Fonts[b].Widths[Fonts[b].Header.First_Char],Fonts[b].Header.Nr_chars*sizeof(byte));
@ -734,16 +734,23 @@
{ {
$Log$ $Log$
Revision 1.3 1999-09-22 14:54:11 jonas Revision 1.4 1999-09-26 13:31:07 jonas
* changed name of modeinfo variable to vesamodeinfo and fixed
associated errors (fillchar(modeinfo,sizeof(tmodeinfo),#0) instead
of sizeof(TVesamodeinfo) etc)
* changed several sizeof(type) to sizeof(varname) to avoid similar
errors in the future
Revision 1.3 1999/09/22 14:54:11 jonas
* changed ratios so font sizes on screen are the same as with TP * changed ratios so font sizes on screen are the same as with TP
* SetUserCharSize must also use / instead of DIV * SetUserCharSize must also use / instead of DIV
Revision 1.2 1999/09/22 13:30:52 jonas Revision 1.2 1999/09/22 13:30:52 jonas
* changed org_to_cap, org_to_dec and org_to_base to shortint (from * changed org_to_cap, org_to_dec and org_to_base to shortint (from
Michael Knapp's gxtext unit, part of the GraphiX package) Michael Knapp's gxtext unit, part of the GraphiX package)
* in settextstyle, the calculation of the ratios must be done * in settextstyle, the calculation of the ratios must be done
with /, not DIV!! with /, not DIV!!
Revision 1.1 1999/09/22 13:13:36 jonas Revision 1.1 1999/09/22 13:13:36 jonas
* renamed text.inc -> gtext.inc to avoid conflict with system unit * renamed text.inc -> gtext.inc to avoid conflict with system unit
* fixed textwidth * fixed textwidth

View File

@ -18,6 +18,8 @@
{-----------------------------------------------------------------------} {-----------------------------------------------------------------------}
{ Internal routines } { Internal routines }
{-----------------------------------------------------------------------} {-----------------------------------------------------------------------}
var
ExitSave: pointer;
procedure addmode(mode: TModeInfo); procedure addmode(mode: TModeInfo);
{********************************************************} {********************************************************}
@ -37,7 +39,7 @@
LogLn('Modelist = '+strf(Longint(modelist))); LogLn('Modelist = '+strf(Longint(modelist)));
LogLn('Adding mode 1 and modelist^.next = '+strf(Longint(mode.next))); LogLn('Adding mode 1 and modelist^.next = '+strf(Longint(mode.next)));
{$endif logging} {$endif logging}
move(mode, ModeList^, sizeof(TModeInfo)); move(mode, ModeList^, sizeof(Mode));
end end
else else
begin begin
@ -51,7 +53,7 @@
list:=list^.next; list:=list^.next;
new(NewLst); new(NewLst);
list^.next := NewLst; list^.next := NewLst;
move(mode, NewLst^, sizeof(TModeInfo)); move(mode, NewLst^, sizeof(Mode));
end; end;
end; end;
@ -63,7 +65,7 @@
{ This routine initialized the mode to default values. } { This routine initialized the mode to default values. }
{********************************************************} {********************************************************}
begin begin
FillChar(mode,sizeof(TModeInfo),#0); FillChar(mode,sizeof(Mode),#0);
end; end;
@ -109,6 +111,11 @@
c: word; c: word;
{$endif logging} {$endif logging}
begin begin
{$ifdef testsave}
restorevideostate;
{$endif testsave}
{ restore old exitproc! }
exitproc := exitsave;
{$ifdef logging} {$ifdef logging}
LogLn('Modelist at exit: '+strf(longint(modelist))); LogLn('Modelist at exit: '+strf(longint(modelist)));
LogLn('Modelist^.next at exit: '+strf(longint(modelist^.next))); LogLn('Modelist^.next at exit: '+strf(longint(modelist^.next)));
@ -347,7 +354,14 @@
{ {
$Log$ $Log$
Revision 1.10 1999-09-24 22:52:39 jonas Revision 1.11 1999-09-26 13:31:07 jonas
* changed name of modeinfo variable to vesamodeinfo and fixed
associated errors (fillchar(modeinfo,sizeof(tmodeinfo),#0) instead
of sizeof(TVesamodeinfo) etc)
* changed several sizeof(type) to sizeof(varname) to avoid similar
errors in the future
Revision 1.10 1999/09/24 22:52:39 jonas
* optimized patternline a bit (always use hline when possible) * optimized patternline a bit (always use hline when possible)
* isgraphmode stuff cleanup * isgraphmode stuff cleanup
* vesainfo.modelist now gets disposed in cleanmode instead of in * vesainfo.modelist now gets disposed in cleanmode instead of in

View File

@ -116,7 +116,7 @@ end;
RealSeg := word(Ptrlong shr 16); RealSeg := word(Ptrlong shr 16);
if not assigned(VESAPtr) then if not assigned(VESAPtr) then
RunError(203); RunError(203);
FillChar(regs, sizeof(TDPMIRegisters), #0); FillChar(regs, sizeof(regs), #0);
{ Get VESA Mode information ... } { Get VESA Mode information ... }
regs.eax := $4f00; regs.eax := $4f00;
@ -164,7 +164,7 @@ 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(VESAInfo));
GlobalDosFree(word(PtrLong and $ffff)); GlobalDosFree(word(PtrLong and $ffff));
{ ModeList points to the mode list } { ModeList points to the mode list }
@ -184,7 +184,7 @@ 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(VESAInfo));
If not Global_Dos_Free(word(PtrLong and $ffff)) then If not Global_Dos_Free(word(PtrLong and $ffff)) then
RunError(216); RunError(216);
Dispose(VESAPtr); Dispose(VESAPtr);
@ -209,7 +209,7 @@ end;
{$endif fpc} {$endif fpc}
end; end;
function getModeInfo(var ModeInfo: TVESAModeInfo;mode:word):boolean; function getVESAModeInfo(var ModeInfo: TVESAModeInfo;mode:word):boolean;
var var
Ptr: longint; Ptr: longint;
{$ifndef fpc} {$ifndef fpc}
@ -231,7 +231,7 @@ end;
{ get the segment value } { get the segment value }
RealSeg := word(Ptr shr 16); RealSeg := word(Ptr shr 16);
{ setup interrupt registers } { setup interrupt registers }
FillChar(regs, sizeof(TDPMIRegisters), #0); FillChar(regs, sizeof(regs), #0);
{ call VESA mode information...} { call VESA mode information...}
regs.eax := $4f01; regs.eax := $4f01;
regs.es := RealSeg; regs.es := RealSeg;
@ -239,14 +239,14 @@ end;
regs.ecx := mode; regs.ecx := mode;
RealIntr($10, regs); RealIntr($10, regs);
if word(regs.eax) <> $4f then if word(regs.eax) <> $4f then
getModeInfo := FALSE getVESAModeInfo := FALSE
else else
getModeInfo := TRUE; getVESAModeInfo := TRUE;
{ copy to protected mode buffer ... } { copy to protected mode buffer ... }
{$ifndef fpc} {$ifndef fpc}
Move(VESAPtr^, ModeInfo, sizeof(TVESAModeInfo)); Move(VESAPtr^, ModeInfo, sizeof(ModeInfo));
{$else fpc} {$else fpc}
DosMemGet(RealSeg,0,ModeInfo,sizeof(TVESAModeInfo)); DosMemGet(RealSeg,0,ModeInfo,sizeof(ModeInfo));
{$endif fpc} {$endif fpc}
{ free real mode memory } { free real mode memory }
{$ifndef fpc} {$ifndef fpc}
@ -318,9 +318,9 @@ end;
begin begin
{ 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(VESAModeInfo, sizeof(VESAModeInfo), #0);
If GetModeInfo(ModeInfo, Mode) And If GetVESAModeInfo(VESAModeInfo, Mode) And
((ModeInfo.attr and modeAvail) <> 0) then ((VESAModeInfo.attr and modeAvail) <> 0) then
ModeSupported := TRUE ModeSupported := TRUE
else else
ModeSupported := FALSE; ModeSupported := FALSE;
@ -1132,12 +1132,12 @@ end;
{get the segment value} {get the segment value}
RealSeg := word(Ptr shr 16); RealSeg := word(Ptr shr 16);
{ setup interrupt registers } { setup interrupt registers }
FillChar(regs, sizeof(TDPMIRegisters), #0); FillChar(regs, sizeof(regs), #0);
{ copy palette values to real mode buffer } { copy palette values to real mode buffer }
{$ifndef fpc} {$ifndef fpc}
move(pal, palptr^, sizeof(palrec)); move(pal, palptr^, sizeof(pal));
{$else fpc} {$else fpc}
DosMemPut(RealSeg,0,pal,sizeof(palrec)); DosMemPut(RealSeg,0,pal,sizeof(pal));
{$endif fpc} {$endif fpc}
regs.eax := $4F09; regs.eax := $4F09;
regs.ebx := FunctionNr; regs.ebx := FunctionNr;
@ -1200,7 +1200,7 @@ end;
{ get the segment value } { get the segment value }
RealSeg := word(Ptr shr 16); RealSeg := word(Ptr shr 16);
{ setup interrupt registers } { setup interrupt registers }
FillChar(regs, sizeof(TDPMIRegisters), #0); FillChar(regs, sizeof(regs), #0);
regs.eax := $4F09; regs.eax := $4F09;
regs.ebx := $01; { get palette data } regs.ebx := $01; { get palette data }
@ -1212,9 +1212,9 @@ end;
{ copy to protected mode buffer ... } { copy to protected mode buffer ... }
{$ifndef fpc} {$ifndef fpc}
Move(PalPtr^, Pal, sizeof(palrec)); Move(PalPtr^, Pal, sizeof(pal));
{$else fpc} {$else fpc}
DosMemGet(RealSeg,0,Pal,sizeof(palrec)); DosMemGet(RealSeg,0,Pal,sizeof(pal));
{$endif fpc} {$endif fpc}
{ free real mode memory } { free real mode memory }
{$ifndef fpc} {$ifndef fpc}
@ -1482,12 +1482,12 @@ end;
var i:word; var i:word;
begin begin
{ Init mode information, for compatibility with VBE < 1.1 } { Init mode information, for compatibility with VBE < 1.1 }
FillChar(ModeInfo, sizeof(ModeInfo), #0); FillChar(VESAModeInfo, sizeof(TVESAModeInfo), #0);
{ get the video mode information } { get the video mode information }
if getModeInfo(modeinfo, mode) then if getVESAModeInfo(VESAmodeinfo, mode) then
begin begin
{ checks if the hardware supports the video mode. } { checks if the hardware supports the video mode. }
if (ModeInfo.attr and modeAvail) <> 0 then if (VESAModeInfo.attr and modeAvail) <> 0 then
begin begin
SetVESAMode := TRUE; SetVESAMode := TRUE;
end end
@ -1499,11 +1499,11 @@ end;
end; end;
BankShift := 0; BankShift := 0;
while (64 shr BankShift) <> ModeInfo.WinGranularity do while (64 shr BankShift) <> VESAModeInfo.WinGranularity do
Inc(BankShift); Inc(BankShift);
CurrentWriteBank := -1; CurrentWriteBank := -1;
CurrentReadBank := -1; CurrentReadBank := -1;
BytesPerLine := ModeInfo.BytesPerScanLine; BytesPerLine := VESAModeInfo.BytesPerScanLine;
{ These are the window adresses ... } { These are the window adresses ... }
WinWriteSeg := 0; { This is the segment to use for writes } WinWriteSeg := 0; { This is the segment to use for writes }
@ -1513,13 +1513,13 @@ end;
{ VBE 2.0 and higher supports >= non VGA linear buffer types...} { VBE 2.0 and higher supports >= non VGA linear buffer types...}
{ this is backward compatible. } { this is backward compatible. }
if ((ModeInfo.Attr and ModeNoWindowed) <> 0) and if ((VESAModeInfo.Attr and ModeNoWindowed) <> 0) and
((ModeInfo.Attr and ModeLinearBuffer) <> 0) then ((VESAModeInfo.Attr and ModeLinearBuffer) <> 0) then
SetupLinear(ModeInfo) SetupLinear(VESAModeInfo)
else else
{ if linear and windowed is supported, then use windowed } { if linear and windowed is supported, then use windowed }
{ method. } { method. }
SetUpWindows(ModeInfo); SetUpWindows(VESAModeInfo);
asm asm
@ -1696,6 +1696,9 @@ end;
end; end;
if SaveSupported then if SaveSupported then
begin begin
{$ifdef logging}
LogLn('allocating VESA save buffer of '+strf(64*StateSize));
{$endif logging}
{$ifndef fpc} {$ifndef fpc}
PtrLong:=GlobalDosAlloc(64*StateSize); { values returned in 64-byte blocks } PtrLong:=GlobalDosAlloc(64*StateSize); { values returned in 64-byte blocks }
{$else fpc} {$else fpc}
@ -1877,7 +1880,14 @@ end;
{ {
$Log$ $Log$
Revision 1.15 1999-09-24 22:52:39 jonas Revision 1.16 1999-09-26 13:31:07 jonas
* changed name of modeinfo variable to vesamodeinfo and fixed
associated errors (fillchar(modeinfo,sizeof(tmodeinfo),#0) instead
of sizeof(TVesamodeinfo) etc)
* changed several sizeof(type) to sizeof(varname) to avoid similar
errors in the future
Revision 1.15 1999/09/24 22:52:39 jonas
* optimized patternline a bit (always use hline when possible) * optimized patternline a bit (always use hline when possible)
* isgraphmode stuff cleanup * isgraphmode stuff cleanup
* vesainfo.modelist now gets disposed in cleanmode instead of in * vesainfo.modelist now gets disposed in cleanmode instead of in

View File

@ -59,12 +59,19 @@ TYPE
var var
VESAInfo : TVESAInfo; { VESA Driver information } VESAInfo : TVESAInfo; { VESA Driver information }
ModeInfo : TVESAModeInfo; { Current Mode information } VESAModeInfo : TVESAModeInfo; { Current Mode information }
hasVesa: Boolean; { true if we have a VESA compatible graphics card} hasVesa: Boolean; { true if we have a VESA compatible graphics card}
{ initialized in QueryAdapterInfo in graph.inc } { initialized in QueryAdapterInfo in graph.inc }
{ {
$Log$ $Log$
Revision 1.1 1999-09-24 22:52:40 jonas Revision 1.2 1999-09-26 13:31:07 jonas
* changed name of modeinfo variable to vesamodeinfo and fixed
associated errors (fillchar(modeinfo,sizeof(tmodeinfo),#0) instead
of sizeof(TVesamodeinfo) etc)
* changed several sizeof(type) to sizeof(varname) to avoid similar
errors in the future
Revision 1.1 1999/09/24 22:52:40 jonas
* optimized patternline a bit (always use hline when possible) * optimized patternline a bit (always use hline when possible)
* isgraphmode stuff cleanup * isgraphmode stuff cleanup
* vesainfo.modelist now gets disposed in cleanmode instead of in * vesainfo.modelist now gets disposed in cleanmode instead of in