home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / STR29.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  971b  |  42 lines

  1.     page    66,132
  2. ;******************************** STR29.ASM  *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. comment 
  13. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING  )
  14. STR_SWAP - swaps portions of two strings
  15. ;
  16. ; inputs:    DS:[SI] points to string1
  17. ;            ES:[DI] points to string2
  18. ;            CX = number of bytes to swap
  19. ;            
  20. ; output:    nothing
  21. ;* * * * * * * * * * * * * *
  22. 
  23.     PUBLIC    STR_SWAP
  24. STR_SWAP    PROC    FAR
  25.     CLD
  26.     APUSH   AX,CX,DI,SI
  27.     cld
  28.     jcxz    ssw_exit        ;jmp if null swap
  29. ssw_lp:
  30.     lodsb
  31.     xchg    byte ptr es:[di],al
  32.     mov     byte ptr ds:[si-1],al
  33.     inc     di
  34.     loop    ssw_lp
  35. ssw_exit:    
  36.     APOP    SI,DI,CX,AX
  37.     RETF
  38. STR_SWAP    ENDP
  39.  
  40. LIBSEG    ENDS
  41.     end
  42.