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

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