home *** CD-ROM | disk | FTP | other *** search
- PROGRAM Display;
- { Displays picture files.
- DISPLAY filename [mode] [/BW] }
- USES Crt,Dos;
- VAR Param,Mode : String;
-
- PROCEDURE Bright(Switch : Boolean);
- VAR Reg : Registers;
- BEGIN
- WITH Reg DO
- BEGIN
- If Switch then BL := 0 else BL := 1;
- AX := $1003;
- END;
- Intr($10,Reg);
- END;
-
- PROCEDURE HideCursor;
- VAR Reg : Registers;
- BEGIN
- WITH Reg DO
- BEGIN
- ch := 7;
- cl := 1;
- ah := 1;
- Intr($10,Reg);
- END;
- END;
-
- PROCEDURE UnHideCursor;
- VAR Reg : Registers;
- BEGIN
- WITH Reg DO
- BEGIN
- ch := 6;
- cl := 7;
- ah := 1;
- Intr($10,Reg);
- END;
- END;
-
- PROCEDURE BumpStrup(VAR s : String);
- VAR i : Byte;
- BEGIN
- For i := 1 to Length(s) do
- s[i] := UpCase(s[i]);
- END;
-
- PROCEDURE PAK;
- VAR CH:Char;
- BEGIN
- REPEAT UNTIL KeyPressed;
- ch:=Readkey;
- END;
-
- PROCEDURE ShowPic(Filename : String;Top,Bottom : Byte;Mode : String);
- VAR i,j : Byte;
- TextVar : Text;
- Painting : ARRAY[1..25,1..160] of Char;
- BEGIN
- TextColor(White);
- TextBackground(Black);
- ClrScr;
- Assign(TextVar,Filename);
- {$I-} Reset(TextVar); {$I+}
- If IoResult<>0 then
- BEGIN
- TextColor(LightGray);
- Writeln('Display 1.0 - Picture viewer for Painter 1.0');
- Writeln('Copyright 1991 (c), CDS Productions, Carlos da Silva');
- Writeln;
- Param := ParamStr(1);
- {$V-} BumpStrup(Param); {$V+}
- Writeln('File not found -- ',Param);
- Bright(False);
- UnHideCursor;
- Halt(2);
- END;
- Filename := Filename;
- For i := 1 to 25 do
- BEGIN
- For j := 1 to 160 do
- Read(TextVar,Painting[i,j]);
- Readln(TextVar);
- END;
- Close(TextVar);
- If Mode='2' then
- BEGIN
- For i := Bottom downto Top do
- For j := 1 to 80 do
- BEGIN
- GotoXY(j,i);
- TextAttr := Ord(Painting[i,(j*2)-1]);
- Write(Painting[i,(j*2)]);
- END;
- END else
- If Mode='3' then
- BEGIN
- For j := 1 to 80 do
- For i := Top to Bottom do
- BEGIN
- GotoXY(j,i);
- TextAttr := Ord(Painting[i,(j*2)-1]);
- Write(Painting[i,(j*2)]);
- END;
- END else
- If Mode='4' then
- BEGIN
- For j := 80 downto 1 do
- For i := Top to Bottom do
- BEGIN
- GotoXY(j,i);
- TextAttr := Ord(Painting[i,(j*2)-1]);
- Write(Painting[i,(j*2)]);
- END;
- END else
- BEGIN
- For i := Top to Bottom do
- For j := 1 to 80 do
- BEGIN
- GotoXY(j,i);
- TextAttr := Ord(Painting[i,(j*2)-1]);
- Write(Painting[i,(j*2)]);
- END;
- END;
- END;
-
- BEGIN
- Bright(True);
- HideCursor;
- Writeln('Display 1.0 - Picture viewer for Painter 1.0');
- Writeln('Copyright 1991 (c), CDS Productions, Carlos da Silva');
- Writeln;
- If ParamCount=0 then
- BEGIN
- Writeln('Incorrect usage.');
- Writeln('Command format is: DISPLAY filename [mode] [/BW]');
- Writeln;
- Writeln('filename is the picture to view. It is required.');
- Writeln('[mode] is the way to display it.');
- Writeln(' *1 - Top to bottom wipe');
- Writeln(' 2 - Bottom to top wipe');
- Writeln(' 3 - Left to right wipe');
- Writeln(' 4 - Right to left wipe');
- Writeln;
- Writeln('/BW - Display it in black and white.');
- Writeln;
- Writeln('*(Default value)');
- Bright(False);
- UnHideCursor;
- Halt(1);
- END;
- Param := ParamStr(2);
- {$V-} BumpStrup(Param); {$V+}
- If Param='/BW' then
- BEGIN
- TextMode(MONO);
- Mode := '1';
- END else Mode := Param;
- If ParamStr(3)='/BW' then TextMode(MONO);
- ShowPic(ParamStr(1),1,24,Mode);
- PAK;
- TextMode(CO80);
- Bright(False);
- UnHideCursor;
- END.
-