home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / bootp.zip / BUFCMP.ASM < prev    next >
Assembly Source File  |  1987-05-01  |  1KB  |  84 lines

  1. PAGE    66,132
  2. ;
  3. ;
  4. ;
  5. ;
  6. ;
  7. ;
  8. ;
  9. ;
  10. ;  bufcmp.asm
  11. ;
  12. ;  Efficient compare operation.
  13. ;
  14. ;  Usage :
  15. ;        bufcmp( soff, sseg, doff, dseg, count )
  16. ;        unsigned int soff;        /* source offset */
  17. ;        unsigned int sseg;        /* source segment */
  18. ;        unsigned int doff;        /* destination offset */
  19. ;        unsigned int dseg;        /* destination segment */
  20. ;        unsigned int count;        /* byte count */
  21. ;
  22. ;  (c) 1984 University of Waterloo,
  23. ;           Faculty of Engineering,
  24. ;           Engineering Microcomputer Network Development Office
  25. ;
  26. ;  version
  27. ;
  28. ;    0.1    8-June-1984   B. T. Campbell - handle segment wraps
  29. ;    0.0    01-May-1984   B. T. Campbell 
  30. ;
  31. ;
  32.     include masmdefs.hsm
  33.     include    model.hsm
  34.  
  35. codedef BUFCMP
  36. datadef
  37.  
  38. cstart  BUFCMP
  39. cpublic bufcmp
  40.  
  41.     push    di
  42.     push    si
  43.  
  44.     mov    DX,DS
  45.     mov    BX,ES            ;save segment registers
  46.     mov    AX,+@AB+0[BP]
  47.     mov    CL,4
  48.     shr    AX,CL
  49.     add    AX,+@AB+2[BP]
  50.     mov    DS,AX
  51.     mov    AX,+@AB+0[BP]
  52.     and    AX,0fh
  53.     mov    SI,AX
  54.     mov    AX,+@AB+4[BP]
  55.     mov    CL,4
  56.     shr    AX,CL
  57.     add    AX,+@AB+6[BP]
  58.     mov    ES,AX
  59.     mov    AX,+@AB+4[BP]
  60.     and    AX,0fh
  61.     mov    DI,AX
  62.     mov    CX,@AB+8[BP]        ;byte count
  63.     mov    AX,CX
  64.     pushf
  65.     cld
  66.     rep    cmpsb
  67.     jz    okcmp
  68.     sub    AX,CX
  69.     jmp    nokcmp
  70. okcmp:
  71.     xor    ax,ax
  72. nokcmp:
  73.     popf
  74.     mov    DS,DX
  75.     mov    ES,BX
  76.  
  77.     pop    si
  78.     pop    di
  79.  
  80. creturn bufcmp
  81. cend    BUFCMP
  82.  
  83.         end
  84.