* rtl-console: slight refactor of how Amiga SysUpdateScreen() addresses the videobuf. this results in slightly more optimal code with less complex addressing, which helps low-end processors

This commit is contained in:
Karoly Balogh 2021-12-25 13:17:34 +01:00
parent 5264e48d90
commit cc7c328a7c

View File

@ -564,19 +564,20 @@ end;
procedure SysUpdateScreen(Force: Boolean); procedure SysUpdateScreen(Force: Boolean);
var var
BufCounter: Longint;
SmallForce: Boolean; SmallForce: Boolean;
Counter, CounterX, CounterY: LongInt; Counter, CounterX, CounterY: LongInt;
NumChanged: Integer;
LocalRP: PRastPort; LocalRP: PRastPort;
sY, sX: LongInt; sY, sX: LongInt;
TmpCharData: Word; TmpCharData: Word;
{$ifdef VideoSpeedTest} {$ifdef VideoSpeedTest}
NumChanged: Integer;
t,ta: Double; t,ta: Double;
{$endif} {$endif}
VBuf,OldVBuf: PWord;
begin begin
{$ifdef VideoSpeedTest} {$ifdef VideoSpeedTest}
ta := now(); ta := now();
NumChanged := 0;
{$endif} {$endif}
SmallForce := False; SmallForce := False;
@ -621,12 +622,10 @@ begin
LocalRP := BufRp; LocalRP := BufRp;
{$endif} {$endif}
BufCounter:=0;
NumChanged:=0;
if Smallforce then if Smallforce then
begin begin
VBuf:=@VideoBuf^[0];
OldVBuf:=@OldVideoBuf^[0];
{$ifdef VideoSpeedTest} {$ifdef VideoSpeedTest}
t := now(); t := now();
{$endif} {$endif}
@ -636,15 +635,17 @@ begin
sX := videoWindow^.borderLeft; sX := videoWindow^.borderLeft;
for CounterX := 0 to ScreenWidth - 1 do for CounterX := 0 to ScreenWidth - 1 do
begin begin
if (VideoBuf^[BufCounter] <> OldVideoBuf^[BufCounter]) or Force then if (VBuf^ <> OldVBuf^) or Force then
begin begin
TmpCharData := VideoBuf^[BufCounter]; SetABPenDrMd(LocalRP, VideoPens[(VBuf^ shr 8) and %00001111], VideoPens[(VBuf^ shr 12) and %00000111], JAM2);
SetABPenDrMd(LocalRP, VideoPens[(TmpCharData shr 8) and %00001111], VideoPens[(TmpCharData shr 12) and %00000111], JAM2); BltTemplate(CharPointers[VBuf^ and $FF], 0, SrcMod, LocalRP, sX, sY, 8, VideoFontHeight);
BltTemplate(CharPointers[TmpCharData and $FF], 0, SrcMod, LocalRP, sX, sY, 8, VideoFontHeight); OldVBuf^:=VBuf^;
OldVideoBuf^[BufCounter] := VideoBuf^[BufCounter]; {$ifdef VideoSpeedTest}
Inc(NumChanged); Inc(NumChanged);
{$endif}
end; end;
Inc(BufCounter); Inc(VBuf);
Inc(OldVBuf);
sX := sX + 8; sX := sX + 8;
end; end;
sY := sY + VideoFontHeight; sY := sY + VideoFontHeight;