home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / UTAMOVE.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-03-31  |  1.2 KB  |  63 lines

  1. ;
  2. ; Name        UTAMOVE -- Copy memory.
  3. ;
  4. ; Synopsis    utamove (source, target, num, direction);
  5. ;
  6. ;        const char far *source
  7. ;                    Where to copy memory from.
  8. ;        char far *target    Where to copy memory to.
  9. ;        unsigned int num    Amount of memory to copy (in bytes).
  10. ;        int direction        MVFORWARD (0) or MVBACKWARD (1)--
  11. ;                      these deal with the direction flag.
  12. ;
  13. ; Description    This function copies memory from any place in memory to
  14. ;        any other place in memory.  This is NOT a smart move
  15. ;        routine; it does not handle overlap gracefully--use
  16. ;        UTMOVMEM for that capability.
  17. ;
  18. ; Returns    Nothing.
  19. ;
  20. ; Version    6.00 (C)Copyright Blaise Computing Inc.  1987,1988,1989
  21.  
  22.     include beginasm.mac
  23.     beginProg utamove
  24.  
  25.     MVFORWARD  equ    0       ; Direction flag settings
  26.     MVBACKWARD equ    1
  27.  
  28. source    equ    dword ptr [bp + stkoff +  0]
  29. target    equ    dword ptr [bp + stkoff +  4]
  30. num    equ    word  ptr [bp + stkoff +  8]
  31. direct    equ    word  ptr [bp + stkoff + 10]
  32.  
  33.     push    bp
  34.     mov    bp, sp
  35.  
  36.     push    ds
  37.     push    es
  38.     push    si
  39.     push    di
  40.  
  41.     lds    si, source
  42.     les    di, target
  43.     mov    cx, num
  44.  
  45.     cld
  46.     cmp    direct, MVFORWARD
  47.     jz    dset
  48.     std
  49.  
  50. dset:
  51.     rep    movsb
  52.  
  53.     cld
  54.     pop    di
  55.     pop    si
  56.     pop    es
  57.     pop    ds
  58.     pop    bp
  59.     ret
  60.  
  61.     endProg utamove
  62.     end
  63.