* 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;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE;
mode.MaxX := 319;
@ -2102,7 +2102,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 65536;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE;
mode.MaxX := 319;
@ -2139,7 +2139,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE;
mode.MaxX := 639;
@ -2180,7 +2180,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.MaxX := 639;
mode.MaxY := 479;
@ -2220,7 +2220,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE;
mode.MaxX := 639;
@ -2257,7 +2257,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 65536;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE;
mode.MaxX := 639;
@ -2294,7 +2294,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 16;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := FALSE;
mode.PaletteSize := mode.MaxColor;
mode.MaxX := 799;
@ -2331,7 +2331,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE;
mode.MaxX := 799;
@ -2372,7 +2372,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE;
mode.MaxX := 799;
@ -2409,7 +2409,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 65536;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE;
mode.MaxX := 799;
@ -2446,7 +2446,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 16;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE;
mode.MaxX := 1023;
@ -2483,7 +2483,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := FALSE;
mode.MaxX := 1023;
@ -2524,7 +2524,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.DirectColor := TRUE;
mode.MaxX := 1023;
@ -2562,7 +2562,7 @@ const CrtAddress: word = 0;
mode.DirectColor := TRUE;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1023;
mode.MaxY := 767;
@ -2598,7 +2598,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 16;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := FALSE;
mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1279;
@ -2635,7 +2635,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 256;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := FALSE;
mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1279;
@ -2676,7 +2676,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 32768;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := TRUE;
mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1279;
@ -2713,7 +2713,7 @@ const CrtAddress: word = 0;
mode.MaxColor := 65536;
{ the ModeInfo is automatically set if the mode is supported }
{ by the call to SearchVESAMode. }
mode.HardwarePages := ModeInfo.NumberOfPages;
mode.HardwarePages := VESAModeInfo.NumberOfPages;
mode.DirectColor := TRUE;
mode.PaletteSize := mode.MaxColor;
mode.MaxX := 1279;
@ -2746,7 +2746,14 @@ const CrtAddress: word = 0;
{
$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)
* isgraphmode stuff cleanup
* vesainfo.modelist now gets disposed in cleanmode instead of in

View File

