GETCLIP.ASM 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. ;
  2. ; Command & Conquer Red Alert(tm)
  3. ; Copyright 2025 Electronic Arts Inc.
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU General Public License as published by
  7. ; the Free Software Foundation, either version 3 of the License, or
  8. ; (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; GNU General Public License for more details.
  14. ;
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;
  18. ;***************************************************************************
  19. ;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
  20. ;***************************************************************************
  21. ;* *
  22. ;* Project Name : Westwood 32 bit Library *
  23. ;* *
  24. ;* File Name : BITBLIT.ASM *
  25. ;* *
  26. ;* Programmer : Julio R. Jerez *
  27. ;* *
  28. ;* Start Date : Feb 6, 1995 *
  29. ;* *
  30. ;* *
  31. ;*-------------------------------------------------------------------------*
  32. ;* Functions: *
  33. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  34. IDEAL
  35. P386
  36. MODEL USE32 FLAT
  37. LOCALS ??
  38. INCLUDE "mcgaprim.inc"
  39. INCLUDE "gbuffer.inc"
  40. ; typedef struct {
  41. ; int x0 , y0 ;
  42. ; int x1 , y1 ;
  43. ; } CLIP_WIN ;
  44. ; Note for efficiency reasons x1 must be >= x0 and y1 >= y0
  45. ; int get_clip ( CLIP_WIN * window , CLIP_WIN * sorce_rect ) ;
  46. CODESEG
  47. PROC get_clip C near
  48. USES eax , ebx
  49. ;*===================================================================
  50. ;* define the arguements that our function takes.
  51. ;*===================================================================
  52. ARG win : dword
  53. ARG rect : dword
  54. mov edi , [ rect ]
  55. mov esi , [ win ]
  56. xor eax , eax
  57. xor edx , edx
  58. mov ecx , [ (RECTANGLE edi) . x0 ]
  59. mov ebx , [ (RECTANGLE edi) . x1 ]
  60. sub ecx , [ (RECTANGLE esi) . x0 ]
  61. sub ebx , [ (RECTANGLE esi) . x0 ]
  62. shld eax , ecx , 1
  63. shld edx , ebx , 1
  64. ; mov ebx , [ (RECTANGLE esi) . x1 ]
  65. ; inc ebx
  66. ; mov [ rect ] , ebx
  67. mov ecx , [ (RECTANGLE edi) . x0 ]
  68. mov ebx , [ (RECTANGLE edi) . x1 ]
  69. sub ecx , [ (RECTANGLE esi) . x1 ]
  70. sub ebx , [ (RECTANGLE esi) . x1 ]
  71. dec ecx
  72. dec ebx
  73. shld eax , ecx , 1
  74. shld edx , ebx , 1
  75. mov ecx , [ (RECTANGLE edi) . y0 ]
  76. mov ebx , [ (RECTANGLE edi) . y1 ]
  77. sub ecx , [ (RECTANGLE esi) . y0 ]
  78. sub ebx , [ (RECTANGLE esi) . y0 ]
  79. shld eax , ecx , 1
  80. shld edx , ebx , 1
  81. ; mov ebx , [ (RECTANGLE esi) . y1 ]
  82. ; inc ebx
  83. ; mov [ rect ] , ebx
  84. mov ecx , [ (RECTANGLE edi) . y0 ]
  85. mov ebx , [ (RECTANGLE edi) . y1 ]
  86. sub ecx , [ (RECTANGLE esi) . y1 ]
  87. sub ebx , [ (RECTANGLE esi) . y1 ]
  88. dec ecx
  89. dec ebx
  90. shld eax , ecx , 1
  91. shld edx , ebx , 1
  92. xor al , 5
  93. xor dl , 5
  94. mov ah , dl
  95. ret
  96. ENDP get_clip
  97. END