grputil.asm
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:3k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. TITLE GRPUTIL - iAPX 88/86 GRAPHICS UTILITY ROUTINES
  2. ;***
  3. ; GRPUTIL - iAPX 88/86 GRAPHICS UTILITY ROUTINES
  4. ;
  5. ; Copyright <C> 1986, Microsoft Corporation
  6. ;
  7. ;Purpose:
  8. ; Graphics utility routines.
  9. ;
  10. ;******************************************************************************
  11. INCLUDE switch.inc
  12. INCLUDE rmacros.inc ; Runtime Macro Defintions
  13. USESEG _BSS
  14. USESEG GR_TEXT 
  15. INCLUDE seg.inc  ;segment definitions
  16. sBegin _BSS
  17. ;
  18. ;****************************************************************************
  19. ; External low-level function vectors
  20. ;****************************************************************************
  21. ;
  22. externW b$SetAttr
  23. externW B$VXMIN ;defined in GWDATA.ASM
  24. externW B$VXMAX ;defined in GWDATA.ASM
  25. externW B$VYMIN ;defined in GWDATA.ASM
  26. externW B$VYMAX ;defined in GWDATA.ASM
  27. sEnd _BSS
  28. assumes CS,GR_TEXT
  29. sBegin GR_TEXT 
  30. ;low-level routines:
  31. externNP B$GETFBC
  32. externNP B$ERR_FC
  33. PAGE
  34. SUBTTL GRAPHICS SUPPORT ROUTINES
  35. ;***
  36. ;
  37. ;B$CLRATR PROCESS COLOR ATTRIBUTE FOR GRAPHICS STATEMENTS
  38. ;
  39. ;Purpose:
  40. ;    This routine processes a color attribute for several graphics
  41. ;    statements. If the color attribute is defaulted, the default color
  42. ;    is put into AL by a call to the OEM dependent routine B$GETFBC.  Next
  43. ;    OEM routine SetAttr is called to set the current graphics attribute
  44. ;    to the specified color.  If the color was invalid, SetAttr returns
  45. ;    carry set and this routine issues a function call error.
  46. ;
  47. ;Entry:
  48. ; AL=color attribute or AX=-1 if default color
  49. ;
  50. ;Exit:
  51. ; AL=valid color attribute
  52. ;
  53. ;Modifies:
  54. ; AX,BX
  55. ;
  56. ;****
  57. cProc B$CLRATR,<PUBLIC,NEAR>
  58. cBegin
  59. ;PROCESS COLOR ATTRIBUTE
  60. CMP AX,-1 ;IS DEFAULT COLOR NEEDED?
  61. JNE SET_COLOR ;NO: USE SPECIFIED VALUE
  62. STC ;SET CARRY
  63. CALL B$GETFBC  ;GET FG/BG COLORS
  64. SET_COLOR:
  65. CALL [b$SetAttr] ;SET ATTRIBUTE
  66. JC FC_ERROR ;ABORT IF INVALID COLOR
  67. cEnd
  68. FC_ERROR:
  69. JMP B$ERR_FC ;ILLEGAL FUNCTION CALL
  70. SUBTTL COMPILER INTERFACE ROUTINES
  71. PAGE
  72. ;***
  73. ;
  74. ;B$INVIEW     Determine whether (x,y) coordinates within viewport boundaries
  75. ;
  76. ;Purpose:
  77. ;   Test the (x,y) coordinates in (CX,DX) against the current viewport
  78. ;   boundaries. The carry flag is cleared if either
  79. ;   coordinate was outside the viewport boundary.
  80. ;
  81. ;Entry:
  82. ;   CX=x coordinate DX=y coordinate
  83. ;
  84. ;Exit:
  85. ; carry set if no coords changed, clear if either coord changed
  86. ;
  87. ;Modifies: none
  88. ;
  89. ;****
  90. cProc B$INVIEW,<PUBLIC,NEAR>
  91. cBegin
  92. ;See if x is in VIEW
  93. CMP CX,B$VXMIN ;Is it off the left of the viewport
  94. JL OUTVIEW  ;Yes, out of VIEW
  95. CMP CX,B$VXMAX ;Is it off the right of the viewport
  96. JG OUTVIEW  ;Yes, out of VIEW
  97. CMP DX,B$VYMIN ;Is it off the top of the viewport
  98. JL OUTVIEW  ;Yes, out of VIEW
  99. CMP DX,B$VYMAX ;Is it off the bottom of the viewport
  100. JG OUTVIEW  ;Yes, out of VIEW
  101. STC ;no, is in VIEW
  102. RET
  103. OUTVIEW:
  104. CLC
  105. RET
  106. cEnd nogen
  107. sEnd GR_TEXT 
  108. END