Browse Source

+ xor-, and and- orput support for VESA256 modes
* compile with -dlogging if you wnt some info to be logged to grlog.txt

Jonas Maebe 26 years ago
parent
commit
c023f717f1
3 changed files with 105 additions and 7 deletions
  1. 11 1
      rtl/inc/graph/graph.inc
  2. 37 3
      rtl/inc/graph/graph.pp
  3. 57 3
      rtl/inc/graph/vesa.inc

+ 11 - 1
rtl/inc/graph/graph.inc

@@ -1587,6 +1587,9 @@ const CrtAddress: word = 0;
        mov [EGADetected],TRUE
      @noega:
      end;
+{$ifdef logging}
+     LogLn('EGA detected: '+strf(Longint(EGADetected)));
+{$endif logging}
      { check if VGA adapter supported...       }
      if EGADetected then
        begin
@@ -1618,6 +1621,9 @@ const CrtAddress: word = 0;
         @novga:
         end;
        end;
+{$ifdef logging}
+       LogLn('VGA detected: '+strf(Longint(VGADetected)));
+{$endif logging}
      if VGADetected then
        begin
 
@@ -2490,7 +2496,11 @@ const CrtAddress: word = 0;
 
 {
 $Log$
-Revision 1.7  1999-07-14 18:18:02  florian
+Revision 1.8  1999-07-18 15:07:19  jonas
+  + xor-, and and- orput support for VESA256 modes
+  * compile with -dlogging if you wnt some info to be logged to grlog.txt
+
+Revision 1.7  1999/07/14 18:18:02  florian
   * cosmetic changes
 
 Revision 1.6  1999/07/14 18:16:23  florian

+ 37 - 3
rtl/inc/graph/graph.pp

@@ -669,6 +669,29 @@ Implementation
 uses WinAPI;
 {$ENDIF}
 {$endif fpc}
+
+{$ifdef logging}
+var debuglog: text;
+
+function strf(l: longint): string;
+begin
+  str(l, strf)
+end;
+
+Procedure Log(Const s: String);
+Begin
+  Append(debuglog);
+  Write(debuglog, s);
+  Close(debuglog);
+End;
+
+Procedure LogLn(Const s: string);
+Begin
+  Append(debuglog);
+  Writeln(debuglog,s);
+  Close(debuglog);
+End;
+{$endif logging}
 const
    StdBufferSize = 4096;   { Buffer size for FloodFill }
 
@@ -779,7 +802,6 @@ var
   procedure HLineDefault(x,x2,y: integer); far;
 
    var
-    Col: word;
     xtmp: integer;
    Begin
 
@@ -2613,12 +2635,20 @@ var
  ExitSave: pointer;
 
 begin
+{$ifdef logging}
+ assign(debuglog,'grlog.txt');
+ rewrite(debuglog);
+ close(debuglog);
+{$endif logging}
  ModeList := nil;
  SaveVideoState := nil;
  RestoreVideoState := nil;
  SavePtr := Nil;
  { This must be called at startup... because GetGraphMode may }
  { be called even when not in graph mode.                     }
+{$ifdef logging}
+ LogLn('Calling QueryAdapterInfo...');
+{$endif logging}
  QueryAdapterInfo;
  { Install standard fonts }
  { This is done BEFORE startup... }
@@ -2642,9 +2672,13 @@ DetectGraph
 {   DetectGraph()                                       }
 {   SetBkColor()                                        }
 
-{ 
+{
   $Log$
-  Revision 1.16  1999-07-14 18:18:04  florian
+  Revision 1.17  1999-07-18 15:07:20  jonas
+    + xor-, and and- orput support for VESA256 modes
+    * compile with -dlogging if you wnt some info to be logged to grlog.txt
+
+  Revision 1.16  1999/07/14 18:18:04  florian
     * cosmetic changes
 
 }

+ 57 - 3
rtl/inc/graph/vesa.inc

@@ -174,6 +174,9 @@ end;
 {$endif fpc}
     if VESAPtr^.Signature <> 'VESA' then
      begin
+{$ifdef logging}
+         LogLn('No VESA detected.');
+{$endif logging}
          getVesaInfo := FALSE;
 {$ifndef fpc}
          GlobalDosFree(word(PtrLong and $ffff));
@@ -240,6 +243,9 @@ end;
      end;
     VESAInfo.ModeList^[i]:=$ffff;
     { Free the temporary selector used to get mode information }
+{$ifdef logging}
+    LogLn(strf(i) + ' modes found.');
+{$endif logging}
 {$ifndef fpc}
     FreeSelector(ModeSel);
 {$else fpc}
@@ -393,6 +399,9 @@ end;
    begin
      { check if this is the current bank... if so do nothing. }
      if BankNr = CurrentReadBank then exit;
+{$ifdef logging}
+     LogLn('Setting read bank to '+strf(BankNr));
+{$endif logging}
      CurrentReadBank := BankNr;          { save current bank number     }
      BankNr := BankNr shl BankShift;     { adjust to window granularity }
      { we set both banks, since one may read only }
@@ -408,6 +417,9 @@ end;
    begin
      { check if this is the current bank... if so do nothing. }
      if BankNr = CurrentWriteBank then exit;
+{$ifdef logging}
+     LogLn('Setting write bank to '+strf(BankNr));
+{$endif logging}
      CurrentWriteBank := BankNr;          { save current bank number     }
      BankNr := BankNr shl BankShift;     { adjust to window granularity }
      { we set both banks, since one may read only }
@@ -440,7 +452,26 @@ end;
      end;
      offs := longint(y) * BytesPerLine + x;
      SetWriteBank(integer(offs shr 16));
-     mem[WinWriteSeg : word(offs)] := byte(color);
+     Case CurrentWriteMode of
+       XorPut:
+         Begin
+           SetReadBank(integer(offs shr 16));
+           mem[WinWriteSeg : word(offs)] := mem[WinReadSeg : word(offs)] xor byte(color);
+         End;
+       AndPut:
+         Begin
+           SetReadBank(integer(offs shr 16));
+           mem[WinWriteSeg : word(offs)] := mem[WinReadSeg : word(offs)] And byte(color);
+         End;
+       OrPut:
+         Begin
+           SetReadBank(integer(offs shr 16));
+           mem[WinWriteSeg : word(offs)] := mem[WinReadSeg : word(offs)] or byte(color);
+         End;
+       NormalPut:
+         mem[WinWriteSeg : word(offs)] := byte(color)
+     Else mem[WinWriteSeg : word(offs)] := byte(color);
+   End;
   end;
 
   procedure DirectPutPixVESA256(x, y : integer); far;
@@ -450,7 +481,26 @@ end;
   begin
      offs := longint(y) * BytesPerLine + x;
      SetWriteBank(integer(offs shr 16));
-     mem[WinWriteSeg : word(offs)] := byte(CurrentColor);
+     Case CurrentWriteMode of
+       XorPut:
+         Begin
+           SetReadBank(integer(offs shr 16));
+           mem[WinWriteSeg : word(offs)] := mem[WinReadSeg : word(offs)] xor byte(CurrentColor);
+         End;
+       AndPut:
+         Begin
+           SetReadBank(integer(offs shr 16));
+           mem[WinWriteSeg : word(offs)] := mem[WinReadSeg : word(offs)] And byte(CurrentColor);
+         End;
+       OrPut:
+         Begin
+           SetReadBank(integer(offs shr 16));
+           mem[WinWriteSeg : word(offs)] := mem[WinReadSeg : word(offs)] or byte(CurrentColor);
+         End;
+       NormalPut:
+         mem[WinWriteSeg : word(offs)] := byte(CurrentColor)
+     Else mem[WinWriteSeg : word(offs)] := byte(CurrentColor);
+   End;
   end;
 
   function GetPixVESA256(x, y : integer): word; far;
@@ -1411,7 +1461,11 @@ end;
 
 {
 $Log$
-Revision 1.7  1999-07-14 15:21:49  jonas
+Revision 1.8  1999-07-18 15:07:21  jonas
+  + xor-, and and- orput support for VESA256 modes
+  * compile with -dlogging if you wnt some info to be logged to grlog.txt
+
+Revision 1.7  1999/07/14 15:21:49  jonas
   * fixed initialization of bankshift var ('64 shr banshift' instead of shl)
 
 Revision 1.6  1999/07/14 13:17:29  jonas