: is there a way in which you can get the system clock to work in your program but still have your program run normally. i mean can the clock go up second by second during the running of the program
:
Use Interrupts. They aren't that difficult to use. Just remember that you can't do too much in an interrupt because they get called often (ex. the timer routine gets called 18.2/sec)
Here's a TP7 example:
UNIT Clock;
INTERFACE
IMPLEMENTATION
USES Dos;
VAR OldTimerInt : Pointer;
OldExit : Pointer;
{ New timer interrupt }
PROCEDURE TimerInt; interrupt;
Begin
CallInt(OldTimerInt);
(*** Your Code Here (remember to keep it short) ***)
End;
{ Reset old timer }
PROCEDURE SetOldTimInt;
Begin
ExitProc := OldExit;
SetIntVec($1C, OldTimerInt);
STI;
End;
Begin
OldExit := ExitProc;
ExitProc := @SetOldTimInt; { On Exit, Autmatically restore Int }
GetIntVec($1C, OldTimerInt); { Record location of old Interrupt }
SetIntVec($1C, @TimerInt); { Install new interrupt procedure }
End.