[Back to TSR SWAG index]  [Back to Main SWAG index]  [Original]

{I have made some changes in your Unit Check, in order to make ik a bit faster
and use somewhat less code and data space (61 Bytes in all). Also, the display
of progress on screen is now 'ticking' because I swap the colors from white on
blue to gray on blue (perhaps a nice idea, now you can see if the machine
Really crashed)...
{$M 8192,0,655360}
Unit MyCheck;
             TeeCee     Bob Swart  Saved:
  Code size: 514 Bytes  455 Bytes  59 Bytes
  Data size:  32 Bytes   30 Bytes   2 Bytes

  Here is the $1C ISR that I will add (unless you wish to do that).

  Some changes were made, which resulted in less code and data size, a
  little more speed, and display of the progress Variable on screen is
  made 'ticking' each second by changing the colour from white on blue
  to gray on blue and back With each update.

Var progress: LongInt Absolute $0040:$00F0;

{ Everything is private to this Unit }
Uses Dos;

  Line      = 0;    { Change as required For position of display on screen }
  Column    = 72;                                 { Top left corner is 0,0 }
  ScreenPos = (line * 80 * 2) + (column * 2);
  Colour: Byte = $1F;                                 { White/Gray on Blue }

  TimeStr = Array[0..15] of Char;
  TimePtr = ^TimeStr;

  Time: TimeStr Absolute $B800:ScreenPos;  { Assume colour display adaptor }
  Time: TimeStr Absolute $B000:ScreenPos; { Otherwise mono display adaptor }
  OldInt1C: Pointer;
  ExitSave: Pointer;

Procedure Int1CISR; Interrupt;
{ This will be called every clock tick by hardware interrupt $08 }
Const DisplayTickCount = 20;
      TickCount: LongInt = DisplayTickCount;
      HexChars: Array[$0..$F] of Char = '0123456789ABCDEF';
Var HexA: Array[0..3] of Byte Absolute progress;
  if TickCount > DisplayTickCount then { ticks to update the display }
    TickCount := 0;        { equality check and assignment faster than mod }
            { The following statements actually display the on-screen time }
    Colour := Colour xor $08;        { Swap between white and gray on blue }
    Time[00] := HexChars[HexA[3] SHR 4];
    Time[02] := HexChars[HexA[3] and $F];
    Time[04] := HexChars[HexA[2] SHR 4];
    Time[06] := HexChars[HexA[2] and $F];
    Time[08] := HexChars[HexA[1] SHR 4];
    Time[10] := HexChars[HexA[1] and $F];
    Time[12] := HexChars[HexA[0] SHR 4];
    Time[14] := HexChars[HexA[0] and $F]
  end { if TickCount > DisplayTickCount };
    pushf                                  { push flags to set up For IRET }
    call  OldInt1C                              { Call old ISR entry point }
end {Int1CISR};

Procedure ClockExitProc; Far;
{ This Procedure is VERY important as you have hooked the timer interrupt  }
{ and therefore if this is omitted when the Unit is terminated your        }
{ system will crash in an unpredictable and possibly damaging way.         }
  ExitProc := ExitSave;
  SetIntVec($1C,OldInt1C);               { This "unhooks" the timer vector }
end {ClockExitProc};

  progress := 0;
  ExitSave := ExitProc;                          { Save old Exit Procedure }
  ExitProc := @ClockExitProc;                 { Setup a new Exit Procedure }
  GetIntVec($1C,OldInt1C);              { Get old timer vector and save it }
  SetIntVec($1C,@Int1CISR);   { Hook the timer vector to the new Procedure }

[Back to TSR SWAG index]  [Back to Main SWAG index]  [Original]