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

  1.     page    66,132
  2. ;******************************** STR25.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_CLEANR - removes trailing blanks from string
  17. ;
  18. ; inputs:    DS:[SI] pointing to string
  19. ; output:    CX = string length
  20. ;* * * * * * * * * * * * * *
  21. 
  22.     PUBLIC    STR_CLEANR
  23. STR_CLEANR    PROC    FAR
  24.     call    strlen1
  25.     apush   ax,di,es
  26.     JCXZ    sclr_exit
  27.     PUSH    DS
  28.     POP     ES
  29.     MOV     DI,SI
  30.     ADD     DI,CX
  31.     DEC     DI
  32.     MOV     AL,20h    ; ' '
  33.     STD
  34.     REPZ    SCASB
  35.     JZ      sclr_cont
  36.     INC     CX
  37. sclr_cont:    
  38.     XOR     AL,AL
  39.     INC     DI
  40.     INC     DI
  41.     STOSB
  42. sclr_exit:
  43.     cld                ;force direction flag at exit    
  44.     apop    es,di,ax
  45.     RETF
  46. STR_CLEANR    ENDP
  47.  
  48. LIBSEG    ENDS
  49.     end
  50.