@ -2807,9 +2807,6 @@ end;
var
ExitSave: pointer;
begin
{$ifdef logging}
assign(debuglog,'grlog.txt');
@ -2837,19 +2834,25 @@ begin
{ This installs an exit procedure which cleans up the mode list...}
ExitSave := ExitProc;
ExitProc := @CleanMode;
{$ifdef testsave}
savevideostate;
{$endif testsave}
end.
SetGraphBufSize
SetBkColor
DetectGraph
{ DetectGraph() }
{ SetBkColor() }
{
$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
* small change to internalellipsedefault so less pixels are
calculated twice

View File

@ -272,16 +272,16 @@
hp:=pchar(font);
{ Move to EOF in prefix header }
while (hp[i] <> chr($1a)) do Inc(i);
move(hp[i+1],FHeader,sizeof(TFHeader));
move(hp[Prefix_Size],header,sizeof(THeader));
move(hp[i+1],FHeader,sizeof(FHeader));
move(hp[Prefix_Size],header,sizeof(Header));
{ 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
begin
if fonts[b].name=FHeader.Font_name then
begin
move(FHeader,fonts[b].PHeader,sizeof(TFHeader));
move(Header,fonts[b].Header,sizeof(THeader));
move(FHeader,fonts[b].PHeader,sizeof(FHeader));
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));
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));
@ -734,16 +734,23 @@
{
$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
* 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
Michael Knapp's gxtext unit, part of the GraphiX package)
* in settextstyle, the calculation of the ratios must be done
with /, not DIV!!
Revision 1.1 1999/09/22 13:13:36 jonas
* renamed text.inc -> gtext.inc to avoid conflict with system unit
* fixed textwidth

View File

@ -18,6 +18,8 @@
{-----------------------------------------------------------------------}
{ Internal routines }
{-----------------------------------------------------------------------}
var
ExitSave: pointer;
procedure addmode(mode: TModeInfo);
{********************************************************}
@ -37,7 +39,7 @@
LogLn('Modelist = '+strf(Longint(modelist)));
LogLn('Adding mode 1 and modelist^.next = '+strf(Longint(mode.next)));
{$endif logging}
move(mode, ModeList^, sizeof(TModeInfo));
move(mode, ModeList^, sizeof(Mode));
end
else
begin
@ -51,7 +53,7 @@
list:=list^.next;
new(NewLst);
list^.next := NewLst;
move(mode, NewLst^, sizeof(TModeInfo));
move(mode, NewLst^, sizeof(Mode));
end;
end;
@ -63,7 +65,7 @@
{ This routine initialized the mode to default values. }
{********************************************************}
begin
FillChar(mode,sizeof(TModeInfo),#0);
FillChar(mode,sizeof(Mode),#0);
end;
@ -109,6 +111,11 @@
c: word;
{$endif logging}
begin
{$ifdef testsave}
restorevideostate;
{$endif testsave}
{ restore old exitproc! }
exitproc := exitsave;
{$ifdef logging}
LogLn('Modelist at exit: '+strf(longint(modelist)));
LogLn('Modelist^.next at exit: '+strf(longint(modelist^.next)));
@ -347,7 +354,14 @@
{
$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)
* isgraphmode stuff cleanup
* vesainfo.modelist now gets disposed in cleanmode instead of in

View File

@ -116,7 +116,7 @@ end;
RealSeg := word(Ptrlong shr 16);
if not assigned(VESAPtr) then
RunError(203);
FillChar(regs, sizeof(TDPMIRegisters), #0);
FillChar(regs, sizeof(regs), #0);
{ Get VESA Mode information ... }
regs.eax := $4f00;
@ -164,7 +164,7 @@ end;
{ copy VESA mode information to a protected mode buffer and }
{ then free the real mode buffer... }
Move(VESAPtr^, VESAInfo, sizeof(TVESAInfo));
Move(VESAPtr^, VESAInfo, sizeof(VESAInfo));
GlobalDosFree(word(PtrLong and $ffff));
{ ModeList points to the mode list }
@ -184,7 +184,7 @@ end;
{ copy VESA mode information to a protected mode buffer and }
{ 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
RunError(216);
Dispose(VESAPtr);
@ -209,7 +209,7 @@ end;
{$endif fpc}
end;
function getModeInfo(var ModeInfo: TVESAModeInfo;mode:word):boolean;
function getVESAModeInfo(var ModeInfo: TVESAModeInfo;mode:word):boolean;
var
Ptr: longint;
{$ifndef fpc}
@ -231,7 +231,7 @@ end;
{ get the segment value }
RealSeg := word(Ptr shr 16);
{ setup interrupt registers }
FillChar(regs, sizeof(TDPMIRegisters), #0);
FillChar(regs, sizeof(regs), #0);
{ call VESA mode information...}
regs.eax := $4f01;
regs.es := RealSeg;
@ -239,14 +239,14 @@ end;
regs.ecx := mode;
RealIntr($10, regs);
if word(regs.eax) <> $4f then
getModeInfo := FALSE
getVESAModeInfo := FALSE
else
getModeInfo := TRUE;
getVESAModeInfo := TRUE;
{ copy to protected mode buffer ... }
{$ifndef fpc}
Move(VESAPtr^, ModeInfo, sizeof(TVESAModeInfo));
Move(VESAPtr^, ModeInfo, sizeof(ModeInfo));
{$else fpc}
DosMemGet(RealSeg,0,ModeInfo,sizeof(TVESAModeInfo));
DosMemGet(RealSeg,0,ModeInfo,sizeof(ModeInfo));
{$endif fpc}
{ free real mode memory }
{$ifndef fpc}
@ -318,9 +318,9 @@ end;
begin
{ we have to init everything to zero, since VBE < 1.1 }
{ may not setup fields correctly. }
FillChar(ModeInfo, sizeof(ModeInfo), #0);
If GetModeInfo(ModeInfo, Mode) And
((ModeInfo.attr and modeAvail) <> 0) then
FillChar(VESAModeInfo, sizeof(VESAModeInfo), #0);
If GetVESAModeInfo(VESAModeInfo, Mode) And
((VESAModeInfo.attr and modeAvail) <> 0) then
ModeSupported := TRUE
else
ModeSupported := FALSE;
@ -1132,12 +1132,12 @@ end;
{get the segment value}
RealSeg := word(Ptr shr 16);
{ setup interrupt registers }
FillChar(regs, sizeof(TDPMIRegisters), #0);
FillChar(regs, sizeof(regs), #0);
{ copy palette values to real mode buffer }
{$ifndef fpc}
move(pal, palptr^, sizeof(palrec));
move(pal, palptr^, sizeof(pal));
{$else fpc}
DosMemPut(RealSeg,0,pal,sizeof(palrec));
DosMemPut(RealSeg,0,pal,sizeof(pal));
{$endif fpc}
regs.eax := $4F09;
regs.ebx := FunctionNr;
@ -1200,7 +1200,7 @@ end;
{ get the segment value }
RealSeg := word(Ptr shr 16);
{ setup interrupt registers }
FillChar(regs, sizeof(TDPMIRegisters), #0);
FillChar(regs, sizeof(regs), #0);
regs.eax := $4F09;
regs.ebx := $01; { get palette data }
@ -1212,9 +1212,9 @@ end;
{ copy to protected mode buffer ... }
{$ifndef fpc}
Move(PalPtr^, Pal, sizeof(palrec));
Move(PalPtr^, Pal, sizeof(pal));
{$else fpc}
DosMemGet(RealSeg,0,Pal,sizeof(palrec));
DosMemGet(RealSeg,0,Pal,sizeof(pal));
{$endif fpc}
{ free real mode memory }
{$ifndef fpc}
@ -1482,12 +1482,12 @@ end;
var i:word;
begin
{ Init mode information, for compatibility with VBE < 1.1 }
FillChar(ModeInfo, sizeof(ModeInfo), #0);
FillChar(VESAModeInfo, sizeof(TVESAModeInfo), #0);
{ get the video mode information }
if getModeInfo(modeinfo, mode) then
if getVESAModeInfo(VESAmodeinfo, mode) then
begin
{ checks if the hardware supports the video mode. }
if (ModeInfo.attr and modeAvail) <> 0 then
if (VESAModeInfo.attr and modeAvail) <> 0 then
begin
SetVESAMode := TRUE;
end
@ -1499,11 +1499,11 @@ end;
end;
BankShift := 0;
while (64 shr BankShift) <> ModeInfo.WinGranularity do
while (64 shr BankShift) <> VESAModeInfo.WinGranularity do
Inc(BankShift);
CurrentWriteBank := -1;
CurrentReadBank := -1;
BytesPerLine := ModeInfo.BytesPerScanLine;
BytesPerLine := VESAModeInfo.BytesPerScanLine;
{ These are the window adresses ... }
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...}
{ this is backward compatible. }
if ((ModeInfo.Attr and ModeNoWindowed) <> 0) and
((ModeInfo.Attr and ModeLinearBuffer) <> 0) then
SetupLinear(ModeInfo)
if ((VESAModeInfo.Attr and ModeNoWindowed) <> 0) and
((VESAModeInfo.Attr and ModeLinearBuffer) <> 0) then
SetupLinear(VESAModeInfo)
else
{ if linear and windowed is supported, then use windowed }
{ method. }
SetUpWindows(ModeInfo);
SetUpWindows(VESAModeInfo);
asm
@ -1696,6 +1696,9 @@ end;
end;
if SaveSupported then
begin
{$ifdef logging}
LogLn('allocating VESA save buffer of '+strf(64*StateSize));
{$endif logging}
{$ifndef fpc}
PtrLong:=GlobalDosAlloc(64*StateSize); { values returned in 64-byte blocks }
{$else fpc}
@ -1877,7 +1880,14 @@ end;
{
$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)
* isgraphmode stuff cleanup
* vesainfo.modelist now gets disposed in cleanmode instead of in

View File

@ -59,12 +59,19 @@ TYPE
var
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}
{ initialized in QueryAdapterInfo in graph.inc }
{
$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)
* isgraphmode stuff cleanup
* vesainfo.modelist now gets disposed in cleanmode instead of in