home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_01 / 2n01020a < prev    next >
Text File  |  1990-10-12  |  2KB  |  77 lines

  1. Listing 1.  Timer Package Macro Assembly Definitions.
  2.  
  3. ;***    SysAllocateTimer - Allocate a Timer Object.
  4. ;
  5. ;       This macro is used to allocate a timer object
  6. ;       and initialize its context and expiration
  7. ;       routine parameters.
  8. ;
  9. ;       Usage:  SysAllocateTimer timer, context, expiration_rtn
  10.  
  11. SysAllocateTimer MACRO tmr, ctx, exprtn
  12.         push    ax
  13.         push    bx
  14.         push    cx
  15.         push    dx
  16.         mov     ax, ctx                 ; (AX) = timer routine context.
  17.         mov     bx, cs                  ; (BX) = seg FWA, expiration rtn.
  18.         mov     cx, exprtn              ; (CX) = ofs FWA, expiration rtn.
  19.         Pcall   AllocateTimer
  20.         pop     dx
  21.         pop     cx
  22.         pop     bx
  23.         mov     tmr, ax                 ; store handle to timer object.
  24.         pop     ax
  25.         ENDM
  26.  
  27. ;***    SysDeallocateTimer - Free a Timer Object.
  28. ;
  29. ;       This macro is used to deallocate a timer object
  30. ;       and return it to the system.
  31. ;
  32. ;       Usage:  SysDeallocateTimer timer
  33.  
  34. SysDeallocateTimer MACRO tmr
  35.         push    ax
  36.         push    dx
  37.         mov     ax, tmr                 ; (AX) = handle to timer object.
  38.         Pcall   DeallocateTimer
  39.         pop     dx
  40.         pop     ax
  41.         ENDM
  42.  
  43. ;***    SysStartTimer - Start a Timer Object.
  44. ;
  45. ;       This macro is used to start a timer object
  46. ;       and specify the number of milliseconds before
  47. ;       the expiration routine should be executed.
  48. ;
  49. ;       Usage:  SysStartTimer timer, deltatime
  50.  
  51. SysStartTimer MACRO tmr, delta
  52.         push    ax
  53.         push    cx
  54.         push    dx
  55.         mov     ax, tmr                 ; (AX) = handle to timer object.
  56.         mov     cx, delta               ; (CX) = ms until timer shall expire.
  57.         Pcall   StartTimer
  58.         pop     dx
  59.         pop     cx
  60.         pop     ax
  61.         ENDM
  62.  
  63. ;***    SysStopTimer - Stop a Timer Object.
  64. ;
  65. ;       This macro is used to stop a timer object.
  66. ;
  67. ;       Usage:  SysStopTimer timer
  68.  
  69. SysStopTimer MACRO tmr
  70.         push    ax
  71.         push    dx
  72.         mov     ax, tmr                 ; (AX) = handle to timer object.
  73.         Pcall   StopTimer
  74.         pop     dx
  75.         pop     ax
  76.         ENDM
  77.