home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / mscwattc / elib / qmove.asm < prev    next >
Encoding:
Assembly Source File  |  1992-01-14  |  1.2 KB  |  67 lines

  1. PAGE    66,132
  2. ;
  3. ;
  4. ;
  5. ;
  6. ;
  7. ;
  8. ;
  9. ;
  10. ;  qmove.asm
  11. ;
  12. ;  Efficient move operation.  Does not handle segment wraps!!!!
  13. ;
  14. ;
  15. ;  Usage :
  16. ;        move( soff, sseg, doff, dseg, count )
  17. ;        unsigned int soff;        /* source offset */
  18. ;        unsigned int sseg;        /* source segment */
  19. ;        unsigned int doff;        /* destination offset */
  20. ;        unsigned int dseg;        /* destination segment */
  21. ;        unsigned int count;        /* byte count */
  22. ;
  23. ;  (c) 1984 University of Waterloo,
  24. ;           Faculty of Engineering,
  25. ;           Engineering Microcomputer Network Development Office
  26. ;
  27. ;  version
  28. ;
  29. ;    0.2    31-Oct-1990   E. P. Engelke  - brief version
  30. ;    0.1    8-June-1984   B. T. Campbell - handle segment wraps
  31. ;    0.0    01-May-1984   B. T. Campbell 
  32. ;
  33. ;
  34.     include masmdefs.hsm
  35.     include    model.hsm
  36.  
  37. codedef QMOVE
  38. datadef
  39.  
  40. cstart  QMOVE
  41. cpublic qmove
  42.     push    di
  43.     push    si
  44.     mov    DX,DS
  45.     mov    BX,ES            ;save segment registers
  46.         lds     SI, +@AB+0[BP]
  47.         les     DI, +@AB+4[BP]
  48.         mov     CX, +@AB+8[BP]          ;byte count
  49.  
  50.         shr     CX, 1
  51.         cld
  52.  
  53.         rep     movsw
  54.         jnc     @1
  55.         movsb
  56. @1:
  57.     mov    DS,DX
  58.     mov    ES,BX 
  59.     pop        si
  60.     pop        di
  61. creturn qmove
  62.  
  63. cend    QMOVE
  64.  
  65.         end
  66.  
  67.