home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / nfsrc21.zip / DISPCNT.ASM < prev    next >
Assembly Source File  |  1992-10-17  |  3KB  |  94 lines

  1. ; File......: DISPCNT.ASM
  2. ; Author....: Ted Means
  3. ; CIS ID....: 73067,3332
  4. ; Date......: $Date:   17 Oct 1992 16:26:56  $
  5. ; Revision..: $Revision:   1.1  $
  6. ; Log file..: $Logfile:   C:/nanfor/src/dispcnt.asv  $
  7. ; This is an original work by Ted Means and is placed in the
  8. ; public domain.
  9. ;
  10. ; Modification history:
  11. ; ---------------------
  12. ;
  13. ; $Log:   C:/nanfor/src/dispcnt.asv  $
  14. ;  
  15. ;     Rev 1.1   17 Oct 1992 16:26:56   GLENN
  16. ;  Leo cleaned up documentation block.
  17. ;  
  18. ;     Rev 1.0   15 Oct 1992 23:57:46   GLENN
  19. ;  Initial revision.
  20.  
  21. ;  $DOC$
  22. ;  $FUNCNAME$
  23. ;     FT_DispCnt()
  24. ;  $CATEGORY$
  25. ;     Video
  26. ;  $ONELINER$
  27. ;     Return the number of outstanding calls to DispBegin()
  28. ;  $SYNTAX$
  29. ;     FT_DispCnt() --> nCount
  30. ;  $ARGUMENTS$
  31. ;     None
  32. ;  $RETURNS$
  33. ;     An integer.
  34. ;  $DESCRIPTION$
  35. ;     Some routines (like exception handlers, for example) must be able to
  36. ;     guarantee that their output makes it to the screen.  This can be
  37. ;     difficult if a call to DispBegin() is in effect, because any error
  38. ;     messages will be sent to Clipper's virtual screen buffer instead of
  39. ;     the actual physical screen.  This function alleviates the problem by
  40. ;     allowing you to determine if screen output is being buffered, and if
  41. ;     so, how many DispEnd() calls are necessary to flush the buffer.
  42. ;
  43. ;     Although this function does not use "internals" in the conventional
  44. ;     sense, it still makes use of version-specific information in order
  45. ;     to locate the virtual screen buffer.  DO NOT attempt to use this
  46. ;     function with any version of Clipper other than 5.01.
  47. ;  $EXAMPLES$
  48. ;
  49. ;     function ErrorHandler()
  50. ;
  51. ;     // Guarantee that the error message will reach the screen
  52. ;
  53. ;     while FT_DispCnt() > 0 ; dispend(); end
  54. ;
  55. ;     // Now it's okay to do the error message
  56. ;
  57. ;     ErrorMessage( "Something terrible has happened" )
  58. ;
  59. ;     return NIL
  60. ;
  61. ;  $END$
  62. ;
  63.  
  64. IDEAL                                        ; Invoke TASM IDEAL mode
  65.  
  66. Public   FT_DispCnt
  67.  
  68. Extrn    DispEnd:Far
  69. Extrn    __RetNI:Far
  70.  
  71. Segment  _NanFor   Word      Public    "CODE"
  72.          Assume    CS:_NanFor
  73.  
  74. Proc     FT_DispCnt          Far
  75.  
  76.          Mov       BX,Seg DispEnd            ; Get segment of DispEnd()
  77.          Mov       ES,BX                     ; Store in ES
  78.          Mov       BX,Offset DispEnd         ; Get offset of DispEnd()
  79.          Mov       BX,[Word Ptr ES:BX + 6]   ; Lift address from machine code
  80.          LES       BX,[DWord Ptr BX]         ; Load pointer into ES:BX
  81.          Mov       AX,[Word Ptr ES:BX + 2Eh] ; Grab current count
  82.          Neg       AX                        ; It's stored as a negative
  83.          Push      AX                        ; Put on stack
  84.          Call      __RetNI                   ; Return it
  85.          Add       SP,2                      ; Realign stack
  86.          RetF
  87.  
  88. Endp     FT_DispCnt
  89. Ends     _NanFor
  90. End
  91.  
  92.