home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol131 / cmptxt.src < prev    next >
Encoding:
Text File  |  1984-04-29  |  1.2 KB  |  37 lines

  1. ******************************************************************
  2.  
  3. *                        CMPTXT                                  *
  4.  
  5. *******************************************************************
  6.  
  7.                   NAME CMPTXT
  8.                   ENTRY CMPTXT
  9.  
  10. ;FUNCTION: Compares 2 ASCII strings of any length.
  11. ;The no. of bytes in the tested string must be 
  12. ;transmitted in B.
  13. ;The address of the 1st byte of the teststring in Y.
  14. ; "     "     "  "   "    "   "   " standard in X.
  15. ;Returns w carry=1 if match,else carry=0.
  16.  
  17. CMPTXT:         mov a,0(x)   ;i'th byte of
  18.                              ;standard -->A
  19.                 cmp 0(y)     ;= i'th byte
  20.                              ;of teststring?
  21.                 jrz OK      
  22.                 xra a        ;ifnot,
  23.                 ral          ;0 --> carry
  24.                 ret
  25. OK:             dcr b        ;ifso,bump counter.
  26.                 xra a        ;counter=0?
  27.                 jrz MATCH
  28.                 inx x        ;ifnot
  29.                 inx y        ;bump pointers
  30.                 jmp cmptxt   ;& loop!
  31. MATCH:          stc          ;ifso set carry
  32.                 ret
  33.  
  34.                 END CMPTXT
  35.  
  36. ******************************************************************
  37.