home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / turbo55 / tp55 / tccompar.asm < prev    next >
Assembly Source File  |  1989-05-02  |  1KB  |  41 lines

  1. ; Turbo Pascal 5.5 object-oriented example
  2. ; Assembler code for TCALC example
  3. ; Copyright (c) 1989 by Borland International, Inc.
  4.  
  5. MODEL TPASCAL
  6.  
  7. LOCALS
  8.  
  9. CODESEG
  10.  
  11.   PUBLIC Compare
  12.  
  13. ; function Compare(var Source, Dest; Len : Word) : Boolean;
  14. ;
  15. ; Compares two areas of memory to see if they are identical.
  16. ;
  17. ; Variables:
  18. ;
  19. ;   Source : Far pointer to the location of the first area of memory.
  20. ;   Dest : Far pointer to the location of the second area of memory.
  21. ;   Len : The amount of memory to be compared in bytes.
  22.  
  23. Proc Compare Source : DWord, Dest : DWord, Len : Word
  24.   push    ds              ; Save DS
  25.   mov     cx,[Len]        ; Move Len to CX
  26.   jcxz    @@0             ; Quit if Len = 0, returning True
  27.   lds     si,[Source]     ; Load source pointer into DS:SI
  28.   les     di,[Dest]       ; Load destination pointer into ES:DI
  29.   cld                     ; Set direction to forward
  30.   repz    cmpsb           ; Compare the two areas
  31.   jz      @@0             ; Return True if the compare was completed
  32.   mov     cl,1            ;
  33. @@0:
  34.   mov     al,cl           ; If CL = 0, return True, otherwise return False
  35.   xor     al,1
  36.   pop     ds              ; Restore DS
  37.   ret
  38. EndP
  39.  
  40. End
  41.