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

  1.     page    66,132
  2. ;******************************** STR09.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. ILLEGAL_CHAR_CHECK - scan string for illegal characters
  15. ;
  16. ; inputs: ds:si = target string
  17. ;            bx = length of target string
  18. ;         es:di = list of illegal/check characters
  19. ;            dx = length of check list
  20. ;           
  21. ; output: carry set if illegal/check character found.  DS:SI point at match.
  22. ;* * * * * * * * * * * * * *
  23. 
  24.     public    illegal_char_check
  25. ILLEGAL_CHAR_CHECK    PROC    FAR
  26.     or    bx,bx
  27.     jz    sbrk3        ;jmp if no target string
  28.     or    dx,dx
  29.     jz    sbrk3        ;jmp if no check list
  30. sbrk1:    lodsb            ;get char from target string
  31.     mov    cx,dx
  32.     repnz    scasb        ;scan the check list
  33.     jnz    sbrk2        ;jmp if no match found
  34. ;
  35. ; whoops we found on of the dreaded match characters within our string.
  36. ;
  37.     dec    si
  38.     stc
  39.     jmp    icc_exit
  40. ;
  41. ; setup to check next target string char.
  42. ;
  43. sbrk2:    sub    di,dx        ;restart the check char. pointer
  44.     dec    bx        ;count down length of target string
  45.     jnz    sbrk1        ;loop if more characters on target string
  46. sbrk3:    clc
  47.  
  48. icc_exit:
  49.     retf    
  50. ILLEGAL_CHAR_CHECK    ENDP
  51.  
  52. LIBSEG    ENDS
  53.     end
  54.