home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Library / Manuels & Misc / Assembly / AOA.ZIP / CH15 / REPEAT.ASM < prev    next >
Encoding:
Assembly Source File  |  1996-02-25  |  611 b   |  27 lines

  1. ; REPEAT-        Constructs a string of length CX where each element 
  2. ;            is initialized to the character passed in AL.
  3. ;
  4. ; On entry:
  5. ;
  6. ; ES:DI-        Points at the string to be constructed.
  7. ; CX-            Contains the length of the string.
  8. ; AL-            Contains the character with which each element of 
  9. ;            the string is to be initialized.
  10.  
  11. REPEAT        proc    near
  12.         push    di
  13.         push    ax
  14.         push    cx
  15.         pushf            ;Save direction flag value.
  16.         cld
  17.         mov    es:[di], cl    ;Save string length.
  18.         mov    ch, 0        ;Just in case.
  19.         inc    di        ;Start string at next location.
  20.     rep    stosb
  21.         popf
  22.         pop    cx
  23.         pop    ax
  24.         pop    di
  25.         ret
  26. REPEAT        endp
  27.