home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 422_01 / libcf / string1.asm < prev    next >
Encoding:
Assembly Source File  |  1994-03-27  |  516 b   |  23 lines

  1. *
  2. * Concatinate one string to another: strcat(dest, source)
  3. *
  4. strcat    LDI    4,S        Get dest ptr
  5. ?1    LDB    I        Get byte from index
  6.     JZ    ?2        End of string, copy
  7.     LEAI    1,I        Advance pointer
  8.     SJMP    ?1        And proceed
  9. ?2    STI    4,S        Resave pointer
  10. *
  11. * Copy strings: strcpy(dest, source)
  12. *
  13. strcpy    LDI    2,S        Get source ptr
  14.     LDB    I        Get byte from source
  15.     LEAI    1,I        Advance source ptr
  16.     STI    2,S        Resave
  17.     LDI    4,S        Get dest ptr
  18.     STB    I        Write to dest
  19.     LEAI    1,I        Advance dest ptr
  20.     STI    4,S        Resave
  21.     SJNZ    strcpy        Do them all
  22.     RET
  23.