home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turbo Toolbox
/
Turbo_Toolbox.iso
/
1990
/
05
/
praxis
/
snapshot.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-02-14
|
7KB
|
222 lines
(* ------------------------------------------------------ *)
(* SNAPSHOT.PAS *)
(* (c) 1990 Gustl Huber & TOOLBOX *)
(* ------------------------------------------------------ *)
{$R-,S-,I-,V-,B-,N-,D-}
{$M 4096,0,655360} { wenig Stack, Heap durch TSR begrenzt }
PROGRAM Snapshot;
USES TSR, Crt, Dos, PCXTools;
CONST
SnapID = 11; { Kennziffer }
Version = 'SNAPSHOT PLUS';
Hotkey = $6800; { Aktivierung: Alt-F1 }
HotkeyName = 'Alt-F1';
numpic : WORD = 1;
name = 'SNAP0000';
AttrScreen : BOOLEAN = FALSE;
VAR
pfad : STRING;
i : INTEGER;
FUNCTION HGCGrafik : BOOLEAN;
VAR
LP : RECORD
CASE INTEGER OF
0 : (LB, HB : BYTE); { Pos. 2 Bytes }
1 : (LW : INTEGER); { Pos. 1 Word }
END;
BEGIN
Port[$3BB] := 0; { Reset des Light-Pen-Latch-Reg.}
WHILE(PORT[$3BA] AND $80 <> 0 ) DO {}; { Start }
WHILE(PORT[$3BA] AND $80 = 0 ) DO {}; { Ende }
INLINE ($FA); { cli, Interrupts unterdrücken }
WHILE(PORT[$3BA] AND $80 <> 0 ) DO {} ;
Port[$3B9]:=0; { Light-Pen-Position merken }
INLINE ($FB); { sti, Interrupts wieder zulassen }
Port[$3B4] := $10; { Hi-Byte Light-Pen-Pos. auslesen }
LP.HB := Port[$3B5];
Port[$3B4]:=$11; { Lo-Byte Light-Pen-Pos.lesen }
LP.LB := Port[$3B5];
HGCGrafik := (LP.LW) > (45 * 87);
END;
FUNCTION ExistFile(name : STRING) : BOOLEAN;
VAR
F : FILE;
BEGIN
Assign(F, name);
Reset(F);
ExistFile := (IOResult = 0);
END;
PROCEDURE TXTScreen(Base : WORD);
VAR
S : STRING[160];
R : STRING[80];
I, J, Seg : WORD;
P : POINTER;
F : TEXT;
BEGIN
Assign(F, pfad + '.TXT');
Rewrite(F);
DOSError := IOResult;
IF DOSError <> 0 THEN Exit;
Seg := Base + $100 * PCXTools.ActivePage;
FOR I := 0 TO 24 DO BEGIN
P := Ptr(Seg, I*160);
S[0] := #160;
Move(P^, S[1], 160);
R := '';
J := 1;
WHILE J <= 160 DO BEGIN
R := R + S[J];
Inc(J, 2);
END;
WriteLn(F, R);
DOSError := IOResult;
IF DOSError <> 0 THEN BEGIN
Close(f);
DOSError := IOResult;
Exit;
END;
END;
Close(F);
END;
PROCEDURE ATTScreen(Base : WORD);
VAR
P : POINTER;
F : FILE;
BEGIN
Assign(F, pfad+ '.ATT');
Rewrite(F, 1);
DOSError := IOResult;
IF DOSERROR <> 0 THEN Exit;
P := Ptr(WORD(Base + $100 * PCXTools.ActivePage), 0);
Blockwrite(F, P^, 4000);
DOSError := IOResult;
IF DOSERROR <> 0 THEN BEGIN
Close(f);
DOSError := IOResult;
Exit;
END;
Close(F);
IF IOResult <> 0 THEN;
END;
{$F+}
PROCEDURE GetPicture;
VAR
I : INTEGER;
Regs : Registers;
vmodus : WORD;
temp : STRING[4];
BEGIN
Regs.ah := $0F;
Intr($10, Regs);
vmodus := Regs.al;
PCXTools.ActivePage := Regs.bh;
PCXTools.xmin := 0;
PCXTools.YMin := 0;
REPEAT
IF numpic > 9999 THEN Exit;
Str(numpic, temp);
Pfad := name;
Move(temp[1], pfad[9-Length(temp)], Length(temp));
Inc(numpic);
UNTIL (ExistFile(Pfad + '.PCX') = FALSE) AND
(ExistFile(Pfad +'.TXT') = FALSE) AND
(ExistFile(Pfad +'.ATT') = FALSE);
Write(^G);
CASE vmodus OF
$3, $83 : { Text-Modi 40x25 und 80x25 }
IF AttrScreen THEN ATTScreen($B800)
ELSE TXTScreen($B800);
$10, $90 :
BEGIN { EGA-Modi: }
PCXTools.Xmax := 639;
PCXTools.YMax := 349;
I := BGItoPCX(3, 1, Pfad + '.PCX');
END;
$0F, $8F :
BEGIN { EGA-Mono: }
PCXTools.Xmax := 639;
PCXTools.YMax := 349;
I := BGItoPCX(3, 3, Pfad + '.PCX');
END;
$0E, $8E :
BEGIN { CGA-Emulation durch EGA }
PCXTools.Xmax := 639;
PCXTools.YMax := 199;
I := BGItoPCX(3, 0, Pfad + '.PCX');
END;
$06, $86 :
BEGIN { CGA }
PCXTools.xmax := 639;
PCXTools.YMax := 199;
I := BGItoPCX(1, 4, Pfad + '.PCX');
END;
$4, $5,
$84, $85 :
BEGIN { CGA-Modi mit 320 x 200 }
PCXTools.Xmax := 319;
PCXTools.YMax := 199;
I := BGItoPCX(1, 1, Pfad + '.PCX');
END;
$11, $91,
$12, $92 :
BEGIN { VGA-Grafik-Modi }
PCXTools.Xmax := 639;
PCXTools.YMax := 479;
I := BGItoPCX(9, 2, Pfad + '.PCX');
END;
$07,$87 :
BEGIN
IF HGCGrafik THEN BEGIN { Grafik-Modus }
PCXTools.Xmax := 719;
PCXTools.YMax := 347;
I := BGItoPCX(7, 0, pfad + '.PCX');
END ELSE BEGIN { Text-Modus: }
PCXTools.ActivePage := 0;
IF AttrScreen THEN ATTScreen($B000)
ELSE TXTScreen($B000);
END;
END;
END;
Write(^G^G);
END;
{$F-}
BEGIN
IF AlreadyLoaded(SnapID) THEN
WriteLn(Version, ' ist bereits geladen!',
^M^J, 'Aktivieren Sie das Programm mit ',
HotKeyName, '.')
ELSE BEGIN
IF PopUpInstalled (@GetPicture, Hotkey, 24) THEN BEGIN
IF ParamCount > 0 THEN BEGIN
Pfad := ParamStr(1);
FOR i := 1 TO Length(Pfad) DO
Pfad[i] := UpCase(Pfad[i]);
IF (Pfad[1] = '/') AND (Pfad[2] = 'A') THEN
AttrScreen := TRUE;
END;
WriteLn(Version, ' installiert.',
^M^J, 'Aktivieren Sie das Programm mit ',
HotKeyName, '.');
Write(^M^J,'Die Ablage der Textbildschirme erfolgt ');
CASE AttrScreen OF
FALSE : WriteLn('im reinen ASCII-Format');
TRUE : WriteLn('inklusive der Attribute');
END;
MakeResident(SnapID);
END ELSE
WriteLn(Version, ' nicht installiert,', ^M^J,
'Fehler: Vermutlich zu wenig Hauptspeicher!');
END;
END.
(* ------------------------------------------------------ *)
(* Ende von SNAPSHOT.PAS *)