     WAIT.ASM is a routine written for MASM 5.0.  It is a
simple routine that is very flexible and can be used in
multiple ways within one program, depending on the needs of
the calling procedure.

     In many application programs, it is necessary for the
program to pause, especially if the user needs to read a
message or two displayed to the screen.  "Strike a key when
ready. . ." procedures may be used but if you forget to
process the key, it could cause problems later in the
program.  WAIT.ASM enables the program process to be halted
up to an hour, depending on the need.

     The BIOS interrupt 1Ah, service 0h, is utilized by
WAIT.ASM to get the present 'tick count' on entry to the
heart of the routine.  It pushes the lower word of the tick
count (found in the DX register) onto the stack.  Next, it
recalls the same interrupt to get another 'tick count.' After
'popping' the old tick count's lower word into the BX
register, it compares BX with DX (the lower word of the New
'tick count'). The procedure will keep calling for new 'tick
counts' until the count is different. This is the internal
loop of the WAIT procedure.

     The flexibility of the procedure comes with the
'external' loop.  When the procedure starts, it loads the
variable, "TICK_WAIT" (containing the number of 'ticks' the
delay will be), into the CX register whose value was given by
the calling procedure.  In this way, the 'internal' loop
described above would be performed "X" times depending on the
number of ticks places in the "TICK_WAIT" variable.

     The WAIT procedure can be called a number of times
during the program with the length of the "delay" varying
relying on the needs at the time it is called.

     To calculate the number of ticks in the wait, just
use one of the following formulae:

     Length in seconds X 18.2 = 'Ticks'
     Length in minutes X 1092 = 'Ticks'

     Remember, the largest number of ticks that can be used
in the above procedure is FFFEh (or 65,534 decimal).  This
would give a delay of about 60 minutes.  If you find it
necessary to delay the processing of a program for longer
than an hour, it's best not to use the WAIT procedure.

     If you use this procedure, please let me know how it
works (especially if it is called from other languages).  If
you have a better one, let me know.

                                             J. L. Doyle
                                             70731,726

                                                                  