DS_RSS.ASM 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 : Draw Shape Routines for library. *
  23. ;* *
  24. ;* File Name : DS_RSS.ASM *
  25. ;* *
  26. ;* Programmer : Scott K. Bowen *
  27. ;* *
  28. ;* Start Date : August 24, 1993 *
  29. ;* *
  30. ;* Last Update : June 1, 1994 [BR] *
  31. ;* *
  32. ;*-------------------------------------------------------------------------*
  33. ;* Functions: *
  34. ;* Right_Scale_Skip -- Skips past a scaled row of pixels on right side *
  35. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  36. ;********************* Model & Processor Directives ************************
  37. IDEAL
  38. P386
  39. MODEL USE32 FLAT
  40. ;******************************** Includes *********************************
  41. INCLUDE "shape.inc"
  42. ;********************************* Code ************************************
  43. CODESEG
  44. ;***************************************************************************
  45. ;* Right_Scale_Skip -- Skips past a scaled row of pixels on the right side *
  46. ;* *
  47. ;* INPUT: *
  48. ;* ECX = number of uncompressed bytes to skip *
  49. ;* ESI = shape buffer data address *
  50. ;* *
  51. ;* OUTPUT: *
  52. ;* ESI - updated to the current location in the shape data *
  53. ;* *
  54. ;* WARNINGS: This routine may overrun the number of requested bytes *
  55. ;* if it encounters a run of 0's; however, it's assumed that *
  56. ;* the shape data will never contain a run that goes past the *
  57. ;* right-hand edge of the shape. *
  58. ;* *
  59. ;* HISTORY: *
  60. ;* 04/20/1992 PWG : Created. *
  61. ;* 08/19/1993 SKB : Split drawshp.asm into several modules. *
  62. ;* 06/01/1994 BR : Converted to 32-bit *
  63. ;*=========================================================================*
  64. PROC Right_Scale_Skip NOLANGUAGE NEAR
  65. ;--------------------------------------------------------------------
  66. ; Put shape data address in EDI so we can do a scasb on it
  67. ;--------------------------------------------------------------------
  68. xchg esi,edi ; xchange ESI and EDI
  69. jecxz ??out ; exit if ECX is 0 (no bytes to skip)
  70. ;--------------------------------------------------------------------
  71. ; Search through the string and count down the info we have handled.
  72. ; If we find a run (0 followed by a count byte), then handle it.
  73. ;--------------------------------------------------------------------
  74. ??cliptop:
  75. mov eax,0 ; set al to 0 (we're scanning for 0)
  76. repne scasb ; scan through source data
  77. jz ??on_run ; if it is a run then deal with it
  78. jecxz ??out ; if we're done then get outta here
  79. ;--------------------------------------------------------------------
  80. ; If we have a run then get the next byte which is the length.
  81. ;--------------------------------------------------------------------
  82. ??on_run:
  83. mov al,[BYTE PTR edi] ; get the count of zeros to run
  84. inc edi ; advance past the count
  85. inc ecx ; the 0 found doesn't count
  86. sub ecx,eax ; subtract the count from remaining
  87. jg ??cliptop ; if more bytes left, scan again
  88. ;--------------------------------------------------------------------
  89. ; Put shape address back into ESI, adjust EDI
  90. ;--------------------------------------------------------------------
  91. ??out:
  92. xchg esi,edi ; xchange ESI and EDI
  93. ret ; return back to the real function
  94. ENDP Right_Scale_Skip
  95. END
  96. ;*************************** End of ds_rss.asm *****************************
  97.