* optimized DirectPutPixel16 and DirectPutPixVESA16 to use the EGA/VGA hardware ALU, instead of calling slow GetPixel for XORPut, ANDPut and ORPut write modes

git-svn-id: trunk@15965 -
This commit is contained in:
nickysn 2010-09-10 21:19:01 +00:00
parent 2ee1718e35
commit fd70748267
2 changed files with 41 additions and 50 deletions

View File

@ -1944,31 +1944,22 @@ End;
dummy: byte; dummy: byte;
{$endif asmgraph} {$endif asmgraph}
begin begin
If CurrentWriteMode <> NotPut Then
Color := CurrentColor
else Color := not CurrentColor;
case CurrentWriteMode of case CurrentWriteMode of
XORPut: XORPut:
begin PortW[$3ce]:=((3 shl 3) shl 8) or 3;
{ getpixel wants local/relative coordinates } ANDPut:
Color := GetPixel(x-StartXViewPort,y-StartYViewPort); PortW[$3ce]:=((1 shl 3) shl 8) or 3;
Color := CurrentColor Xor Color; ORPut:
end; PortW[$3ce]:=((2 shl 3) shl 8) or 3;
OrPut: {not needed, this is the default state (e.g. PutPixel16 requires it)}
begin {NormalPut, NotPut:
{ getpixel wants local/relative coordinates } PortW[$3ce]:=$0003
Color := GetPixel(x-StartXViewPort,y-StartYViewPort); else
Color := CurrentColor Or Color; PortW[$3ce]:=$0003}
end;
AndPut:
begin
{ getpixel wants local/relative coordinates }
Color := GetPixel(x-StartXViewPort,y-StartYViewPort);
Color := CurrentColor And Color;
end;
NotPut:
begin
Color := (Not CurrentColor) and 15;
end
else
Color := CurrentColor;
end; end;
{$ifndef asmgraph} {$ifndef asmgraph}
offset := Y * 80 + (X shr 3) + VideoOfs; offset := Y * 80 + (X shr 3) + VideoOfs;
@ -1979,6 +1970,10 @@ End;
Mem[Sega000: offset] := dummy; Mem[Sega000: offset] := dummy;
PortW[$3ce] := $ff08; PortW[$3ce] := $ff08;
PortW[$3ce] := $0001; PortW[$3ce] := $0001;
if (CurrentWriteMode = XORPut) or
(CurrentWriteMode = ANDPut) or
(CurrentWriteMode = ORPut) then
PortW[$3ce] := $0003;
{$else asmgraph} {$else asmgraph}
{ note: still needs xor/or/and/notput support !!!!! (JM) } { note: still needs xor/or/and/notput support !!!!! (JM) }
asm asm

View File

@ -1550,32 +1550,24 @@ end;
dummy : byte; dummy : byte;
Color : word; Color : word;
begin begin
case CurrentWriteMode of If CurrentWriteMode <> NotPut Then
XORPut: Color := CurrentColor
begin else Color := not CurrentColor;
{ getpixel wants local/relative coordinates }
Color := GetPixVESA16(x-StartXViewPort,y-StartYViewPort); case CurrentWriteMode of
Color := CurrentColor Xor Color; XORPut:
end; PortW[$3ce]:=((3 shl 3) shl 8) or 3;
OrPut: ANDPut:
begin PortW[$3ce]:=((1 shl 3) shl 8) or 3;
{ getpixel wants local/relative coordinates } ORPut:
Color := GetPixVESA16(x-StartXViewPort,y-StartYViewPort); PortW[$3ce]:=((2 shl 3) shl 8) or 3;
Color := CurrentColor Or Color; {not needed, this is the default state (e.g. PutPixel16 requires it)}
end; {NormalPut, NotPut:
AndPut: PortW[$3ce]:=$0003
begin else
{ getpixel wants local/relative coordinates } PortW[$3ce]:=$0003}
Color := GetPixVESA16(x-StartXViewPort,y-StartYViewPort); end;
Color := CurrentColor And Color;
end;
NotPut:
begin
Color := Not Color;
end
else
Color := CurrentColor;
end;
Y := Y + YOffset; Y := Y + YOffset;
offs := longint(y) * BytesPerLine + (x div 8); offs := longint(y) * BytesPerLine + (x div 8);
SetReadBank(smallint(offs shr 16)); SetReadBank(smallint(offs shr 16));
@ -1590,6 +1582,10 @@ end;
Mem[WinWriteSeg: word(offs)] := dummy; { Write the data into video memory } Mem[WinWriteSeg: word(offs)] := dummy; { Write the data into video memory }
PortW[$3ce] := $ff08; { Enable all bit planes. } PortW[$3ce] := $ff08; { Enable all bit planes. }
PortW[$3ce] := $0001; { Index 01 : Disable ops on all four planes. } PortW[$3ce] := $0001; { Index 01 : Disable ops on all four planes. }
if (CurrentWriteMode = XORPut) or
(CurrentWriteMode = ANDPut) or
(CurrentWriteMode = ORPut) then
PortW[$3ce] := $0003;
end; end;