home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / qb_pds / qb_sub / pause.sub < prev    next >
Encoding:
Text File  |  1987-07-14  |  2.7 KB  |  82 lines

  1. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. '%  (C) 1987 HUMBLEWARE Custom Programming    Author: Lawrence A. Westhaver  %
  3. '%        247 Paul Martin Drive,  Baltimore MD  21227  (301) 799-1975        %
  4. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. '%                                                                           %
  6. '%     FILENAME: PAUSE.SUB                       LAST UPDATE: 06-07-1987     %
  7. '%                                                                           %
  8. '%  DESCRIPTION: Pauses program execution for a specified number of seconds. %
  9. '%                                                                           %
  10. '%         CALL: CALL PAUSE(SECONDS%,KYBD%)                                  %
  11. '%                                                                           %
  12. '%       INPUTS: SECONDS% = Number of seconds to pause program execution.    %
  13. '%                                                                           %
  14. '%                  KYBD% = Flag allowing or disallowing user interuption    %
  15. '%                          from the keyboard.                               %
  16. '%                                                                           %
  17. '%      OUTPUTS: None.                                                       %
  18. '%                                                                           %
  19. '%         NOTE: This routine is accurate to approximately -1 second.        %
  20. '%                                                                           %
  21. '%               If KYBD% is non-zero, this routine may be interupted by     %
  22. '%               pressing any key. Control then returns to the caller.       %
  23. '%                                                                           %
  24. '%               If KYBD% is zero, this routine cannot be interupted from    %
  25. '%               the keyboard. Control returns to the caller only after      %
  26. '%               the specified number of seconds has elapsed.                %
  27. '%                                                                           %
  28. '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  29.  
  30.  
  31. SUB PAUSE(SECONDS%,KYBD%) Static
  32.  
  33.  
  34. 'clear keyboard buffer
  35.  
  36.     IF KYBD% THEN
  37.  
  38.       DO
  39.  
  40.         CC$ = INKEY$
  41.  
  42.       LOOP UNTIL CC$ = ""
  43.  
  44.     END IF
  45.  
  46.  
  47. 'begin pause timer
  48.  
  49.     TIMER.COPY! = INT(TIMER)
  50.  
  51.     COUNTER% = 0
  52.  
  53.     DO
  54.  
  55.       IF INT(TIMER.COPY!) <> INT(TIMER) THEN
  56.  
  57.         TIMER.COPY! = INT(TIMER)
  58.  
  59.         COUNT% = COUNT% + 1
  60.  
  61.         IF COUNT% >= SECONDS% THEN
  62.           EXIT DO
  63.         END IF
  64.  
  65.       END IF
  66.  
  67.       IF KYBD% THEN
  68.  
  69.         CC$=INKEY$
  70.  
  71.         IF CC$ <> "" THEN
  72.           EXIT DO
  73.         END IF
  74.  
  75.       END IF
  76.  
  77.     LOOP
  78.  
  79.  
  80. END SUB 'pause
  81.  
  82.