FFIRST.ASM 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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 S T U D I O S **
  20. ;***************************************************************************
  21. ;* *
  22. ;* Project Name : First First *
  23. ;* *
  24. ;* File Name : FFIRST.ASM *
  25. ;* *
  26. ;* Programmer : Jeff Wilson *
  27. ;* *
  28. ;* Start Date : March 28, 1994 *
  29. ;* *
  30. ;* Last Update : April 15, 1994 [] *
  31. ;* *
  32. ;*-------------------------------------------------------------------------*
  33. ;* Functions: *
  34. ;* Find_First -- Find a file spec *
  35. ;* Find_Next -- Find next file in sreach params *
  36. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  37. IDEAL
  38. P386
  39. MODEL USE32 FLAT
  40. LOCALS ??
  41. GLOBAL Find_First :NEAR
  42. GLOBAL Find_Next :NEAR
  43. ;============================================================================
  44. CODESEG
  45. ;***************************************************************************
  46. ;* FIND_FIRST -- Find a file spec *
  47. ;* *
  48. ;* *
  49. ;* *
  50. ;* INPUT: *
  51. ;* file_name File spec to find. Maybe a wildcard name *
  52. ;* mode File type *
  53. ;* ffblk file data block ptr to write info into *
  54. ;* *
  55. ;* *
  56. ;* OUTPUT: *
  57. ;* *
  58. ;* WARNINGS: *
  59. ;* *
  60. ;* HISTORY: *
  61. ;* 04/15/1994 jaw: Created. *
  62. ;*=========================================================================*
  63. PROC Find_First C near
  64. USES ebx,ecx,edx,esi,edi,es,ds
  65. ARG file_name:DWORD,mode:WORD,ffblk:DWORD
  66. mov edx,[file_name]
  67. mov cx,[mode]
  68. mov eax,4e00h ;first firstg function
  69. int 21h
  70. ;Find it?
  71. jnc ??found_it ;=>yes
  72. ; ax holds the error code
  73. ;insure high word of eax is clear
  74. or eax,0ffffffffh
  75. jmp ??exit
  76. ??found_it:
  77. ; found something
  78. ;copy the DTA into the user block
  79. mov eax,2f00h ;get DTA address
  80. int 21h
  81. mov ax,es ;switch selectors
  82. mov dx,ds
  83. mov ds,ax
  84. mov es,dx
  85. mov esi,ebx
  86. mov edi,[ffblk]
  87. add esi,21 ;SKIP RESERVED
  88. add edi,4 ;SKIP RESERVED
  89. sub eax,eax
  90. mov al,[esi] ;get attrib byte
  91. mov [es:edi+4],eax
  92. inc esi
  93. ;get time
  94. mov ax,[esi]
  95. add esi,2
  96. mov [es:edi+8],ax
  97. ;get date
  98. mov ax,[esi]
  99. add esi,2
  100. mov [es:edi+10],ax
  101. ;get file size
  102. mov eax,[esi]
  103. add esi,4
  104. mov [es:edi],eax
  105. add edi,12
  106. mov ecx,13
  107. rep movsb ;copy the DTA name
  108. mov ax,es
  109. mov ds,ax
  110. xor eax,eax
  111. ??exit:
  112. ret
  113. ;====================
  114. ENDP Find_First
  115. ;***************************************************************************
  116. ;* FIND_NEXT -- Find next file in sreach params *
  117. ;* *
  118. ;* *
  119. ;* *
  120. ;* INPUT: *
  121. ;* NONE *
  122. ;* OUTPUT: *
  123. ;* *
  124. ;* WARNINGS: *
  125. ;* *
  126. ;* HISTORY: *
  127. ;* 04/15/1994 jaw: Created. *
  128. ;*=========================================================================*
  129. PROC Find_Next C near
  130. USES ebx,ecx,edx,esi,edi,ds,es
  131. ARG ffblk:DWORD
  132. mov eax,04f00h ;Find Next function
  133. int 21h
  134. ;Find anything?
  135. jnc ??found_it ;=>no
  136. ; ax holds the error code
  137. ;insure high word of eax is clear
  138. or eax,0ffffffffh
  139. jmp ??exit
  140. ??found_it:
  141. ; found something
  142. ;copy the DTA into the user block
  143. mov eax,2f00h ;get DTA address
  144. int 21h
  145. mov ax,es ;switch selectors
  146. mov dx,ds
  147. mov ds,ax
  148. mov es,dx
  149. mov esi,ebx
  150. mov edi,[ffblk]
  151. add esi,21 ;SKIP RESERVED
  152. add edi,4 ;SKIP RESERVED
  153. sub eax,eax
  154. mov al,[esi] ;get attrib byte
  155. mov [es:edi+4],eax
  156. inc esi
  157. ;get time
  158. mov ax,[esi]
  159. add esi,2
  160. mov [es:edi+8],ax
  161. ;get date
  162. mov ax,[esi]
  163. add esi,2
  164. mov [es:edi+10],ax
  165. ;get file size
  166. mov eax,[esi]
  167. add esi,4
  168. mov [es:edi],eax
  169. add edi,12
  170. mov ecx,13
  171. rep movsb ;copy the DTA name
  172. mov ax,es
  173. mov ds,ax
  174. xor eax,eax
  175. ??exit:
  176. ret
  177. ENDP Find_Next
  178. END
  179. 
  180. 
  181. 
  182.