* optimizations in SetVisualX and SetActiveX by using a table, instead of a case statement

git-svn-id: trunk@41146 -
This commit is contained in:
nickysn 2019-01-30 15:49:00 +00:00
parent dd2fc17d51
commit e348fada6c

View File

@ -2384,7 +2384,9 @@ End;
{************************************************************************} {************************************************************************}
{* Mode-X related routines *} {* Mode-X related routines *}
{************************************************************************} {************************************************************************}
const CrtAddress: word = 0; const
CrtAddress: word = 0;
ModeXVideoPageStart: array [0..3] of longint = (0,16000,32000,48000);
procedure InitModeX; procedure InitModeX;
begin begin
@ -2511,7 +2513,7 @@ const CrtAddress: word = 0;
end; end;
procedure SetVisualX(page: word); procedure SetVisualX(page: word);
{ 4 page supPort... } { 4 page support... }
Procedure SetVisibleStart(AOffset: word); Assembler; Procedure SetVisibleStart(AOffset: word); Assembler;
(* Select where the left corner of the screen will be *) (* Select where the left corner of the screen will be *)
@ -2564,27 +2566,19 @@ const CrtAddress: word = 0;
{$undef asmgraph} {$undef asmgraph}
begin begin
Case page of if (page >= 0) and (page <= 3) then
0: SetVisibleStart(0); SetVisibleStart(ModeXVideoPageStart[page])
1: SetVisibleStart(16000);
2: SetVisibleStart(32000);
3: SetVisibleStart(48000);
else else
SetVisibleStart(0); SetVisibleStart(0);
end;
end; end;
procedure SetActiveX(page: word); procedure SetActiveX(page: word);
{ 4 page supPort... } { 4 page support... }
begin begin
case page of if (page >= 0) and (page <= 3) then
0: VideoOfs := 0; VideoOfs := ModeXVideoPageStart[page]
1: VideoOfs := 16000; else
2: VideoOfs := 32000; VideoOfs := 0;
3: VideoOfs := 48000;
else
VideoOfs:=0;
end;
end; end;
Procedure PutPixelX(X,Y: smallint; color:word); Procedure PutPixelX(X,Y: smallint; color:word);