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

  1.     page    66,132
  2. ;******************************** STR24.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_CLEANL - remove leading blanks from an ASCIIZ string
  17. ;
  18. ; inputs:    DS:[SI] pointing to string
  19. ; output:    CX = string length
  20. ;* * * * * * * * * * * * * *
  21. 
  22.     PUBLIC    STR_CLEANL
  23. STR_CLEANL    PROC    FAR
  24.     APUSH   AX,BX,DI,SI
  25.     CLD
  26.     PUSH    ES
  27.     CALL    strlen1
  28.     PUSH    DS
  29.     POP     ES
  30.     MOV     DI,SI
  31. ;;  MOV     SI,BX
  32.     MOV     BX,CX
  33.     JCXZ    scr_exit
  34.     MOV     AL,20h    ; ' '
  35.     REPZ    SCASB
  36.     JZ      scr_exit
  37.     INC     CX
  38.     MOV     BX,CX
  39.     DEC     DI
  40.     XCHG    SI,DI
  41.     INC     CX
  42.     REPZ    MOVSB
  43. scr_exit:    
  44.     MOV     CX,BX
  45.     POP     ES
  46.     APOP    SI,DI,BX,AX
  47.     RETF
  48. STR_CLEANL    ENDP
  49.  
  50. LIBSEG    ENDS
  51.     end
  52.