home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turbo Toolbox
/
Turbo_Toolbox.iso
/
1990
/
06
/
tricks
/
knoten.mod
< prev
next >
Wrap
Text File
|
1990-03-08
|
4KB
|
152 lines
(* ------------------------------------------------------ *)
(* KNOTEN.MOD *)
(* (c) 1990 Michael Gundlach & TOOLBOX *)
(* ------------------------------------------------------ *)
MODULE Knotentest;
FROM SYSTEM IMPORT ASSEMBLER;
FROM System IMPORT GetArg, Terminate;
FROM InOut IMPORT WriteString, WriteLn, WriteHex;
VAR
a, b, c, d : CARDINAL;
s : ARRAY [0..4] OF CHAR;
t : CARDINAL;
PROCEDURE HexNachCard(s : ARRAY OF CHAR) : CARDINAL;
VAR
i, t : CARDINAL;
BEGIN
t := 0;
FOR i := 0 TO 3 DO
t := t * 16;
CASE s[i] OF
"0".."9" : INC(t, ORD(s[i]) - ORD("0")) |
"a".."f" : INC(t, ORD(s[i]) - ORD("a") + 10) |
"A".."F" : INC(t, ORD(s[i]) - ORD("A") + 10);
ELSE
Fehler;
END;
END;
RETURN t;
END HexNachCard;
PROCEDURE Fehler;
BEGIN
WriteLn;
WriteString('Knotentest: Fehler! - Hilfe: "KNOTEN -?"');
WriteLn;
Terminate(1);
END Fehler;
PROCEDURE Testt(t : CARDINAL);
BEGIN
IF t <> 4 THEN
Fehler;
END;
END Testt;
PROCEDURE Ausgabe(h1, h2 : CARDINAL);
BEGIN
WriteString("...");
WriteHex(4096, 4);
WriteHex(h1, 4);
WriteHex(h2, 4);
WriteLn;
END Ausgabe;
PROCEDURE Knoten(VAR h1, h2 : CARDINAL);
VAR
i, j : CARDINAL;
BEGIN
ASM
MOV AH, 0EEH
INT 21H
MOV i, BX
MOV j, AX
END;
h1 := i;
h2 := j;
END Knoten;
BEGIN
WriteString("Wie heißt der Knoten von DRI und MI ");
GetArg(s, t);
IF (t=2) AND ((s[0]="-") OR (s[0]="/")) THEN
CASE s[1] OF
"?" :
WriteLn;WriteLn;
WriteString("Knotentest, Version 3, 30.1.90 ");
WriteString("- (c) by DRI und MI");
WriteLn;WriteLn;
WriteString("...gibt die Nummer des Novell");
WriteString("-Netzknotens der aufrufenden Station aus.");
WriteLn;WriteLn;
WriteString("KNOTEN ( [-t] hex1 hex2 | -[?|a|n] )");
WriteLn;
WriteString(" hex1, hex2: die letzten acht");
WriteString(" Stellen des Knotens");
WriteLn;
WriteString(" (für ");
WriteString("Überprüfungszwecke)");
WriteLn;
WriteString(" -a | /a: endet immer mit");
WriteString(" errorlevel = 0");
WriteLn;
WriteString(" -n | /n: zeigt nur die");
WriteString(" Knotennummer");
WriteLn;
WriteString(" -? | /?: dieser ");
WriteString("Hilfsbildschirm");
WriteLn;WriteLn|
"a","A":
WriteString("...verrat ich nicht!");
WriteLn;
Terminate(0);|
"n","N":
Knoten(c,d);
Ausgabe(c,d);
Terminate(0)|
"t","T":
GetArg(s,t);
Testt(t);
a:=HexNachCard(s);
GetArg(s,t);
Testt(t);
b:=HexNachCard(s);
Knoten(c,d);
IF (a=c) AND (b=d) THEN
WriteString("...ausloggen darfst Du ");
WriteString("dich hier nie!");
WriteLn;
Terminate(255);
ELSE
Ausgabe(c,d);
END;
ELSE
Fehler;
END;
Terminate(0);
ELSE
Testt(t);
a:=HexNachCard(s);
GetArg(s,t);
Testt(t);
b:=HexNachCard(s);
Knoten(c,d);
IF (a=c) AND (b=d) THEN
WriteString("ausloggen darfst Du dich hier nie!");
WriteLn;
Terminate(255);
ELSE
Ausgabe(c,d);
END;
END;
END Knotentest.
(* ------------------------------------------------------ *)
(* Ende von KNOTEN.MOD *)