home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / QB_LIB.ZIP / CLEARWIN.ASM next >
Assembly Source File  |  1990-04-20  |  3KB  |  93 lines

  1. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. ;
  3. ;    Name :    CLEARWIN.ASM
  4. ;
  5. ;    Revised :    4/20/90
  6. ;
  7. ;   Overview :    This routine allows a user-defined screen "window" area to be
  8. ;        cleared, much like the CLS command clears the entire screen.
  9. ;        This routine requires the user to define the four corners of
  10. ;        the window area itself, and to specify an INTEGER value for
  11. ;        the color attribute which the cleared screen area should be
  12. ;        given (see table below).
  13. ;
  14. ;      Notes :    - Requires the Microsoft MACRO ASSEMBLER V 5.1 or higher for
  15. ;        successful assembly due to the use of the simplified Segment
  16. ;        Model by Microsoft.
  17. ;        - THIS PROGRAM PERFORMS NO ERROR CHECK!
  18. ;        - This SUB should be DECLAREd in your program as an external
  19. ;        SUB routine, as follows:
  20. ;
  21. ;        DECLARE SUB ClearWin (Ulr%, Ulc%, Lrr%, Lrc%, Att%)
  22. ;
  23. ;        - Consistent with QuickBASIC, this routine will define the
  24. ;        screen as ranging from the upper left corner (at 1,1)
  25. ;        to the lower right corner (at 25,80), rather than the
  26. ;        way in which assembler defines the screen (as 0,0 to 24,79).
  27. ;
  28. ; Parameters :    - This SUB requires FIVE parameters, which may be pre-defined
  29. ;        INTEGER VARIABLES, IMMEDIATE INTEGER VALUES, or CONST's.
  30. ;        Note that VARIABLES and CONST's are faster at run-time than
  31. ;        are IMMEDIATE values.
  32. ;        These parameters are defined as -
  33. ;
  34. ;        Ulr = Upper Left Hand Row # of the Window
  35. ;        Ulc = Upper Left Hand Column # of the Window
  36. ;        Lrr = Lower Right Hand Row #
  37. ;        Lrc = Lower Right Hand Column #
  38. ;        Att = The color attribute to give the Window Area, as follows:
  39. ;
  40. ;                COLOR VALUES TO USE
  41. ;
  42. ;    Color        Foreground Value        Background Value
  43. ;
  44. ;    BLACK            0                 0
  45. ;    BLUE            1                16
  46. ;    GREEN            2                32
  47. ;    CYAN            3                48
  48. ;    RED            4                64
  49. ;    MAGENTA         5                80
  50. ;    YELLOW            6                96
  51. ;    WHITE            7                   112
  52. ;
  53. ;    To get INTENSE foreground color, add 8 to foreground value.
  54. ;    To get BLINKING attribute, add 128 to the total combined color value.
  55. ;==============================================================================
  56.  
  57.     .MODEL    MEDIUM, BASIC
  58.     .CODE
  59.  
  60. ClearWin    PROC    ULR:word, ULC:word, LRR:word, LRC:word, ATTRIB:word
  61.  
  62.     mov    BX,ULC            ; Put address of Ulc value into BX
  63.     mov    CX,[BX]         ; Put Ulc value into CL
  64.     dec    CX            ; Adjust for BASIC screen definition
  65.  
  66.     mov    BX,ULR            ; Put address of Ulr value into BX
  67.     mov    AX,[BX]         ; Put Ulr value into AX
  68.     dec    AX            ; Adjust for BASIC screen definition
  69.     mov    CH,AL            ; Transfer Ulr value into CH
  70.  
  71.     mov    BX,LRC            ; Put address of Lrc value into BX
  72.     mov    AX,[BX]         ; Put Lrc value into AX
  73.     dec    AX            ; Adjust for BASIC screen definition
  74.     mov    DX,AX            ; Put Lrc value into DL
  75.  
  76.     mov    BX,LRR            ; Put address of Lrr value into BX
  77.     mov    AX,[BX]         ; Put Lrr value into AX
  78.     dec    AX            ; Adjust for BASIC screen definition
  79.     mov    DH,AL            ; Put actual Lrr value into DH
  80.  
  81.     mov    BX,ATTRIB        ; Put addr. of color attribute into BX
  82.     mov    AX,[BX]         ; Put color attribute value into AX
  83.     mov    BH,AL            ; Put the color to use into BH
  84.     mov    AX,0600h        ; BIOS Scroll Up Function, all lines
  85.     int    10h            ; BIOS INT
  86.  
  87.     ret                ; Back to the CALLing QB program
  88.  
  89. ClearWin    ENDP
  90.         END
  91.  
  92. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  93.