home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hráč 1997 February
/
Hrac_09_1997-02_cd.bin
/
UTILS
/
PROGRAM
/
1SVGA.ZIP
/
SHOW.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-05-18
|
11KB
|
278 lines
{┌────────────────────────────────────╖
│ VGA Show V1.1 /320x200,256 Colors ║
│ Written by Jou-Nan Chen 1994-05-16 ║
│ Copyright (C) 1994 by Jou-Nan Chen ║
╘════════════════════════════════════╝}
{$M 20000,0,655360}
uses Dos,Show320,SVGA256,Txt;
{ Text,Select,Messege,Box,Title,Show, WinText,Box,Title, HelpText,Box,Title }
const
C1:array[1..12] of byte=($1E,$DF,$F5,$1F,$F1,$18, $2E,$2A,$A5, $3E,$3B,$B5);
C2:array[1..12] of byte=($F0,$DF,$1F,$F1,$1F,$F8, $80,$81,$1F, $DF,$D4,$4F);
Delays:array[0..47] of byte=(
25,20,20,05,05, 12,08,05,08,15, 08,05,05,05,05,
08,03,03,08,08, 10,10,10,10,08, 05,08,03,04,04,
04,04,03,02,02, 03,70,50,50,70, 15,03,06,04,04, 06,12,12);
ShowType:integer=0; No:integer=0;
Page:integer=0; PageSize:integer=85;
var Filenames:array[0..4095] of string[12];
K,Max,PageMax:integer;
Font1:array[0..4095] of byte;
Co:array[1..12] of byte;
{ ─────────────── GetFilenames ─────────────── }
procedure GetFilenames(Path:string);
var DirInfo:SearchRec;
begin
Max:=0; FillChar(Filenames,26624,32);
FindFirst(Path,Archive,DirInfo);
while DosError=0 do begin
FileNames[Max]:=DirInfo.Name;
FileNames[Max,0]:=#12;
FindNext(DirInfo); Inc(Max);
end;
if Max=0 then begin
Writeln; Writeln('Sorry! Can''t find any file!');
Halt(1);
end;
Dec(Max);
end;
{ ─────────────── SortFilenames ─────────────── }
procedure SortFilenames(L,R:integer);
var I,J:integer;
M,T:string[12];
begin
I:=L; J:=R; M:=Filenames[(L+R) shr 1];
repeat
while Filenames[I]<M do Inc(I); { Move right }
while M<Filenames[J] do Dec(J); { Move left }
if I<=J then begin
T:=Filenames[I]; Filenames[I]:=Filenames[J]; Filenames[J]:=T;
Inc(I); Dec(J);
end;
until I>J;
if L<J then SortFilenames(L,J);
if I<R then SortFilenames(I,R);
end;
{ ─────────────── TextWin2 ─────────────── }
procedure TextWin2(X,Y,LenX,LenY,CBox,CTitle,Shadow:integer;Title:string);
var I:integer; { Shadow: 1=With, 0=No }
begin
TextBar(X,Y,LenX,1,CTitle,' ');
PrintText(X+(LenX-Length(Title)) shr 1,Y,CTitle,Title);
TextBar(X,Y+1,1,LenY-2,CBox,'╫');
TextBar(X+LenX-1,Y+1,1,LenY-2,CBox,'╪');
PrintText(X,Y+LenY-1,CBox,'╤');
TextBar(X+1,Y+LenY-1,LenX-2,1,CBox,'╟');
PrintText(X+LenX-1,Y+LenY-1,CBox,'╥');
TextBar(X+1,Y+1,LenX-2,LenY-2,CBox,' ');
if Shadow=1 then TextShadow(X,Y,LenX,LenY);
for I:=0 to 1 do begin
PrintText(X+I,Y,CBox,Chr(193+I));
PrintText(X+I+LenX-2,Y,CBox,Chr(202+I));
end;
end;
{ ─────────────── PrintNum ─────────────── }
procedure PrintNum(X,Y,Color,Num:byte);
var I,N:integer;
begin
N:=100;
for I:=0 to 2 do begin
PrintText(X+I,Y,Color,Chr(128+Num div N mod 10));
N:=N div 10;
end;
end;
{ ─────────────── ShowPic ─────────────── }
procedure ShowPic(Ty,X,Y,LenX,LenY:integer);
var S,O,D:integer;
Pic:pointer;
begin
GetMem(Pic,64768);
FileRead(Filenames[PageSize*Page+No],0,FileLen(Filenames[PageSize*Page+No],1),1,Pic^);
S:=Seg(Pic^); O:=Ofs(Pic^); D:=Delays[Ty];
SetMode(1); SetPalette(0,256,Mem[S:O]); Inc(O,768);
case Ty of
0:ShowBar (X,Y,LenX,LenY,D,Mem[S:O]);
1:ShowBox (1,X,Y,LenX,LenY,D,Mem[S:O]);
2:ShowBox (2,X,Y,LenX,LenY,D,Mem[S:O]);
3:ShowCircle(1,X,Y,LenX,LenY,188,D,Mem[S:O]);
4:ShowCircle(2,X,Y,LenX,LenY,188,D,Mem[S:O]);
5:ShowCell (X,Y,LenX,LenY,8,8,D,Mem[S:O]);
6:ShowClkRnd(X,Y,LenX,LenY,D,Mem[S:O]);
7:ShowClock (X,Y,LenX,LenY,D,Mem[S:O]);
8:ShowClock2(X,Y,LenX,LenY,D,Mem[S:O]);
9:ShowColor (1,X,Y,LenX,LenY,0,256,D,Mem[S:O]);
10:ShowDot (X,Y,LenX,LenY,D,Mem[S:O]);
11:ShowFall (1,X,Y,LenX,LenY,10,D,Mem[S:O]);
12:ShowFall (2,X,Y,LenX,LenY,16,D,Mem[S:O]);
13:ShowFall (3,X,Y,LenX,LenY,16,D,Mem[S:O]);
14:ShowFall (4,X,Y,LenX,LenY,10,D,Mem[S:O]);
15:ShowFlow (1,X,Y,LenX,LenY,2,D,Mem[S:O]);
16:ShowFlow (2,X,Y,LenX,LenY,2,D,Mem[S:O]);
17:ShowFlow (3,X,Y,LenX,LenY,2,D,Mem[S:O]);
18:ShowFlow (4,X,Y,LenX,LenY,2,D,Mem[S:O]);
19:ShowIn (X,Y,LenX,LenY,2,D,Mem[S:O]);
20:ShowJam (1,X,Y,LenX,LenY,10,D,Mem[S:O]);
21:ShowJam (2,X,Y,LenX,LenY,16,D,Mem[S:O]);
22:ShowJam (3,X,Y,LenX,LenY,16,D,Mem[S:O]);
23:ShowJam (4,X,Y,LenX,LenY,10,D,Mem[S:O]);
24:ShowLine (1,X,Y,LenX,LenY,D,Mem[S:O]);
25:ShowLine (2,X,Y,LenX,LenY,D,Mem[S:O]);
26:ShowMove (1,X,Y,LenX,LenY,2,D,Mem[S:O]);
27:ShowMove (2,X,Y,LenX,LenY,4,D,Mem[S:O]);
28:ShowScroll(1,X,Y,LenX,LenY,4,D,Mem[S:O]);
29:ShowScroll(2,X,Y,LenX,LenY,5,D,Mem[S:O]);
30:ShowScroll(3,X,Y,LenX,LenY,5,D,Mem[S:O]);
31:ShowScroll(4,X,Y,LenX,LenY,4,D,Mem[S:O]);
32:ShowShadow(X,Y,LenX,LenY,199,D,Mem[S:O]);
33:ShowShadow(X,Y,LenX,LenY,211,D,Mem[S:O]);
34:ShowShadow(X,Y,LenX,LenY,307,D,Mem[S:O]);
35:ShowSlope (X,Y,LenX,LenY,D,Mem[S:O]);
36:ShowSplit (1,X,Y,LenX,LenY,10,D,Mem[S:O]);
37:ShowSplit (2,X,Y,LenX,LenY,10,D,Mem[S:O]);
38:ShowSplit (3,X,Y,LenX,LenY,10,D,Mem[S:O]);
39:ShowSplit (4,X,Y,LenX,LenY,10,D,Mem[S:O]);
40:ShowZoom (X,Y,LenX,LenY,2,D,Mem[S:O]);
41:ShowZoom2 (X,Y,LenX,LenY,2,D,Mem[S:O]);
42:ShowZoom4 (1,X,Y,LenX,LenY,4,D,Mem[S:O]);
43:ShowZoom4 (2,X,Y,LenX,LenY,5,D,Mem[S:O]);
44:ShowZoom4 (3,X,Y,LenX,LenY,5,D,Mem[S:O]);
45:ShowZoom4 (4,X,Y,LenX,LenY,4,D,Mem[S:O]);
46:ShowZoomXY(1,X,Y,LenX,LenY,2,D,Mem[S:O]);
47:ShowZoomXY(2,X,Y,LenX,LenY,4,D,Mem[S:O]);
end;
FreeMem(Pic,64768);
end;
{ ─────────────── Help ─────────────── }
procedure Help(X,Y:integer); { 40x11 }
var Buf:array[0..3999] of byte;
begin
GetText(X,Y,41,12,Buf);
TextWin2(X,Y,40,11,Co[11],Co[12],1,'Help');
PrintText(X+3,Y+2,Co[10],'1,2 ── Change colors');
PrintText(X+3,Y+3,Co[10],'Cursors,Enter ── Select');
PrintText(X+3,Y+4,Co[10],'+,-,*,/ ── Delay');
PrintText(X+3,Y+5,Co[10],'Esc ── Exit');
PrintText(X+3,Y+7,Co[10],'VGA Show V1.1 /320x200,256 Colors');
PrintText(X+3,Y+8,Co[10],'Copyright (C) 1994 by Jou-Nan Chen');
K:=Key; K:=0;
PutText(X,Y,41,12,Buf);
end;
{ ─────────────── TextProc ─────────────── }
procedure TextProc;
begin
SetMode(0);
SetTextFont(16,0,256,Font1);
SetCurShape($20,0);
SetFlash(0);
end;
{ ─────────────── Screen ─────────────── }
procedure Screen;
const C:array[0..16] of byte=(
0,1,16,17,12,33,6,7, 11,25,26,27,44,37,54,63, 0);
begin
SetPalette17(C);
TextWin2(1,1,80,25,Co[4],Co[5],0,'VGA Show Version 1.1');
TextBar(2,2,78,23,Co[1],' ');
TextBox(2,3,78,22,Co[4],1);
PrintText(8,2,Co[6],' ▄▄▄▄ ▄ ▄▄▄▄▄▄ ▄ ');
PrintText(8,3,Co[6],' ▀▄ █▄▄▄█ █ █ █ ▄ █ ');
PrintText(8,4,Co[6],'▄▄▄▀ █ █▄█▄▄▄▀ █▀ ▀█ ');
PrintText(35,4,Co[4],'F1-Help');
end;
{ ─────────────── ShowPage ─────────────── }
procedure ShowPage(PageNo:integer); { 5x17 }
var I:integer;
begin
PageMax:=PageSize-1;
if (Max<PageSize-1) or (Page=Max div PageSize) then PageMax:=Max mod PageSize;
TextBar(4,8,74,15,Co[1],' ');
for I:=0 to PageMax do
PrintText(5+15*(I mod 5),6+I div 5,Co[1],Filenames[PageSize*PageNo+I]);
end;
{ ─────────────── SelectType ─────────────── }
procedure SelectType(X,Y:integer); { 58x17 }
const St:array[0..47] of string[11]=(
'Bars 16->1 ','Outside ','Inside ','Circle Out ',
'Circle In ','Rnd Cells ','Clock Rnd ','Clock Line ',
'Clock 2Line','Color Shade','Random Dots','Fall Up ',
'Fall Left ','Fall Right ','Fall Down ','Flow Up ',
'Flow Left ','Flow Right ','Flow Down ','In 4 Parts ',
'Jam Up ','Jam Left ','Jam Right ','Jam Down ',
'Lines U-D ','Lines L-R ','Move U-D ','Move L-R ',
'Scroll Up ','Scroll Left','Scroll Rght','Scroll Down',
'Shadow Smal','Shadow Mid ','Shadow Big ','Lines Slope',
'Split Up ','Split Left ','Split Rght ','Split Down ',
'Zoom Out ','Zoom In ','Zoom Up ','Zoom Left ',
'Zoom Right ','Zoom Down ','Zoom U-D ','Zoom L-R ');
var I:integer;
Buf:array[0..3999] of byte;
begin
GetText(X,Y,59,17,Buf);
TextWin2(X,Y,58,16,Co[8],Co[9],1,' Show Type ');
PrintText(X+3,Y,Co[9],' Delay ');
for I:=0 to 47 do PrintText(X+4+13*(I and 3),Y+2+I shr 2,Co[7],St[I]);
repeat
PrintNum(X+10,Y,Co[9],Delays[ShowType]);
PrintText(X+3+13*(ShowType and 3),Y+2+ShowType shr 2,Co[2],' '+St[ShowType]+' ');
K:=Key;
PrintText(X+3+13*(ShowType and 3),Y+2+ShowType shr 2,Co[7],' '+St[ShowType]+' ');
case K of
$4B00:Dec(ShowType); $4D00:Inc(ShowType); { Left,Right }
$4800:Dec(ShowType,4); $5000:Inc(ShowType,4); { Up,Down }
$4700:ShowType:=0; $4F00:ShowType:=47; { Home,End }
$4900:Dec(ShowType,16); $5100:Inc(ShowType,16); { PgUp,PgDn }
$4A2D:Dec(Delays[ShowType]); { Right - }
$4E2B:Inc(Delays[ShowType]); { Right + }
$352F:Dec(Delays[ShowType],10); { Right / }
$372A:Inc(Delays[ShowType],10); { Right * }
$3B00:Help(20,8); { F1 }
end;
if Delays[ShowType]<0 then Delays[ShowType]:=0;
if Delays[ShowType]>250 then Delays[ShowType]:=250;
if ShowType<0 then ShowType:=47;
if ShowType>47 then ShowType:=0;
until (K=$011B) or (K=$1C0D); { Esc,Enter }
PutText(X,Y,59,17,Buf);
end;
{ ─────────────── SelectFile ─────────────── }
procedure SelectFile;
begin
TextProc; Screen; ShowPage(0);
repeat
PrintText(4+15*(No mod 5),6+No div 5,Co[2],' '+Filenames[PageSize*Page+No]+' ');
K:=Key;
PrintText(4+15*(No mod 5),6+No div 5,Co[1],' '+Filenames[PageSize*Page+No]+' ');
case K of
$4B00:Dec(No); $4D00:Inc(No); { Left,Right }
$4800:Dec(No,5); $5000:Inc(No,5); { Up,Down }
$4700:No:=0; $4F00:No:=PageMax; { Home,End }
$4900:if Page>0 then begin Dec(Page); ShowPage(Page); end;
$5100:if Page<Max div PageSize then begin Inc(Page); ShowPage(Page); end;
$1C0D:begin
SelectType(11,6);
if K=$1C0D then begin
ShowPic(ShowType,0,0,320,200);
K:=Key;
TextProc; Screen; ShowPage(Page);
Inc(ShowType); if ShowType>47 then ShowType:=0;
end;
K:=0;
end;
$3B00:Help(20,8); { F1 }
$0231:begin Move(C1,Co,12); Screen; ShowPage(Page); end; { 1 }
$0332:begin Move(C2,Co,12); Screen; ShowPage(Page); end; { 2 }
end;
if No<0 then No:=PageMax;
if No>PageMax then No:=0;
until K=$011B; { Esc }
SetMode(0);
end;
begin
FileRead('0916rom.fnt',0,256,16,Font1);
GetFilenames('*.*'); SortFilenames(0,Max);
Move(C1,Co,12); SelectFile;
end.