home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------ *)
- (* TIMER.PAS *)
- (* Turbo Pascal ab 5.0 *)
- (* (c) 1990 Gerald Arend & TOOLBOX *)
- (* ------------------------------------------------------ *)
-
- PROGRAM Timer;
-
- USES Crt, Dos;
-
- TYPE
- Elem = RECORD
- ch : CHAR;
- Att : BYTE;
- END;
- VAR
- Screen : ARRAY[1..25, 1..80] OF Elem
- ABSOLUTE $B800:0000; { Hercules: $B000:0000 }
- OldInt1C : POINTER;
- LastSec : WORD;
- CONST
- TextFarbe = LightMagenta;
- BackStein = #177;
-
- PROCEDURE WriteString(x, y : BYTE; Strg : STRING);
- VAR { schreibt String direkt in Bildschirmspeicher }
- n : BYTE;
- BEGIN
- FOR n := 1 TO Length(Strg) DO BEGIN
- Screen[y, x + n - 1].ch := Strg[n];
- Screen[y, x + n - 1].Att := TextFarbe;
- END;
- END;
-
- FUNCTION Int2Str(Num : WORD; Len : BYTE) : STRING;
- VAR { "Str" als Funktion }
- Puffer : STRING;
- BEGIN
- Str(Num:Len, Puffer);
- Int2Str := Puffer;
- END;
-
- PROCEDURE TimeAndDate; { zeigt Zeit und Datum an }
- INTERRUPT; { wird in Interrupt 28 eingeklinkt }
- VAR
- h, m, s, s100 : WORD; { Zeit }
- Year, Month, Day, DayOfWeek : WORD; { Datum }
- Zeit, Datum : STRING; { für Ausgabe }
- BEGIN
- GetTime(h, m, s, s100);
- GetDate(Year, Month, Day, DayOfWeek);
- IF s <> LastSec THEN BEGIN { Tick-Tack }
- Sound((s MOD 2) * 500 + 500);
- LastSec := s;
- END;
- Zeit := Int2Str(h, 2) + ':' + Int2Str(m, 2) + ':' +
- Int2Str(s, 2);
- Datum := Int2Str(Day, 2) + '.' + Int2Str(Month, 2) + '.' +
- Int2Str(Year, 4);
- WriteString(1, 1, Zeit);
- WriteString(1, 2, Datum);
- NoSound;
- END;
-
- BEGIN
- ClrScr;
- CheckBreak := FALSE;
- LastSec := 99;
- GetIntVec($1C, OldInt1C); { alten Interrupt 28 sichern }
- SetIntVec($1C, @TimeAndDate); { Interrupt verbiegen }
- REPEAT
- GotoXY(Random(80) + 1, Random(22) + 3);
- TextColor(Random(16));
- Write(Backstein);
- UNTIL KeyPressed;
- SetIntVec($1C, OldInt1C); { Interruptvektor restaurieren }
- TextColor(LightGray);
- ClrScr;
- END.
- (* ------------------------------------------------------ *)
- (* Ende von TIMER.PAS *)