home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / amiga-flight / programs / timer.asm < prev    next >
Assembly Source File  |  1977-12-31  |  3KB  |  67 lines

  1. *****************************************************************************
  2. ***                             TIMER.ASM                                 ***
  3. ***                                                                       ***
  4. ***    Author : Andrew Duffy                                              ***
  5. ***    Date   : February 1993                                             ***
  6. ***    Desc.  : This program demonstrates how to use the timer routines   ***
  7. ***             to delay for a set period of time.                        ***
  8. ***                                                                       ***
  9. ***                          ©XCNT, 1992-1994.                            ***
  10. *****************************************************************************
  11.  
  12.  
  13. *****************************************************************************
  14. ***                              Includes                                 ***
  15. *****************************************************************************
  16.  
  17.         include    "subrts.h"    Included by default anyway
  18.  
  19. *****************************************************************************
  20. ***                              Constants                                ***
  21. *****************************************************************************
  22.  
  23. ONESEC        EQU    250000        Number of clock ticks in 1 second
  24.  
  25. *****************************************************************************
  26. ***                            Initial message                            ***
  27. *****************************************************************************
  28.  
  29.         movea.l    #StartText,a6
  30.         jsr    OUTSTR        Call OUTSTR routine
  31.         
  32. *****************************************************************************
  33. ***                              Main routine                             ***
  34. *****************************************************************************
  35.  
  36.         move.l    #10*ONESEC,d0    Time to delay for
  37.         jsr    START_TIMER    Call START_TIMER
  38. Loop        jsr    CHECK_TIMER    Call CHECK_TIMER
  39.         beq.s    Loop        Loop if not finished
  40.  
  41. *****************************************************************************
  42. ***                              End Message                              ***
  43. *****************************************************************************
  44.  
  45.         movea.l    #EndText,a6
  46.         jsr    OUTSTR        Call OUTSTR routine
  47.  
  48. *****************************************************************************
  49. ***                       Wait for a key to be pressed                    ***
  50. *****************************************************************************
  51.  
  52. Loop2        jsr    INKEY        Call INKEY routine
  53.         beq.s    Loop2        Loop if nothing pressed
  54.  
  55.         rts            Exit
  56.  
  57. *****************************************************************************
  58. ***                               Strings                                 ***
  59. *****************************************************************************
  60.  
  61. StartText    dc.b    "Counting for 10 seconds.",13,10,0
  62. EndText        dc.b    "Done.",13,10,"Press any key to exit.",0
  63.  
  64. *****************************************************************************
  65. ***                        End of file TIMER.ASM.                         ***
  66. *****************************************************************************
  67.