mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-16 02:30:41 +01:00
* changed color scheme
all colors are in RGB format if more than 256 colors
+ added 24 and 32 bits per pixel mode
(compile with -dDEBUG)
24 bit mode with banked still as problems on pixels across
the bank boundary, but works in LinearFrameBufferMode
Look at install/demo/nmandel.pp
This commit is contained in:
parent
bc986a816e
commit
cf389c21e1
149
rtl/dos/graph.pp
149
rtl/dos/graph.pp
@ -16,11 +16,21 @@
|
||||
**********************************************************************}
|
||||
unit GRAPH;
|
||||
|
||||
{ there are some problems with ranges in this file !! (PM) }
|
||||
{$R-}
|
||||
{$Q-}
|
||||
{ $DEFINE DEBUG}
|
||||
{$I os.inc}
|
||||
|
||||
{ Don't use smartlinking, becuase of the direct assembler that is used }
|
||||
{$ifdef DEBUG}
|
||||
{$define TEST_24BPP}
|
||||
{$define Test_Linear}
|
||||
{$endif DEBUG}
|
||||
|
||||
{ Don't use smartlinking, because of the direct assembler that is used }
|
||||
{$ifndef VER0_99_8}
|
||||
{$SMARTLINK OFF}
|
||||
{$endif not VER0_99_8}
|
||||
|
||||
interface
|
||||
|
||||
@ -33,6 +43,7 @@ procedure CloseGraph;
|
||||
function GraphResult : Integer;
|
||||
procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;const PathToDriver:String);
|
||||
procedure SetGraphMode(GraphMode : integer);
|
||||
procedure GraphDefaults;
|
||||
procedure RestoreCRTMode;
|
||||
procedure SetGraphBufSize(BufSize : longint);
|
||||
function RegisterBGIdriver(driver : pointer) : integer;
|
||||
@ -101,9 +112,11 @@ procedure GetFillSettings(var FillInfo : FillSettingsType);
|
||||
procedure GetFillPattern(var FillPattern : FillPatternType);
|
||||
procedure SetFillStyle(pattern : word;color : longint);
|
||||
procedure SetFillPattern(pattern : FillPatternType;color : longint);
|
||||
{ just dummy not implemented yet }
|
||||
procedure FillPoly(points : word;var polypoints);
|
||||
|
||||
{ IMAGE.PPI }
|
||||
function ImageSize(x1,y1,x2,y2 : integer) : word;
|
||||
function ImageSize(x1,y1,x2,y2 : integer) : longint;
|
||||
procedure GetImage(x1,y1,x2,y2 : integer;var BitMap);
|
||||
procedure PutImage(x,y : integer;var BitMap;BitBlt : word);
|
||||
|
||||
@ -126,8 +139,27 @@ function InstallUserFont(const FontFileName : string) : integer;
|
||||
{ TRIANGLE.PPI }
|
||||
procedure FillTriangle(A,B,C:Pointtype);
|
||||
|
||||
{ to compare colors on different resolutions }
|
||||
function ColorsEqual(c1,c2 : longint) : boolean;
|
||||
{ this will return true if the two colors will appear
|
||||
equal in the current video mode }
|
||||
|
||||
procedure WaitRetrace;
|
||||
{$ifdef debug}
|
||||
procedure pixel(offset:longint);
|
||||
function Convert(color:longint):longint;
|
||||
function UnConvert(color:longint):longint;
|
||||
{$endif debug}
|
||||
|
||||
{$ifdef Test_linear}
|
||||
const
|
||||
UseLinear : boolean = false;
|
||||
{ the two below are the settings the work for ATI 3D Rage Pro !! }
|
||||
switch_physical_address : boolean = true;
|
||||
split_physical_address : boolean = false;
|
||||
{$endif Test_linear}
|
||||
|
||||
{$I MODES.PPI}
|
||||
|
||||
implementation
|
||||
|
||||
@ -192,8 +224,6 @@ type
|
||||
reserved2 : Array[1..458]of Byte;
|
||||
end;
|
||||
|
||||
{$I MODES.PPI}
|
||||
|
||||
const
|
||||
CheckRange : Boolean=true;
|
||||
isVESA2 : Boolean=false;
|
||||
@ -204,10 +234,14 @@ var { X/Y Verhaeltnis des Bildschirm }
|
||||
XAsp , YAsp : Word;
|
||||
{ Zeilen & Spalten des aktuellen Graphikmoduses }
|
||||
_maxx,_maxy : longint;
|
||||
{ aktuell eingestellte Farbe }
|
||||
{ Current color internal format (depending on bitsperpixel) }
|
||||
aktcolor : longint;
|
||||
{ Hintegrundfarbe }
|
||||
{ Current color RGB value }
|
||||
truecolor : longint;
|
||||
{ Current background color internal format (depending on bitsperpixel) }
|
||||
aktbackcolor : longint;
|
||||
{ Current background color RGB value }
|
||||
truebackcolor : longint;
|
||||
{ Videospeicherbereiche }
|
||||
wbuffer,rbuffer,wrbuffer : ^byte;
|
||||
{ aktueller Ausgabebereich }
|
||||
@ -229,6 +263,8 @@ var { X/Y Verhaeltnis des Bildschirm }
|
||||
aktfillpattern : FillPatternType;
|
||||
{ Schreibmodus }
|
||||
aktwritemode : word;
|
||||
{ put background color around text }
|
||||
ClearText : boolean;
|
||||
{ Schrifteinstellung }
|
||||
akttextinfo : TextSettingsType;
|
||||
{ momentan gesetzte Textskalierungswerte }
|
||||
@ -252,15 +288,31 @@ var { X/Y Verhaeltnis des Bildschirm }
|
||||
{ Selectors for Protected Mode }
|
||||
seg_WRITE : word;
|
||||
seg_READ : word;
|
||||
{ linear Frame Buffer }
|
||||
LinearFrameBufferSupported : boolean;
|
||||
FrameBufferLinearAddress : longint;
|
||||
UseLinearFrameBuffer : Boolean;
|
||||
const
|
||||
EnableLinearFrameBuffer = $4000;
|
||||
{ Registers for RealModeInterrupts in DPMI-Mode }
|
||||
var
|
||||
dregs : TRealRegs;
|
||||
AW_Bank : longint;
|
||||
{ AR_Bank : Longint;}
|
||||
{ read and write bank are allways equal !! }
|
||||
A_Bank : longint;
|
||||
AW_window : longint;
|
||||
AR_Window : longint;
|
||||
same_window : boolean;
|
||||
const
|
||||
AWindow = 0;
|
||||
BWindow = 1;
|
||||
|
||||
{ Variables for Bankswitching }
|
||||
var
|
||||
BytesPerLine : longint;
|
||||
BytesPerPixel: Word;
|
||||
WinSize : longint; { Expample $0x00010000 . $0x00008000 }
|
||||
WinLoMask : longint; { $0x0000FFFF $0x00007FFF }
|
||||
WinLoMaskMinusPixelSize : longint; { $0x0000FFFF $0x00007FFF }
|
||||
WinShift : byte;
|
||||
GranShift : byte;
|
||||
Granular : longint;
|
||||
@ -272,6 +324,14 @@ var { X/Y Verhaeltnis des Bildschirm }
|
||||
SwitchCS,SwitchIP : word;
|
||||
|
||||
|
||||
function ColorsEqual(c1,c2 : longint) : boolean;
|
||||
Begin
|
||||
ColorsEqual:=((BytesPerPixel=1) and ((c1 and $FF)=(c2 and $FF))) or
|
||||
((GetMaxColor=$7FFF) and ((c1 and $F8F8F8)=(c2 and $F8F8F8))) or
|
||||
((GetMaxColor=$FFFF) and ((c1 and $F8FCF8)=(c2 and $F8FCF8))) or
|
||||
((BytesPerPixel>2) and ((c1 and $FFFFFF)=(c2 and $FFFFFF)));
|
||||
End;
|
||||
|
||||
function GraphErrorMsg(ErrorCode: Integer): string;
|
||||
Begin
|
||||
GraphErrorMsg:='';
|
||||
@ -339,6 +399,9 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{$I COLORS.PPI}
|
||||
|
||||
procedure graphdefaults;
|
||||
begin
|
||||
_graphresult:=grOk;
|
||||
@ -352,9 +415,11 @@ procedure graphdefaults;
|
||||
aktlineinfo.thickness:=normwidth;
|
||||
|
||||
|
||||
{ std colors }
|
||||
setstdcolors;
|
||||
{ Zeichenfarbe }
|
||||
aktcolor:=(white shl 24)+(white shl 16)+(white shl 8)+white;
|
||||
aktbackcolor:=black;
|
||||
aktcolor:=convert(white);
|
||||
aktbackcolor:=convert(black);
|
||||
|
||||
{ F<>llmuster }
|
||||
setfillstyle(solidfill,white);
|
||||
@ -390,7 +455,6 @@ procedure graphdefaults;
|
||||
{ ################# Ende der internen Routinen ################ }
|
||||
{ ############################################################### }
|
||||
|
||||
{$I COLORS.PPI}
|
||||
{$I PALETTE.PPI}
|
||||
{$I PIXEL.PPI}
|
||||
{$I LINE.PPI}
|
||||
@ -439,6 +503,8 @@ procedure ClearViewport;
|
||||
var bank1,bank2,diff,c:longint;
|
||||
ofs1,ofs2 :longint;
|
||||
y : integer;
|
||||
storewritemode : word;
|
||||
|
||||
begin
|
||||
if not isgraphmode then
|
||||
begin
|
||||
@ -447,27 +513,29 @@ begin
|
||||
end;
|
||||
c:=aktcolor;
|
||||
aktcolor:=aktbackcolor;
|
||||
storewritemode:=aktwritemode;
|
||||
aktwritemode:=normalput;
|
||||
ofs1:=Y_ARRAY[aktviewport.y1] + X_ARRAY[aktviewport.x1] ;
|
||||
ofs2:=Y_ARRAY[aktviewport.y1] + X_ARRAY[aktviewport.x2] ;
|
||||
for y:=aktviewport.y1 to aktviewport.y2 do
|
||||
begin
|
||||
bank1:=ofs1 shr winshift;
|
||||
bank2:=ofs2 shr winshift;
|
||||
if bank1 <> AW_BANK then
|
||||
if bank1 <> A_BANK then
|
||||
begin
|
||||
Switchbank(bank1);
|
||||
AW_BANK:=bank1;
|
||||
end;
|
||||
if bank1 <> bank2 then
|
||||
begin
|
||||
diff:=((bank2 shl winshift)-ofs1) div BytesPerPixel;
|
||||
horizontalline(aktviewport.x1, aktviewport.x1+diff-1, y);
|
||||
Switchbank(bank2); AW_BANK:=bank2;
|
||||
Switchbank(bank2);
|
||||
horizontalline(aktviewport.x1+diff, aktviewport.x2, y);
|
||||
end else horizontalline(aktviewport.x1, aktviewport.x2, y);
|
||||
ofs1:=ofs1 + BytesPerLine;
|
||||
ofs2:=ofs2 + BytesPerLine;
|
||||
end;
|
||||
aktwritemode:=storewritemode;
|
||||
aktcolor:=c;
|
||||
end;
|
||||
|
||||
@ -476,7 +544,7 @@ begin
|
||||
_graphresult:=grOk;
|
||||
if not isgraphmode then
|
||||
begin
|
||||
_graphresult:=grnoinitgraph;;
|
||||
_graphresult:=grnoinitgraph;
|
||||
exit;
|
||||
end;
|
||||
_XAsp:=XAsp; _YAsp:=YAsp;
|
||||
@ -586,11 +654,16 @@ const
|
||||
|
||||
procedure CloseGraph;
|
||||
begin
|
||||
if isgraphmode then begin
|
||||
SetVESAMode(startmode);
|
||||
DoneVESA;
|
||||
isgraphmode:=false;
|
||||
end;
|
||||
if isgraphmode then
|
||||
begin
|
||||
SetVESAMode(startmode);
|
||||
{ DoneVESA; only in exitproc !! PM }
|
||||
isgraphmode:=false;
|
||||
if assigned(buffermem) then
|
||||
freemem(buffermem,buffersize);
|
||||
buffermem:=nil;
|
||||
buffersize:=0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;const PathToDriver:String);
|
||||
@ -624,6 +697,9 @@ begin
|
||||
while i>=0 do begin
|
||||
isgraphmode:=SetVESAMode(GraphMode);
|
||||
if isgraphmode then begin
|
||||
GetVESAInfo(GraphMode);
|
||||
if UseLinearFrameBuffer then
|
||||
isgraphmode:=SetVESAMode(GraphMode or EnableLinearFrameBuffer);
|
||||
for index:=0 to VESAInfo.XResolution do X_Array[index]:=index * BytesPerPixel;
|
||||
for index:=0 to VESAInfo.YResolution do Y_Array[index]:=index * BytesPerLine;
|
||||
SetGraphBufSize(bufferstandardsize);
|
||||
@ -651,6 +727,8 @@ begin
|
||||
isgraphmode:=SetVESAMode(GraphMode);
|
||||
if isgraphmode then
|
||||
begin
|
||||
if UseLinearFrameBuffer then
|
||||
isgraphmode:=SetVESAMode(GraphMode or EnableLinearFrameBuffer);
|
||||
for index:=0 to VESAInfo.XResolution do
|
||||
X_Array[index]:=index * BytesPerPixel;
|
||||
for index:=0 to VESAInfo.YResolution do
|
||||
@ -789,12 +867,16 @@ begin
|
||||
_graphresult:=grNoInitGraph;;
|
||||
exit;
|
||||
end;
|
||||
if (writemode<>xorput) and (writemode<>normalput) then
|
||||
if (writemode and $7F<>xorput) and (writemode and $7F<>normalput) then
|
||||
begin
|
||||
_graphresult:=grError;
|
||||
exit;
|
||||
end;
|
||||
aktwritemode:=writemode;
|
||||
aktwritemode:=(writemode and $7F);
|
||||
if (writemode and $80)<>0 then
|
||||
ClearText:=true
|
||||
else
|
||||
ClearText:=false;
|
||||
end;
|
||||
|
||||
function GraphResult:Integer;
|
||||
@ -813,9 +895,19 @@ begin
|
||||
isgraphmode:=false;
|
||||
end;
|
||||
|
||||
var PrevExitProc : pointer;
|
||||
|
||||
procedure GraphExit;
|
||||
begin
|
||||
ExitProc:=PrevExitProc;
|
||||
CloseGraph;
|
||||
DoneVesa; { frees the ldt descriptos seg_read and seg_write !! }
|
||||
end;
|
||||
|
||||
begin
|
||||
InitVESA;
|
||||
if not DetectVESA then Oh_Kacke('VESA-BIOS not found...');
|
||||
if not DetectVESA then
|
||||
Oh_Kacke('VESA-BIOS not found...');
|
||||
startmode:=GetVESAMode;
|
||||
bankswitchptr:=@switchbank;
|
||||
GraphGetMemPtr:=@system.getmem;
|
||||
@ -834,7 +926,16 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 1998-10-22 09:44:57 pierre
|
||||
Revision 1.7 1998-11-18 09:31:29 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.6 1998/10/22 09:44:57 pierre
|
||||
* PatternBuffer was not set on entry !!
|
||||
|
||||
Revision 1.5 1998/09/16 16:47:25 peter
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
until (counter=ende) or
|
||||
(((xp=xa[0]) or (xp=xa[1]) or (xp=xa[2])) and
|
||||
((yp=ya[0]) or (yp=ya[1]) or (yp=ya[2])));
|
||||
if Counter=Ende then exit else putpixel(xp,yp,aktcolor);
|
||||
if Counter=Ende then exit else putpixeli(xp,yp,aktcolor);
|
||||
end;
|
||||
repeat
|
||||
if (((xp=xe[0]) or (xp=xe[1]) or (xp=xe[2])) and
|
||||
@ -56,7 +56,7 @@
|
||||
counter:=counter+incr;
|
||||
xp:=PInteger(BufferMem)[counter+index1];
|
||||
yp:=PInteger(BufferMem)[counter+index2];
|
||||
putpixel(xp,yp,aktcolor);
|
||||
putpixeli(xp,yp,aktcolor);
|
||||
until counter=Ende;
|
||||
end;
|
||||
|
||||
@ -87,8 +87,17 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:30 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.3 1998/01/26 11:58:53 michael
|
||||
+ Added log at the end
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
|
||||
{ GetBkColor , SetBkColor , GetColor , SetColor , GetMaxColor }
|
||||
|
||||
|
||||
function Convert(Color:longint):longint;
|
||||
var c,r,g,b:longint;
|
||||
begin
|
||||
@ -33,14 +34,41 @@ begin
|
||||
C:=(Color and $FF000000);
|
||||
Convert:=(C shr 24) + (C shr 16) + (C shr 8) + C;
|
||||
end;
|
||||
end else
|
||||
end else if BytesPerPixel>2 then
|
||||
Convert:=Color and $FFFFFF
|
||||
else
|
||||
begin
|
||||
R:=(Color and $00FF0000) shr (24-VESAInfo.rm_size);
|
||||
G:=(Color and $0000FF00) shr (16-VESAInfo.gm_size);
|
||||
B:=(Color and $000000FF) shr (8-VESAInfo.bm_size);
|
||||
C:=(R shl VESAInfo.rf_pos) or (G shl VESAInfo.gf_pos) or
|
||||
(B shl VESAInfo.bf_pos);
|
||||
Convert:=(C shl 16) or C;
|
||||
if BytesPerPixel = 2 then
|
||||
Convert:=(C shl 16) or C;
|
||||
end;
|
||||
end;
|
||||
|
||||
function Unconvert(Color:longint):longint;
|
||||
var c,r,g,b:longint;
|
||||
begin
|
||||
if BytesPerPixel=1 then
|
||||
begin
|
||||
UnConvert:=Color and $FF;
|
||||
end
|
||||
else if BytesPerPixel>2 then
|
||||
Unconvert:=Color and $FFFFFF
|
||||
else
|
||||
begin
|
||||
C:=Color shr VesaInfo.bf_pos;
|
||||
b:= C and ( (1 shl (VesaInfo.bm_size))-1);
|
||||
b:= b shl (8-VesaInfo.bm_size);
|
||||
C:=Color shr VesaInfo.gf_pos;
|
||||
g:= C and ( (1 shl (VesaInfo.gm_size))-1);
|
||||
g:= g shl (8-VesaInfo.gm_size);
|
||||
C:=Color shr VesaInfo.rf_pos;
|
||||
r:= C and ( (1 shl (VesaInfo.rm_size))-1);
|
||||
r:= r shl (8-VesaInfo.rm_size);
|
||||
Unconvert:= r*$10000+g*$100+b;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -52,7 +80,7 @@ begin
|
||||
_graphresult:=grNoInitGraph;
|
||||
exit;
|
||||
end;
|
||||
getcolor:=aktcolor;
|
||||
getcolor:=truecolor;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------- }
|
||||
@ -65,6 +93,7 @@ begin
|
||||
_graphresult:=grNoInitGraph;
|
||||
exit;
|
||||
end;
|
||||
truecolor:=color;
|
||||
aktcolor:=convert(Color);
|
||||
end;
|
||||
|
||||
@ -78,7 +107,7 @@ begin
|
||||
_graphresult:=grNoInitGraph;
|
||||
exit;
|
||||
end;
|
||||
getbkcolor:=aktbackcolor;
|
||||
getbkcolor:=truebackcolor;
|
||||
end;
|
||||
|
||||
procedure SetBkColor(Color : longint);
|
||||
@ -89,6 +118,7 @@ begin
|
||||
_graphresult:=grNoInitGraph;
|
||||
exit;
|
||||
end;
|
||||
truebackcolor:=color;
|
||||
aktbackcolor:=convert(Color);
|
||||
end;
|
||||
|
||||
@ -103,10 +133,62 @@ begin
|
||||
getmaxcolor:=(1 shl VESAInfo.BitsPerPixel)-1;
|
||||
end;
|
||||
|
||||
procedure setstdcolors;
|
||||
|
||||
begin
|
||||
if bytesperpixel>1 then
|
||||
begin
|
||||
black := stdcolors[0];
|
||||
blue := stdcolors[1];
|
||||
green := stdcolors[2];
|
||||
cyan := stdcolors[3];
|
||||
red := stdcolors[4];
|
||||
magenta := stdcolors[5];
|
||||
brown := stdcolors[6];
|
||||
lightgray := stdcolors[7];
|
||||
darkgray := stdcolors[8];
|
||||
lightblue := stdcolors[9];
|
||||
lightgreen := stdcolors[10];
|
||||
lightcyan := stdcolors[11];
|
||||
lightred := stdcolors[12];
|
||||
lightmagenta := stdcolors[13];
|
||||
yellow := stdcolors[14];
|
||||
white := stdcolors[15];
|
||||
end
|
||||
else
|
||||
begin
|
||||
black := 0;
|
||||
blue := 1;
|
||||
green := 2;
|
||||
cyan := 3;
|
||||
red := 4;
|
||||
magenta := 5;
|
||||
brown := 6;
|
||||
lightgray := 7;
|
||||
darkgray := 8;
|
||||
lightblue := 9;
|
||||
lightgreen := 10;
|
||||
lightcyan := 11;
|
||||
lightred := 12;
|
||||
lightmagenta := 13;
|
||||
yellow := 14;
|
||||
white := 15;
|
||||
end;
|
||||
end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:31 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.3 1998/01/26 11:57:43 michael
|
||||
+ Added log at the end
|
||||
|
||||
@ -51,14 +51,14 @@
|
||||
{ umschalten zu verhindern }
|
||||
|
||||
while aq <> count do begin
|
||||
PutPixel( PWord(buffermem)[aq] ,PWord(buffermem)[aq+3],aktcolor);
|
||||
PutPixel( PWord(buffermem)[aq+2],PWord(buffermem)[aq+3],aktcolor);
|
||||
PutPixeli( PWord(buffermem)[aq] ,PWord(buffermem)[aq+3],aktcolor);
|
||||
PutPixeli( PWord(buffermem)[aq+2],PWord(buffermem)[aq+3],aktcolor);
|
||||
aq:=aq+4;
|
||||
end;
|
||||
while aq <> 0 do begin
|
||||
aq:=aq-4;
|
||||
PutPixel( PWord(buffermem)[aq] ,PWord(buffermem)[aq+1],aktcolor);
|
||||
PutPixel( PWord(buffermem)[aq+2],PWord(buffermem)[aq+1],aktcolor);
|
||||
PutPixeli( PWord(buffermem)[aq] ,PWord(buffermem)[aq+1],aktcolor);
|
||||
PutPixeli( PWord(buffermem)[aq+2],PWord(buffermem)[aq+1],aktcolor);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -112,8 +112,17 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:32 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.3 1998/01/26 11:57:54 michael
|
||||
+ Added log at the end
|
||||
|
||||
@ -81,7 +81,15 @@ begin
|
||||
bordercol:=bordercol and $FF;
|
||||
fillcol:=aktfillsettings.color and $FF;
|
||||
end
|
||||
else begin
|
||||
{$ifdef TEST_24BPP}
|
||||
else if BytesPerPixel=3
|
||||
then begin
|
||||
bordercol:=bordercol and $FFFFFF;
|
||||
fillcol:=aktfillsettings.color and $FFFFFF;
|
||||
end
|
||||
{$endif TEST_24BPP}
|
||||
else if BytesPerPixel=2
|
||||
then begin
|
||||
bordercol:=bordercol and $FFFF;
|
||||
fillcol:=aktfillsettings.color and $FFFF;
|
||||
end;
|
||||
@ -97,6 +105,7 @@ begin
|
||||
exit;
|
||||
end;
|
||||
Fillinfo:=aktfillsettings;
|
||||
Fillinfo.color:=unconvert(aktfillsettings.color);
|
||||
end;
|
||||
|
||||
procedure GetFillPattern(var FillPattern:FillPatternType);
|
||||
@ -165,10 +174,28 @@ begin
|
||||
end;
|
||||
lineinfo:=aktlineinfo;
|
||||
end;
|
||||
|
||||
{ just dummy not implemented yet }
|
||||
procedure FillPoly(points : word;var polypoints);
|
||||
begin
|
||||
{ simply call drawpoly instead (PM) }
|
||||
DrawPoly(points,polypoints);
|
||||
end;
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:33 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.3 1998/01/26 11:57:57 michael
|
||||
+ Added log at the end
|
||||
|
||||
@ -40,22 +40,22 @@
|
||||
Default = 0;
|
||||
|
||||
{ Farben f<>r setpalette und setallpalette }
|
||||
black = 0;
|
||||
blue = 1;
|
||||
green = 2;
|
||||
cyan = 3;
|
||||
red = 4;
|
||||
magenta = 5;
|
||||
brown = 6;
|
||||
lightgray = 7;
|
||||
darkgray = 8;
|
||||
lightblue = 9;
|
||||
lightgreen = 10;
|
||||
lightcyan = 11;
|
||||
lightred = 12;
|
||||
lightmagenta = 13;
|
||||
yellow = 14;
|
||||
white = 15;
|
||||
black : longint = 0;
|
||||
blue : longint = 1;
|
||||
green : longint = 2;
|
||||
cyan : longint = 3;
|
||||
red : longint = 4;
|
||||
magenta : longint = 5;
|
||||
brown : longint = 6;
|
||||
lightgray : longint = 7;
|
||||
darkgray : longint = 8;
|
||||
lightblue : longint = 9;
|
||||
lightgreen : longint = 10;
|
||||
lightcyan : longint = 11;
|
||||
lightred : longint = 12;
|
||||
lightmagenta : longint = 13;
|
||||
yellow : longint = 14;
|
||||
white : longint = 15;
|
||||
|
||||
{ Linenart f<>r Get/SetLineStyle: }
|
||||
SolidLn = 0;
|
||||
@ -114,6 +114,7 @@
|
||||
OrPut = 2;
|
||||
AndPut = 3;
|
||||
NotPut = 4;
|
||||
ClearTextPut = $80;
|
||||
|
||||
{ SetTextJustify constants }
|
||||
LeftText = 0;
|
||||
@ -188,7 +189,16 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-03-26 10:41:15 florian
|
||||
Revision 1.3 1998-11-18 09:31:34 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.2 1998/03/26 10:41:15 florian
|
||||
* some warnings fixed
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
|
||||
@ -31,6 +31,9 @@ end;
|
||||
|
||||
function GetVESAInfo( Mode : WORD ):Boolean;
|
||||
var Result_:longint;
|
||||
Temp,ReadFrameBufferLinearAddress : longint;
|
||||
St : string;
|
||||
w : word;
|
||||
begin
|
||||
Result_:=Global_dos_alloc($0200);
|
||||
Sel:=word(Result_);
|
||||
@ -49,12 +52,24 @@ begin
|
||||
if (dregs.RealEAX and $1ff) =$4F then
|
||||
begin
|
||||
GetVESAInfo:=true;
|
||||
{ mode is supported only if bit 0 in modeAttributes is set }
|
||||
if (VESAInfo.ModeAttributes and 1)=0 then
|
||||
GetVESAInfo:=false;
|
||||
BytesPerLine:=VESAInfo.BPL;
|
||||
case VESAInfo.BitsPerPixel of
|
||||
8 : BytesPerPixel:=1;
|
||||
15,16 : BytesPerPixel:=2;
|
||||
{$ifdef TEST_24BPP}
|
||||
24 : begin
|
||||
Oh_Kacke('24-Bit Modis nicht implementiert !');
|
||||
BytesPerPixel:=3;
|
||||
end;
|
||||
32 : begin
|
||||
BytesPerPixel:=4;
|
||||
end;
|
||||
{$endif TEST_24BPP}
|
||||
else begin
|
||||
str(VESAInfo.BitsPerPixel,St);
|
||||
Oh_Kacke(St+'-Bit Mode not implemented !');
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
@ -75,6 +90,9 @@ begin
|
||||
Granularity:=VESAInfo.WinGranularity;
|
||||
Granular:=VESAInfo.WinSize div Granularity;
|
||||
case Granular of
|
||||
256 : GranShift:=8;
|
||||
128 : GranShift:=7;
|
||||
64 : GranShift:=6;
|
||||
32 : GranShift:=5;
|
||||
16 : GranShift:=4;
|
||||
8 : GranShift:=3;
|
||||
@ -82,14 +100,104 @@ begin
|
||||
2 : GranShift:=1;
|
||||
1 : GranShift:=0;
|
||||
end;
|
||||
{ set selector for writing }
|
||||
(* { on my ATI rage pro card these field are zeroed !! (PM) }
|
||||
|
||||
if VesaInfo.rf_pos=VesaInfo.bf_pos then
|
||||
begin
|
||||
VesaInfo.rm_size:=VESAInfo.BitsPerPixel div 3;
|
||||
VesaInfo.bm_size:=VESAInfo.BitsPerPixel div 3;
|
||||
VesaInfo.gm_size:=VESAInfo.BitsPerPixel -2*VesaInfo.bm_size;
|
||||
VesaInfo.bf_pos:=0;
|
||||
VesaInfo.gf_pos:=VesaInfo.bm_size;
|
||||
VesaInfo.rf_pos:=VesaInfo.bm_size+VesaInfo.gm_size;
|
||||
end; *)
|
||||
|
||||
if isDPMI then begin
|
||||
set_segment_base_address(seg_write,$A000 shl 4);
|
||||
set_segment_limit(seg_write,$FFFF);
|
||||
seg_read:=seg_write;
|
||||
set_segment_base_address(seg_read,$A000 shl 4);
|
||||
set_segment_limit(seg_read,$FFFF);
|
||||
end;
|
||||
{ read and write window can be different !!! PM }
|
||||
if ((VESAInfo.WinAAttributes and 5)=5) then
|
||||
AW_Window:=AWindow
|
||||
else if ((VESAInfo.WinBAttributes and 5)=5) then
|
||||
AW_Window:=BWindow
|
||||
else Oh_Kacke('No write window !! ');
|
||||
if ((VESAInfo.WinAAttributes and 3)=3) then
|
||||
AR_Window:=AWindow
|
||||
else if ((VESAInfo.WinBAttributes and 3)=3) then
|
||||
AR_Window:=BWindow
|
||||
else Oh_Kacke('No read window !! ');
|
||||
if AW_Window=AR_Window then
|
||||
same_window:=true
|
||||
else
|
||||
same_window:=false;
|
||||
|
||||
if (VESAInfo.ModeAttributes and $80)=$80 then
|
||||
LinearFrameBufferSupported:=true
|
||||
else
|
||||
LinearFrameBufferSupported:=false;
|
||||
|
||||
{$ifdef Test_linear}
|
||||
{ try to swap the FrameBuffer Physical Address }
|
||||
if switch_physical_address then
|
||||
begin
|
||||
w:=VESAInfo.PhysAddress and $FFFF;
|
||||
VESAInfo.PhysAddress:=(w shl 16) or (VESAInfo.PhysAddress shr 16);
|
||||
end;
|
||||
if split_physical_address and not same_window then
|
||||
begin
|
||||
ReadFrameBufferLinearAddress:=Get_linear_addr(VESAInfo.PhysAddress and $FFFF0000,VGAInfo.TotalMem shl 16);
|
||||
if int31error<>0 then
|
||||
writeln(stderr,'Error in get linear address for ',hexstr(VESAInfo.PhysAddress and $FFFF0000,8));
|
||||
FrameBufferLinearAddress:=Get_linear_addr((VESAInfo.PhysAddress and $FFFF) shl 16,VGAInfo.TotalMem shl 16);
|
||||
if int31error<>0 then
|
||||
writeln(stderr,'Error in get linear address for ',hexstr((VESAInfo.PhysAddress and $FFFF) shl 16,8));
|
||||
end;
|
||||
If LinearFrameBufferSupported then
|
||||
begin
|
||||
if same_window or not split_physical_address then
|
||||
FrameBufferLinearAddress:=Get_linear_addr(VESAInfo.PhysAddress and $FFFF0000,VGAInfo.TotalMem shl 16);
|
||||
if int31error<>0 then
|
||||
writeln(stderr,'Error in get linear address for ',hexstr(VESAInfo.PhysAddress,8));
|
||||
end
|
||||
else
|
||||
{$endif Test_linear}
|
||||
FrameBufferLinearAddress:=$A0000;
|
||||
|
||||
{$ifdef Test_linear}
|
||||
If isDPMI and LinearFrameBufferSupported and UseLinear then
|
||||
UseLinearFrameBuffer:=true
|
||||
else
|
||||
UseLinearFrameBuffer:=false;
|
||||
if UseLinearFrameBuffer then
|
||||
begin
|
||||
set_segment_base_address(seg_write,FrameBufferLinearAddress);
|
||||
set_segment_limit(seg_write,(VGAInfo.TotalMem shl 16)-1);
|
||||
if split_physical_address and not same_window then
|
||||
set_segment_base_address(seg_read,ReadFrameBufferLinearAddress)
|
||||
else
|
||||
set_segment_base_address(seg_read,FrameBufferLinearAddress);
|
||||
set_segment_limit(seg_read,(VGAInfo.TotalMem shl 16)-1);
|
||||
WinSize:=(VGAInfo.TotalMem shl 16);
|
||||
WinLoMask:=(VGAInfo.TotalMem shl 16)-1;
|
||||
WinShift:=16;
|
||||
Temp:=VGAInfo.TotalMem;
|
||||
while Temp>0 do
|
||||
begin
|
||||
inc(WinShift);
|
||||
Temp:=Temp shr 1;
|
||||
end;
|
||||
end;
|
||||
{$endif Test_linear}
|
||||
SwitchCS:=hi(VESAInfo.RealWinFuncPtr);
|
||||
SwitchIP:=lo(VESAInfo.RealWinFuncPtr);
|
||||
{ usefull for boundary problems }
|
||||
if BytesPerPixel=3 then
|
||||
WinLoMaskMinusPixelSize:=WinLoMask-4
|
||||
else
|
||||
WinLoMaskMinusPixelSize:=WinLoMask-BytesPerPixel;
|
||||
end else GetVESAInfo:=false;
|
||||
end;
|
||||
|
||||
@ -118,15 +226,17 @@ var RM:Word;
|
||||
begin
|
||||
isDPMI:=false;
|
||||
rm:=get_run_mode;
|
||||
{$ifdef Debug}
|
||||
case rm of
|
||||
0 : writeln('unknown mode');
|
||||
1 : writeln('RAW mode');
|
||||
2 : writeln('XMS detected');
|
||||
3 : writeln('VCPI detected');
|
||||
4 : begin writeln('DPMI detected');
|
||||
isDPMI:=true;
|
||||
end;
|
||||
4 : writeln('DPMI detected');
|
||||
end; { case }
|
||||
{$endif Debug}
|
||||
if rm=4 then
|
||||
isDPMI:=true;
|
||||
if isDPMI then begin
|
||||
seg_write:=allocate_ldt_descriptors(1);
|
||||
seg_read:=allocate_ldt_descriptors(1);
|
||||
@ -146,27 +256,55 @@ end;
|
||||
|
||||
procedure Switchbank(bank:longint);
|
||||
begin
|
||||
with dregs do
|
||||
begin
|
||||
a_bank:=bank;
|
||||
realedx:=bank shl granshift;
|
||||
realcs:=switchcs;
|
||||
realip:=switchip;
|
||||
realebx:=aw_window;
|
||||
realss:=0;
|
||||
realsp:=0;
|
||||
end;
|
||||
asm
|
||||
leal _DREGS,%edi
|
||||
movl bank,%eax
|
||||
movzbl _GRANSHIFT,%ecx
|
||||
shll %cl,%eax
|
||||
movl %eax,20(%edi) // RealEDX
|
||||
movw _SWITCHCS,%ax
|
||||
movw %ax,44(%edi) // RealCS
|
||||
movw _SWITCHIP,%ax // RealIP
|
||||
movw %ax,42(%edi)
|
||||
xorl %ecx,%ecx
|
||||
movl %ecx,46(%edi) // RealSS,RealSP
|
||||
movl %ecx,16(%edi) // RealEBX
|
||||
movw $0x0301,%ax
|
||||
int $0x31
|
||||
leal _DREGS,%edi
|
||||
xorl %ecx,%ecx
|
||||
movl %ecx,%ebx
|
||||
movw $0x0301,%ax
|
||||
int $0x31
|
||||
end;
|
||||
if not same_window then
|
||||
with dregs do
|
||||
begin
|
||||
realedx:=bank shl granshift;
|
||||
realcs:=switchcs;
|
||||
realip:=switchip;
|
||||
realebx:=ar_window;
|
||||
realss:=0;
|
||||
realsp:=0;
|
||||
asm
|
||||
leal _DREGS,%edi
|
||||
xorl %ecx,%ecx
|
||||
movl %ecx,%ebx
|
||||
movw $0x0301,%ax
|
||||
int $0x31
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-10-09 10:26:36 peter
|
||||
Revision 1.3 1998-11-18 09:31:35 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.2 1998/10/09 10:26:36 peter
|
||||
* rename result -> result_
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
|
||||
@ -28,13 +28,13 @@ begin
|
||||
x1:=x1+aktviewport.x1;
|
||||
y1:=y1+aktviewport.y1;
|
||||
x2:=x2+aktviewport.x1;
|
||||
y2:=y2+aktviewport.y1;
|
||||
y2:=y2+aktviewport.y1;
|
||||
|
||||
if (x1>_maxx) or (y1>_maxy) or (x2<0) or (y2<0) then exit;
|
||||
if (x1>_maxx) or (y1>_maxy) or (x2<0) or (y2<0) then exit;
|
||||
|
||||
target:=longint(@bitmap)+4;
|
||||
pinteger(@bitmap)^:=x2-x1+1;
|
||||
pinteger(@bitmap+2)^:=y2-y1+1;
|
||||
pinteger(@bitmap+2)^:=y2-y1+1;
|
||||
linesize:=(x2-x1+1)*BytesPerPixel;
|
||||
|
||||
for i:=y1 to y2 do
|
||||
@ -42,19 +42,17 @@ for i:=y1 to y2 do
|
||||
ofs1:=Y_ARRAY[i]+X_ARRAY[x1];
|
||||
ofs2:=Y_ARRAY[i]+X_ARRAY[x2];
|
||||
bank1:=ofs1 shr WinShift;
|
||||
bank2:=ofs2 shr WinShift;
|
||||
if bank1 <> AW_BANK then
|
||||
bank2:=ofs2 shr WinShift;
|
||||
if bank1 <> A_BANK then
|
||||
begin
|
||||
Switchbank(bank1);
|
||||
AW_BANK:=bank1;
|
||||
end;
|
||||
if bank1=bank2
|
||||
if bank1=bank2
|
||||
then ScreenToMem(ofs1 and WinLoMask,target,linesize)
|
||||
else begin
|
||||
else begin
|
||||
diff:=(bank2 shl winshift)-ofs2;
|
||||
ScreenToMem(ofs1 and WinLoMask,target,diff-BytesPerPixel);
|
||||
Switchbank(bank2);
|
||||
AW_BANK:=bank2;
|
||||
ScreenToMem((ofs1+diff) and WinLoMask,target+diff,linesize-diff);
|
||||
end;
|
||||
target:=target+linesize;
|
||||
@ -88,7 +86,7 @@ procedure PutImage(x,y : integer;var BitMap;BitBlt : word);
|
||||
|
||||
if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
|
||||
if (x > viewport.x2 ) or
|
||||
(y > viewport.y2 ) or
|
||||
(y > viewport.y2 ) or
|
||||
(x+Increment < viewport.x1) or
|
||||
(y+height < viewport.y1) then exit;
|
||||
|
||||
@ -102,7 +100,7 @@ procedure PutImage(x,y : integer;var BitMap;BitBlt : word);
|
||||
end;
|
||||
{ Clip unten }
|
||||
|
||||
if y+height > viewport.y2 then
|
||||
if y+height > viewport.y2 then
|
||||
height:=viewport.y2-y;
|
||||
|
||||
{ Clip links }
|
||||
@ -128,10 +126,9 @@ procedure PutImage(x,y : integer;var BitMap;BitBlt : word);
|
||||
offset:=Y_ARRAY[i] + X_ARRAY[x];
|
||||
o1:=offset shr winshift;
|
||||
o2:=( offset + width ) shr winshift;
|
||||
if o1 <> AW_BANK then
|
||||
if o1 <> A_BANK then
|
||||
begin
|
||||
Switchbank(o1);
|
||||
AW_BANK:=o1;
|
||||
end;
|
||||
if o1 = o2 then
|
||||
begin
|
||||
@ -148,27 +145,27 @@ procedure PutImage(x,y : integer;var BitMap;BitBlt : word);
|
||||
case bitblt of
|
||||
normalput : begin
|
||||
MemToScreen (source,offset and WinLoMask,diff-BytesPerPixel);
|
||||
Switchbank(o2); AW_BANK:=o2;
|
||||
Switchbank(o2);
|
||||
MemToScreen (source+diff,(offset+diff) and WinLoMask,width-diff);
|
||||
end;
|
||||
andput : begin
|
||||
MemAndScreen (source,offset and WinLoMask,diff-BytesPerPixel);
|
||||
Switchbank(o2); AW_BANK:=o2;
|
||||
Switchbank(o2);
|
||||
MemAndScreen (source+diff,(offset+diff) and WinLoMask,width-diff);
|
||||
end;
|
||||
orput : begin
|
||||
MemOrScreen (source,offset and WinLoMask,diff-BytesPerPixel);
|
||||
Switchbank(o2); AW_BANK:=o2;
|
||||
Switchbank(o2);
|
||||
MemOrScreen (source++diff,(offset+diff) and WinLoMask,width-diff);
|
||||
end;
|
||||
xorput : begin
|
||||
MemXorScreen(source,offset and WinLoMask,diff-BytesPerPixel);
|
||||
Switchbank(o2); AW_BANK:=o2;
|
||||
Switchbank(o2);
|
||||
MemXorScreen(source+diff,(offset+diff) and WinLoMask,width-diff);
|
||||
end;
|
||||
notput : begin
|
||||
MemNotScreen(source,offset and WinLoMask,diff-BytesPerPixel);
|
||||
Switchbank(o2); AW_BANK:=o2;
|
||||
Switchbank(o2);
|
||||
MemNotScreen(source+diff,(offset+diff) and WinLoMask,width-diff);
|
||||
end;
|
||||
end; { case }
|
||||
@ -181,20 +178,29 @@ procedure PutImage(x,y : integer;var BitMap;BitBlt : word);
|
||||
end;
|
||||
|
||||
|
||||
function ImageSize(x1,y1,x2,y2 : integer) : word;
|
||||
function ImageSize(x1,y1,x2,y2 : integer) : longint;
|
||||
|
||||
begin
|
||||
_graphresult:=grOk;
|
||||
ImageSize:=(x2-x1+1)*(y2-y1+1)*BytesPerPixel+4;
|
||||
{ +4, da Breite und H”he mit abgespeichert werden }
|
||||
{ 4 bytes for Height and width in words at the beginning }
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:36 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.5 1998/03/03 22:48:42 florian
|
||||
+ graph.drawpoly procedure
|
||||
|
||||
@ -14,6 +14,17 @@
|
||||
|
||||
procedure DrawPattern(x1,x2,y:integer);
|
||||
begin
|
||||
if BytesPerPixel=3 then
|
||||
{ big problem one point can be across boundary !! }
|
||||
begin
|
||||
if ((Y_Array[y]+X_array[x1]) and winlomask)+3 > winlomask then
|
||||
begin
|
||||
{ special point !! }
|
||||
{ not implemented yet !! }
|
||||
inc(x1);
|
||||
end;
|
||||
end;
|
||||
|
||||
asm
|
||||
movswl x1,%ebx
|
||||
movswl x2,%ecx
|
||||
@ -34,57 +45,127 @@ begin
|
||||
movw _SEG_WRITE,%ax
|
||||
movw %ax,%es
|
||||
testw $1,_AKTWRITEMODE
|
||||
jnz pl_xord
|
||||
pl_movd:
|
||||
testw $1,_BYTESPERPIXEL
|
||||
jz pl_movdw
|
||||
|
||||
jnz .Lpl_xord
|
||||
.Lpl_movd:
|
||||
cmpw $2,_BYTESPERPIXEL
|
||||
je .Lpl_movdw
|
||||
jb .Lpl_movdb
|
||||
|
||||
{$ifdef TEST_24BPP}
|
||||
cmpw $3,_BYTESPERPIXEL
|
||||
je .Lpl_movd24BPP
|
||||
.align 4,0x90
|
||||
pl_movdb:
|
||||
.Lpl_movd32BPP:
|
||||
andl $7,%ebx
|
||||
movl (%esi,%ebx,4),%eax
|
||||
andl $0x00FFFFFF,%eax
|
||||
movl %eax,%es:(%edi)
|
||||
addl $4,%edi
|
||||
cmpl _WINLOMASKMINUSPIXELSIZE,%edi
|
||||
ja .Lpl_d_exit
|
||||
incl %ebx
|
||||
decl %ecx
|
||||
jnz .Lpl_movd32BPP
|
||||
jz .Lpl_d_exit
|
||||
.align 4,0x90
|
||||
.Lpl_movd24BPP:
|
||||
andl $7,%ebx
|
||||
movl (%esi,%ebx,4),%eax
|
||||
andl $0x00FFFFFF,%eax
|
||||
movl %es:(%edi),%edx
|
||||
andl $0xFF000000,%edx
|
||||
orl %edx,%eax
|
||||
movl %eax,%es:(%edi)
|
||||
addl $3,%edi
|
||||
cmpl _WINLOMASKMINUSPIXELSIZE,%edi
|
||||
ja .Lpl_d_exit
|
||||
incl %ebx
|
||||
decl %ecx
|
||||
jnz .Lpl_movd24BPP
|
||||
jz .Lpl_d_exit
|
||||
{$endif TEST_24BPP}
|
||||
.align 4,0x90
|
||||
.Lpl_movdb:
|
||||
andl %edx,%ebx
|
||||
movb (%esi,%ebx,4),%al
|
||||
movb %al,%es:(%edi)
|
||||
incl %edi
|
||||
incl %ebx
|
||||
decl %ecx
|
||||
jnz pl_movdb
|
||||
jz pl_d_exit
|
||||
jnz .Lpl_movdb
|
||||
jz .Lpl_d_exit
|
||||
|
||||
.align 4,0x90
|
||||
pl_movdw:
|
||||
.Lpl_movdw:
|
||||
andl %edx,%ebx
|
||||
movw (%esi,%ebx,4),%ax
|
||||
movw %ax,%es:(%edi)
|
||||
addl $2,%edi
|
||||
incl %ebx
|
||||
decl %ecx
|
||||
jnz pl_movdw
|
||||
jz pl_d_exit
|
||||
pl_xord:
|
||||
testw $1,_BYTESPERPIXEL
|
||||
jz pl_xordw
|
||||
jnz .Lpl_movdw
|
||||
jz .Lpl_d_exit
|
||||
.Lpl_xord:
|
||||
cmpw $2,_BYTESPERPIXEL
|
||||
je .Lpl_xordw
|
||||
jb .Lpl_xordb
|
||||
|
||||
{$ifdef TEST_24BPP}
|
||||
cmpw $3,_BYTESPERPIXEL
|
||||
je .Lpl_xord24BPP
|
||||
.align 4,0x90
|
||||
pl_xordb:
|
||||
.Lpl_xord32BPP:
|
||||
andl $7,%ebx
|
||||
movl (%esi,%ebx,4),%eax
|
||||
andl $0x00FFFFFF,%eax
|
||||
movl %es:(%edi),%edx
|
||||
xorl %edx,%eax
|
||||
movl %eax,%es:(%edi)
|
||||
addl $4,%edi
|
||||
cmpl _WINLOMASKMINUSPIXELSIZE,%edi
|
||||
ja .Lpl_d_exit
|
||||
incl %ebx
|
||||
decl %ecx
|
||||
jnz .Lpl_xord32BPP
|
||||
jz .Lpl_d_exit
|
||||
.align 4,0x90
|
||||
.Lpl_xord24BPP:
|
||||
andl $7,%ebx
|
||||
movl (%esi,%ebx,4),%eax
|
||||
andl $0x00FFFFFF,%eax
|
||||
movl %es:(%edi),%edx
|
||||
xorl %edx,%eax
|
||||
movl %eax,%es:(%edi)
|
||||
addl $3,%edi
|
||||
cmpl _WINLOMASKMINUSPIXELSIZE,%edi
|
||||
ja .Lpl_d_exit
|
||||
incl %ebx
|
||||
decl %ecx
|
||||
jnz .Lpl_xord24BPP
|
||||
jz .Lpl_d_exit
|
||||
{$endif TEST_24BPP}
|
||||
.align 4,0x90
|
||||
.Lpl_xordb:
|
||||
andl %edx,%ebx
|
||||
movb (%esi,%ebx,4),%al
|
||||
xorb %al,%es:(%edi)
|
||||
incl %edi
|
||||
incl %ebx
|
||||
decl %ecx
|
||||
jnz pl_xordb
|
||||
jz pl_d_exit
|
||||
jnz .Lpl_xordb
|
||||
jz .Lpl_d_exit
|
||||
.align 4,0x90
|
||||
pl_xordw:
|
||||
.Lpl_xordw:
|
||||
andl %edx,%ebx
|
||||
movw (%esi,%ebx,4),%ax
|
||||
xorw %ax,%es:(%edi)
|
||||
addl $2,%edi
|
||||
incl %ebx
|
||||
decl %ecx
|
||||
jnz pl_xordw
|
||||
pl_d_exit:
|
||||
jnz .Lpl_xordw
|
||||
.Lpl_d_exit:
|
||||
popw %es
|
||||
pl_exit:
|
||||
.Lpl_exit:
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -109,15 +190,14 @@ begin
|
||||
ofs1:= ofs1 + X_ARRAY[x1];
|
||||
bank1:=ofs1 shr winshift;
|
||||
bank2:=ofs2 shr winshift;
|
||||
if bank1 <> AW_BANK then
|
||||
if bank1 <> A_BANK then
|
||||
begin
|
||||
Switchbank(bank1);
|
||||
AW_BANK:=bank1;
|
||||
end;
|
||||
if bank1 <> bank2 then begin
|
||||
diff:=(((bank2 shl winshift)-ofs1) div BytesPerPixel)+x1;
|
||||
DrawPattern(x1,diff-1,y);
|
||||
Switchbank(bank2); AW_BANK:=bank2;
|
||||
Switchbank(bank2);
|
||||
DrawPattern(diff,x2,y);
|
||||
end else DrawPattern(x1,x2,y);
|
||||
end;
|
||||
@ -125,7 +205,36 @@ end;
|
||||
|
||||
procedure HorizontalLine(x1,x2,y:integer);
|
||||
{ without bankswitching }
|
||||
{ nothing for 24BPP yet (PM) }
|
||||
{$ifdef TEST_24BPP}
|
||||
var i,j : longint;
|
||||
{$endif TEST_24BPP}
|
||||
begin
|
||||
{$ifdef TEST_24BPP}
|
||||
if BytesPerPixel=3 then
|
||||
{ big problem one point can be across boundary !! }
|
||||
begin
|
||||
if ((Y_Array[y]+X_array[x1]) and winlomask)+3 > winlomask then
|
||||
begin
|
||||
{ special point !! }
|
||||
{ not implemented yet !! }
|
||||
inc(x1);
|
||||
end;
|
||||
j:=Y_array[y]+X_array[x1];
|
||||
for i:=x1 to x2 do
|
||||
begin
|
||||
if aktwritemode=normalput then
|
||||
pixel(j)
|
||||
else
|
||||
begin
|
||||
putpixeli(i,y,aktcolor xor getpixel(i,y));
|
||||
end;
|
||||
inc(j,3);
|
||||
end;
|
||||
exit;
|
||||
end;
|
||||
{$endif TEST_24BPP}
|
||||
|
||||
asm
|
||||
movw %es,%dx
|
||||
movzwl y,%ebx
|
||||
@ -144,40 +253,40 @@ begin
|
||||
movw _SEG_WRITE,%bx
|
||||
movw %bx,%es
|
||||
testl %esi,%esi // { Writemode ? }
|
||||
jnz hl_xor
|
||||
jnz .Lhl_xor
|
||||
shrl %ecx
|
||||
jnc _movw
|
||||
jnc .L_movw
|
||||
stosb
|
||||
_movw:
|
||||
.L_movw:
|
||||
shrl %ecx
|
||||
jnc _movd
|
||||
jnc .L_movd
|
||||
stosw
|
||||
_movd:
|
||||
.L_movd:
|
||||
rep
|
||||
stosl
|
||||
jmp hl_exit
|
||||
jmp .Lhl_exit
|
||||
|
||||
hl_xor: // -------------------------------------------------
|
||||
.Lhl_xor: // -------------------------------------------------
|
||||
|
||||
movl $4,%esi
|
||||
shrl %ecx
|
||||
jnc hl_xorw
|
||||
jnc .Lhl_xorw
|
||||
xorb %al,%es:(%edi)
|
||||
incl %edi
|
||||
hl_xorw:
|
||||
.Lhl_xorw:
|
||||
shrl %ecx
|
||||
jnc hl_xord
|
||||
jnc .Lhl_xord
|
||||
xorw %ax,%es:(%edi)
|
||||
addl $2,%edi
|
||||
hl_xord:
|
||||
jecxz hl_exit
|
||||
.Lhl_xord:
|
||||
jecxz .Lhl_exit
|
||||
.align 4,0x90
|
||||
hl_xorloop:
|
||||
.Lhl_xorloop:
|
||||
xorl %eax,%es:(%edi)
|
||||
addl %esi,%edi
|
||||
decl %ecx
|
||||
jnz hl_xorloop
|
||||
hl_exit:
|
||||
jnz .Lhl_xorloop
|
||||
.Lhl_exit:
|
||||
movw %dx,%es
|
||||
end;
|
||||
end;
|
||||
@ -214,17 +323,16 @@ begin
|
||||
ofs2:=ofs+X_ARRAY[x2];
|
||||
ofs:= ofs+X_ARRAY[x1];
|
||||
i1:=ofs shr winshift; i2:=ofs2 shr winshift;
|
||||
if i1 <> aw_bank then
|
||||
if i1 <> a_bank then
|
||||
begin
|
||||
switchbank(i1);
|
||||
aw_bank:=i1;
|
||||
end;
|
||||
if i1=i2 then Horizontalline(x1,x2,y1)
|
||||
else
|
||||
begin
|
||||
dx:=((i2 shl winshift)-ofs) div BytesPerPixel;
|
||||
horizontalline(x1,x1+dx-1,y1);
|
||||
Switchbank(i2); AW_BANK:=i2;
|
||||
Switchbank(i2);
|
||||
horizontalline(dx+x1,x2,y1);
|
||||
end;
|
||||
end;
|
||||
@ -270,9 +378,11 @@ begin
|
||||
d:=i1 - dx;
|
||||
i2:=(dx shl 1)-i1;
|
||||
|
||||
{ for 24BPP use slow checking code,easy and poor implementation ! PM }
|
||||
dontcheck:=(y1>=viewport.y1) and (y2<=viewport.y2) and
|
||||
(x1>=viewport.x1) and (x1<=viewport.x2) and
|
||||
(x2>=viewport.x1) and (x2<=viewport.x2);
|
||||
(x2>=viewport.x1) and (x2<=viewport.x2) and
|
||||
(BytesPerPixel<=2);
|
||||
|
||||
if aktlineinfo.thickness=3 then
|
||||
|
||||
@ -326,7 +436,7 @@ end else
|
||||
movl %eax,i2long
|
||||
movl _WBUFFER,%eax
|
||||
movl %eax,.Lwbuffer
|
||||
movl _WINSHIFT,%eax
|
||||
movzbl _WINSHIFT,%eax
|
||||
movb %al,.Lwinshift
|
||||
movl _WINLOMASK,%eax
|
||||
movl %eax,.Lwinlomask
|
||||
@ -366,13 +476,12 @@ line1_loop:
|
||||
.byte 0x88 // _WINSHIFT
|
||||
|
||||
pushl %edi
|
||||
cmpl _AW_BANK,%eax
|
||||
cmpl _A_BANK,%eax
|
||||
je line1_dontswitch
|
||||
|
||||
pushl %ebx
|
||||
pushl %edx
|
||||
pushl %esi
|
||||
movl %eax,_AW_BANK // newbank
|
||||
pushl %eax
|
||||
movl _BANKSWITCHPTR,%eax
|
||||
call %eax
|
||||
@ -510,10 +619,10 @@ begin
|
||||
end;
|
||||
aktlineinfo.linestyle:=linestyle;
|
||||
if aktlineinfo.linestyle=UserBitLn then
|
||||
aktlineinfo.pattern:=pattern
|
||||
else
|
||||
aktlineinfo.pattern:=linepatterns[aktlineinfo.linestyle];
|
||||
aktlineinfo.thickness:=thickness;
|
||||
aktlineinfo.pattern:=pattern
|
||||
else
|
||||
aktlineinfo.pattern:=linepatterns[aktlineinfo.linestyle];
|
||||
aktlineinfo.thickness:=thickness;
|
||||
end;
|
||||
|
||||
procedure DrawPoly(points : word;var polypoints);
|
||||
@ -544,7 +653,16 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-09-02 08:16:00 pierre
|
||||
Revision 1.3 1998-11-18 09:31:37 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.2 1998/09/02 08:16:00 pierre
|
||||
* local asm labels with global variable names removed !!
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
|
||||
@ -12,26 +12,77 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
const VESANumber=10;
|
||||
VESAModes : Array[0..VESANumber] of word=
|
||||
($100, { 640x400x256 }
|
||||
$101, { 640x480x256 }
|
||||
$110, { 640x480x32K }
|
||||
$111, { 640x480x64k }
|
||||
$103, { 800x600x256 }
|
||||
$113, { 800x600x32k }
|
||||
$114, { 800x600x64k }
|
||||
$105, { 1024x768x256 }
|
||||
$116, { 1024x768x32k }
|
||||
$107, { 1280x1024x256 }
|
||||
$117); { 1024x768x64k }
|
||||
|
||||
|
||||
const
|
||||
{$ifndef TEST_24BPP}
|
||||
VESANumber=13;
|
||||
{$else TEST_24BPP}
|
||||
VESANumber=16;
|
||||
{$endif TEST_24BPP}
|
||||
VESAModes : Array[0..VESANumber-1] of word=
|
||||
( $100 { 640x400x256 }
|
||||
,$101 { 640x480x256 }
|
||||
,$110 { 640x480x32K }
|
||||
,$111 { 640x480x64k }
|
||||
,$103 { 800x600x256 }
|
||||
,$113 { 800x600x32k }
|
||||
,$114 { 800x600x64k }
|
||||
,$105 { 1024x768x256 }
|
||||
,$116 { 1024x768x32k }
|
||||
,$117 { 1024x768x64k }
|
||||
,$107 { 1280x1024x256 }
|
||||
,$119 { 1280x1024x32K }
|
||||
,$11A { 1280x1024x64K }
|
||||
{$ifdef TEST_24BPP}
|
||||
,$112 { 640x480x16M }
|
||||
,$115 { 800x600x16M }
|
||||
,$118 { 1024x768x16M }
|
||||
,$11B { 1280x1024x16M }
|
||||
{$endif TEST_24BPP}
|
||||
);
|
||||
|
||||
G640x400x256 = $100;
|
||||
G640x480x256 = $101;
|
||||
G800x600x256 = $103;
|
||||
G1024x768x256 = $105;
|
||||
|
||||
G1280x1024x256 = $107; { Additional modes. }
|
||||
|
||||
G640x480x32K = $110;
|
||||
G640x480x64K = $111;
|
||||
G640x480x16M = $112;
|
||||
|
||||
G800x600x32K = $113;
|
||||
G800x600x64K = $114;
|
||||
G800x600x16M = $115;
|
||||
|
||||
G1024x768x32K = $116;
|
||||
G1024x768x64K = $117;
|
||||
G1024x768x16M = $118;
|
||||
|
||||
G1280x1024x32K = $119;
|
||||
G1280x1024x64K = $11A;
|
||||
G1280x1024x16M = $11B;
|
||||
|
||||
(* G320x200x16M32 = 33; { 32-bit per pixel modes. }
|
||||
G640x480x16M32 = 34;
|
||||
G800x600x16M32 = 35;
|
||||
G1024x768x16M32 = 36;
|
||||
G1280x1024x16M32 = 37; *)
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:38 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.5 1998/01/26 11:58:22 michael
|
||||
+ Added log at the end
|
||||
|
||||
@ -81,8 +81,8 @@ begin
|
||||
asm
|
||||
movl palette,%edi
|
||||
movw $0,(%edi)
|
||||
testw $2,_BYTESPERPIXEL
|
||||
jnz gp_end
|
||||
cmpl $2,_BYTESPERPIXEL
|
||||
jge gp_end
|
||||
movw $0x100,(%edi)
|
||||
movl $767,%ecx
|
||||
xorl %eax,%eax
|
||||
@ -102,7 +102,16 @@ gp_end:
|
||||
end;
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-07-18 21:29:59 carl
|
||||
Revision 1.3 1998-11-18 09:31:39 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.2 1998/07/18 21:29:59 carl
|
||||
* bugfix of palette setting with wrong asm counter
|
||||
(from Ingemar Ragnemalm)
|
||||
|
||||
|
||||
@ -12,7 +12,8 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
procedure putpixel(x,y:integer;colour:longint);
|
||||
{ internal put pixel with colour in internal format }
|
||||
procedure putpixeli(x,y:integer;colour:longint);
|
||||
var viewport:viewporttype;
|
||||
begin
|
||||
if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
|
||||
@ -44,34 +45,60 @@ if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
|
||||
movl _Y_ARRAY(,%eax,4),%eax
|
||||
addl _X_ARRAY(,%ebx,4),%eax
|
||||
movl %eax,%esi
|
||||
movl _WINSHIFT,%ecx // { offset / winsize }
|
||||
movzbl _WINSHIFT,%ecx // { offset / winsize }
|
||||
shrl %cl,%eax //
|
||||
cmpl _AW_BANK,%eax // { same bank ? }
|
||||
cmpl _A_BANK,%eax // { same bank ? }
|
||||
je p_dont_switch // { yep }
|
||||
movl %eax,_AW_BANK // { newbank }
|
||||
pushl %esi
|
||||
pushl %eax //
|
||||
movl _BANKSWITCHPTR,%eax // { switchbank }
|
||||
call %eax //
|
||||
popl %esi
|
||||
p_dont_switch:
|
||||
andl _WINLOMASK,%esi
|
||||
movl colour,%eax
|
||||
addl _WBUFFER,%esi
|
||||
movw _SEG_WRITE,%bx
|
||||
movw _BYTESPERPIXEL,%cx
|
||||
movw %ds,%dx
|
||||
movw %bx,%ds
|
||||
testl $1,%ecx
|
||||
jz pp_2BPP
|
||||
movb %al,(%esi)
|
||||
jnz pp_exit
|
||||
pp_2BPP:
|
||||
movw %ax,(%esi)
|
||||
movw %bx,%gs
|
||||
cmpl $2,%ecx
|
||||
je pp_16BPP
|
||||
jb pp_8BPP
|
||||
{$ifdef TEST_24BPP}
|
||||
cmpl $3,%ecx
|
||||
je pp_24BPP
|
||||
pp_32BPP:
|
||||
movl %eax,%gs:(%esi)
|
||||
jmp pp_exit
|
||||
pp_24BPP:
|
||||
movl _WINLOMASKMINUSPIXELSIZE,%edi
|
||||
cmpl %edi,%esi
|
||||
ja pp_exit
|
||||
movl %gs:(%esi),%edi
|
||||
andl $0xFF000000,%edi
|
||||
andl $0x00FFFFFF,%eax
|
||||
orl %edi,%eax
|
||||
movl %eax,%gs:(%esi)
|
||||
jmp pp_exit
|
||||
{$endif TEST_24BPP}
|
||||
pp_8BPP:
|
||||
movb %al,%gs:(%esi)
|
||||
jmp pp_exit
|
||||
pp_16BPP:
|
||||
movw %ax,%gs:(%esi)
|
||||
pp_exit:
|
||||
movw %dx,%ds
|
||||
(* movw %dx,%ds use %gs now
|
||||
does not need to be kept constant PM *)
|
||||
p_exit:
|
||||
end;
|
||||
end; { proc }
|
||||
|
||||
procedure putpixel(x,y:integer;colour:longint);
|
||||
begin
|
||||
colour:=convert(colour);
|
||||
putpixeli(x,y,colour);
|
||||
end;
|
||||
|
||||
procedure pixel(offset:longint);
|
||||
{ wird nur intern aufgerufen, umrechnung auf Viewport und Range- }
|
||||
{ checking muessen von aufrufender Routine bereits erledigt sein }
|
||||
@ -80,14 +107,15 @@ procedure pixel(offset:longint);
|
||||
asm
|
||||
movl offset,%eax
|
||||
movl %eax,%esi
|
||||
movl _WINSHIFT,%ecx // { offset / winsize }
|
||||
movzbl _WINSHIFT,%ecx // { offset / winsize }
|
||||
shrl %cl,%eax //
|
||||
cmpl _AW_BANK,%eax // { same bank ? }
|
||||
cmpl _A_BANK,%eax // { same bank ? }
|
||||
je dont_switch // { yep }
|
||||
movl %eax,_AW_BANK // { newbank }
|
||||
pushl %esi
|
||||
pushl %eax //
|
||||
movl _BANKSWITCHPTR,%eax // { switchbank }
|
||||
call %eax //
|
||||
popl %esi
|
||||
dont_switch:
|
||||
movl _WINLOMASK,%eax
|
||||
andl %eax,%esi
|
||||
@ -96,31 +124,71 @@ procedure pixel(offset:longint);
|
||||
movw _BYTESPERPIXEL,%bx
|
||||
addl _WBUFFER,%esi
|
||||
movw _SEG_WRITE,%dx
|
||||
movw %ds,%di
|
||||
movw %dx,%ds
|
||||
movw %dx,%gs
|
||||
testl %ecx,%ecx
|
||||
jz dmove
|
||||
shrl %ebx
|
||||
jnc dxor2BPP
|
||||
xorb %al,(%esi)
|
||||
jnc pd_exit
|
||||
dxor2BPP:
|
||||
xorw %ax,(%esi)
|
||||
jnc pd_exit
|
||||
cmpl $2,%ebx
|
||||
je dxor16BPP
|
||||
jb dxor8BPP
|
||||
{$ifdef TEST_24BPP}
|
||||
cmpl $3,%ebx
|
||||
je dxor24BPP
|
||||
dxor32BPP:
|
||||
movl %gs:(%esi),%edx
|
||||
andl $0x00FFFFFF,%eax
|
||||
xorl %edx,%eax
|
||||
movl %eax,%gs:(%esi)
|
||||
jmp pd_exit
|
||||
dxor24BPP:
|
||||
movl _WINLOMASKMINUSPIXELSIZE,%ecx
|
||||
cmpl %ecx,%esi
|
||||
ja pd_exit
|
||||
movl %gs:(%esi),%edx
|
||||
andl $0x00FFFFFF,%eax
|
||||
xorl %edx,%eax
|
||||
movl %eax,%gs:(%esi)
|
||||
jmp pd_exit
|
||||
{$endif TEST_24BPP}
|
||||
dxor8BPP:
|
||||
xorb %al,%gs:(%esi)
|
||||
jmp pd_exit
|
||||
dxor16BPP:
|
||||
xorw %ax,%gs:(%esi)
|
||||
jmp pd_exit
|
||||
dmove:
|
||||
shrl %ebx
|
||||
jnc dmove2BPP
|
||||
movb %al,(%esi)
|
||||
jc pd_exit
|
||||
dmove2BPP:
|
||||
movw %ax,(%esi)
|
||||
cmpl $2,%ebx
|
||||
je dmove16BPP
|
||||
jb dmove8BPP
|
||||
{$ifdef TEST_24BPP}
|
||||
cmpl $3,%ebx
|
||||
je dmove24BPP
|
||||
dmove32BPP:
|
||||
andl $0x00FFFFFF,%eax
|
||||
movl %eax,%gs:(%esi)
|
||||
jmp pd_exit
|
||||
dmove24BPP:
|
||||
movl _WINLOMASKMINUSPIXELSIZE,%ecx
|
||||
cmpl %ecx,%esi
|
||||
ja pd_exit
|
||||
movl %gs:(%esi),%edx
|
||||
andl $0xFF000000,%edx
|
||||
andl $0x00FFFFFF,%eax
|
||||
orl %edx,%eax
|
||||
movl %eax,%gs:(%esi)
|
||||
jmp pd_exit
|
||||
{$endif TEST_24BPP}
|
||||
dmove8BPP:
|
||||
movb %al,%gs:(%esi)
|
||||
jmp pd_exit
|
||||
dmove16BPP:
|
||||
movw %ax,%gs:(%esi)
|
||||
pd_exit:
|
||||
movw %di,%ds
|
||||
end;
|
||||
end; { proc }
|
||||
|
||||
function getpixel(x,y:integer):longint;
|
||||
var viewport:viewporttype;
|
||||
col : longint;
|
||||
begin
|
||||
if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
|
||||
asm
|
||||
@ -140,22 +208,21 @@ if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
|
||||
that depends on alignment settings !! PM *)
|
||||
lea viewport,%edx
|
||||
cmpw (%edx),%bx
|
||||
jl gp_exit // wenn x < x1 Ende
|
||||
jl gp_eexit // wenn x < x1 Ende
|
||||
cmpw 4(%edx),%bx
|
||||
jg gp_exit // wenn x > x2 Ende
|
||||
jg gp_eexit // wenn x > x2 Ende
|
||||
cmpw 2(%edx),%ax
|
||||
jl gp_exit // wenn y < y1 Ende
|
||||
jl gp_eexit // wenn y < y1 Ende
|
||||
cmpw 6(%edx),%ax
|
||||
jg gp_exit // wenn y > y2 Ende
|
||||
jg gp_eexit // wenn y > y2 Ende
|
||||
movl _Y_ARRAY(,%eax,4),%eax
|
||||
addl _X_ARRAY(,%ebx,4),%eax
|
||||
movl %eax,%esi
|
||||
movl _WINSHIFT,%ecx // { offset / winsize }
|
||||
movzbl _WINSHIFT,%ecx // { offset / winsize }
|
||||
shrl %cl,%eax //
|
||||
cmpl _AW_BANK,%eax // { same bank ? }
|
||||
cmpl _A_BANK,%eax // { same bank ? }
|
||||
je g_dont_switch // { yep }
|
||||
pushl %esi // { save Offset }
|
||||
movl %eax,_AW_BANK // { newbank }
|
||||
pushl %eax //
|
||||
movl _BANKSWITCHPTR,%eax // { switchbank }
|
||||
call %eax //
|
||||
@ -164,28 +231,69 @@ if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
|
||||
movl _WINLOMASK,%eax
|
||||
andl %eax,%esi
|
||||
xorl %eax,%eax
|
||||
movl _BYTESPERPIXEL,%edx
|
||||
movzwl _BYTESPERPIXEL,%edx
|
||||
addl _WBUFFER,%esi
|
||||
movw _SEG_WRITE,%bx
|
||||
movw %ds,%cx
|
||||
movw %bx,%ds
|
||||
testl $1,%edx // { 1 or 2 BytesPerPixel ? }
|
||||
jnz g_8BPP
|
||||
movw %ds:(%esi),%ax
|
||||
jnz g_Result
|
||||
movw _SEG_READ,%bx
|
||||
movw %bx,%gs
|
||||
cmpl $2,%edx // { 1 or 2 BytesPerPixel ? }
|
||||
je g_16BPP
|
||||
jb g_8BPP
|
||||
{$ifdef TEST_24BPP}
|
||||
cmpl $3,%edx // { 1 or 2 BytesPerPixel ? }
|
||||
je g_24BPP
|
||||
g_32BPP:
|
||||
movl %gs:(%esi),%eax
|
||||
andl $0x00FFFFFF,%eax
|
||||
jmp g_Result
|
||||
g_24BPP:
|
||||
movl _WINLOMASKMINUSPIXELSIZE,%edi
|
||||
cmpl %edi,%esi
|
||||
ja g_ErrorResult
|
||||
movl %gs:(%esi),%eax
|
||||
andl $0x00FFFFFF,%eax
|
||||
jmp g_Result
|
||||
g_ErrorResult:
|
||||
movl $-3,%edi
|
||||
addl _WINLOMASK,%edi
|
||||
cmpl %edi,%esi
|
||||
ja g_nohope
|
||||
decl %esi
|
||||
movl %gs:(%esi),%eax
|
||||
shrl $8,%eax
|
||||
jmp g_Result
|
||||
g_nohope:
|
||||
movl $0xABCDEF,%eax
|
||||
jmp g_Result
|
||||
{$endif TEST_24BPP}
|
||||
g_16BPP:
|
||||
movw %gs:(%esi),%ax
|
||||
jmp g_Result
|
||||
g_8BPP:
|
||||
movb %ds:(%esi),%al
|
||||
movb %gs:(%esi),%al
|
||||
jmp g_Result
|
||||
gp_eexit:
|
||||
xorl %eax,%eax
|
||||
jmp gp_exit
|
||||
g_Result:
|
||||
movw %cx,%ds
|
||||
movl %eax,__RESULT
|
||||
gp_exit:
|
||||
movl %eax,col
|
||||
end;
|
||||
getpixel:=unconvert(col);
|
||||
end; { proc }
|
||||
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 1998-10-22 08:22:06 pierre
|
||||
Revision 1.3 1998-11-18 09:31:40 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.2 1998/10/22 08:22:06 pierre
|
||||
* mandel problem fixed !!
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
|
||||
@ -78,10 +78,20 @@ $F42C4040,$F52C3C40,$F62C3440,$F72C3040,
|
||||
$F8000000,$F9000000,$FA000000,$FB000000,
|
||||
$FC000000,$FD000000,$FE000000,$FF000000
|
||||
);
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:41 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.3 1998/01/26 11:58:38 michael
|
||||
+ Added log at the end
|
||||
|
||||
@ -253,7 +253,9 @@
|
||||
b1:=defaultfontdata[offs+j]; { Offset der Charzeile }
|
||||
xpos:=i shl 3+x;
|
||||
for k:=0 to 7 do begin
|
||||
if (b1 and mask) <> 0 then putpixel(xpos+k,j+y,aktcolor);
|
||||
if (b1 and mask) <> 0 then putpixeli(xpos+k,j+y,aktcolor)
|
||||
else if ClearText then
|
||||
putpixeli(xpos+k,j+y,aktbackcolor);
|
||||
mask:=mask shr 1;
|
||||
end;
|
||||
end;
|
||||
@ -459,8 +461,17 @@
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:42 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.3 1998/01/26 11:58:41 michael
|
||||
+ Added log at the end
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
VGAInfo.VESASignature[1],VGAInfo.VESASignature[2],VGAInfo.VESASignature[3],
|
||||
VGAInfo.VESASignature[4],VGAInfo.VESAhiVersion,'.',VGAInfo.VESAloVersion);
|
||||
writeln('Memory installed : ',VGAInfo.Totalmem * 64,'K');
|
||||
writeln;
|
||||
writeln('startmode = ',HexStr(StartMode,4));
|
||||
write('Mode $',HexStr(GraphMode,4),' : ');
|
||||
if (VESAInfo.ModeAttributes and 1)=0 then write('not '); writeln('supported');
|
||||
writeln('Resolution : ',VESAInfo.XResolution,'x',VESAInfo.YResolution);
|
||||
@ -42,25 +42,49 @@
|
||||
Writeln('OffscreenOffset : 0x',HexStr(VESAInfo.OffScreenPtr,8));
|
||||
Writeln('OffscreenMem : ',VESAInfo.OffScreenMem,'KB');
|
||||
end;
|
||||
if (VESAInfo.ModeAttributes and $200)<>0 then
|
||||
write('(VBE/AF v1.0P) application must call EnableDirectAccess '+
|
||||
'before calling bank-switching functions');
|
||||
end;
|
||||
writeln;
|
||||
writeln('BankSwitchRoutine at: ',HexStr(VESAInfo.RealWinFuncPtr,8));
|
||||
write('WindowA: read: '); if VESAInfo.WinAAttributes and 3<>0 then write('yes')else write('no ');
|
||||
write(' write: '); if VESAInfo.WinAAttributes and 7<>0 then write('yes')else write('no ');
|
||||
write('WindowA: read: '); if (VESAInfo.WinAAttributes and 3)=3 then write('yes')else write('no ');
|
||||
write(' write: '); if (VESAInfo.WinAAttributes and 5)=5 then write('yes')else write('no ');
|
||||
writeln(' Segment: ',HexStr(VESAInfo.segWinA,4));
|
||||
write('WindowB: read: '); if VESAInfo.WinBAttributes and 3<>0 then write('yes')else write('no ');
|
||||
write(' write: '); if VESAInfo.WinBAttributes and 7<>0 then write('yes')else write('no ');
|
||||
write('WindowB: read: '); if (VESAInfo.WinBAttributes and 3)=3 then write('yes')else write('no ');
|
||||
write(' write: '); if (VESAInfo.WinBAttributes and 5)=5 then write('yes')else write('no ');
|
||||
writeln(' Segment: ',HexStr(VESAInfo.segWinB,4));
|
||||
writeln('Granularity : ',VESAInfo.WinGranularity);
|
||||
writeln('WinSize : ',VESAInfo.Winsize,' KByte');
|
||||
writeln('BytesPerLine : ',BytesPerLine);
|
||||
writeln('BytesPerPixel: ',BytesPerPixel);
|
||||
if isDPMI then
|
||||
begin
|
||||
write('Write selector linear base: ',hexstr(get_segment_base_address(seg_write),8));
|
||||
writeln(' linear limit: ',hexstr(get_segment_limit(seg_write),8));
|
||||
end;
|
||||
if not same_window then
|
||||
begin
|
||||
write('Read selector linear base: ',hexstr(get_segment_base_address(seg_read),8));
|
||||
writeln(' linear limit: ',hexstr(get_segment_limit(seg_read),8));
|
||||
end;
|
||||
{$ifndef FPC_PROFILE}
|
||||
readln;
|
||||
{$endif not FPC_PROFILE}
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1998-03-25 11:18:42 root
|
||||
Initial revision
|
||||
Revision 1.2 1998-11-18 09:31:43 pierre
|
||||
* changed color scheme
|
||||
all colors are in RGB format if more than 256 colors
|
||||
+ added 24 and 32 bits per pixel mode
|
||||
(compile with -dDEBUG)
|
||||
24 bit mode with banked still as problems on pixels across
|
||||
the bank boundary, but works in LinearFrameBufferMode
|
||||
Look at install/demo/nmandel.pp
|
||||
|
||||
Revision 1.1.1.1 1998/03/25 11:18:42 root
|
||||
* Restored version
|
||||
|
||||
Revision 1.3 1998/01/26 11:58:49 michael
|
||||
+ Added log at the end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user