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

  1.     page    66,132
  2. ;******************************** STR26.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. ;----------------------------------------------------------------------------
  13.     extrn    strlen1:far
  14. comment 
  15. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING  )
  16. STR_REMOVE - remove all occurances of a character from string.
  17. ;
  18. ; inputs:    DS:[SI] = string address
  19. ;            AL = character to remove from the string
  20. ;            
  21. ; output:    CX = string length
  22. ;* * * * * * * * * * * * * *
  23. 
  24.     PUBLIC    STR_REMOVE
  25. STR_REMOVE    PROC    FAR
  26.     call    strlen1
  27.     APUSH   BX,DX,SI,DI,ES
  28.     CLD
  29.     MOV     DX,CX
  30.     PUSH    DS
  31.     POP     ES
  32.     MOV     DI,SI
  33. srm_lp:    
  34.     REPNZ   SCASB
  35.     JNZ     srm_exit
  36.     DEC     DX
  37.     MOV     SI,DI
  38.     DEC     DI
  39.     MOV     BX,DI
  40.     PUSH    CX
  41.     INC     CX
  42.     REPZ    MOVSB
  43.     POP     CX
  44.     JCXZ    srm_exit
  45.     MOV     DI,BX
  46.     JMP     srm_lp
  47. srm_exit:    
  48.     MOV     CX,DX
  49.     APOP    ES,SI,DI,DX,BX
  50.     RETF
  51. STR_REMOVE    ENDP
  52.  
  53. LIBSEG    ENDS
  54.     end
  55.