home *** CD-ROM | disk | FTP | other *** search
/ Groovy Bytes: Behind the Moon / groovybytes.iso / GROOVY / SND_TOOL / FUNK108A.ZIP / DOS32V30.ZIP / PAL / VARIOUS / MEMSET.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-20  |  1.3 KB  |  45 lines

  1. ;*****************************************************************************
  2. ; Filename: MEMSET.ASM
  3. ;   Author: Peter Andersson
  4. ;  Version: 0.2
  5. ;  Created: 1995.03.11
  6. ;  Updated: -
  7. ;*****************************************************************************
  8. ; Copyright Peter Andersson, 1994-1995.
  9. ; All rights reserved.
  10. ;*****************************************************************************
  11. ; Function: VOID @memset(PVOID buf,BYTE char,ULONG length);
  12. ;  Comment: Sets a block of memory to a byte value.
  13. ;    Input: Eax - memory buffer to clear
  14. ;           Dl - character value to fill the buffer with
  15. ;           Ecx - buffer length
  16. ;  Returns: Nothing
  17. ;*****************************************************************************
  18.  
  19.     Include    STDDEF.INC
  20.  
  21.     Codeseg            ; Change memory model in the STDDEF.INC
  22.  
  23. Proc    memset  ,3
  24.                 Push    Edi
  25.         Jecxz    @@End
  26.                 Push    Eax
  27.                 Mov     Al,Dl
  28.                 mov     Ah,al
  29.                 mov     di,ax
  30.                 shl     eax,16
  31.                 mov     ax,di
  32.                 Pop     Edi
  33.                 Mov     Dl,Cl
  34.                 And     Dl,03h
  35.                 Shr     Ecx,2
  36.                 Cld
  37.                 Rep     Stosd
  38.                 Mov     Cl,Dl
  39.                 Rep     Stosb
  40. @@End:        Pop     Edi
  41.                 Ret
  42. Endp
  43.  
  44.     End
  45.