home *** CD-ROM | disk | FTP | other *** search
- StringLib
- Copyright © 1995 Henrik Tikanvaara
- All rights reserved
-
-
- Introduction
- Legal
- Contact
- Instructions
-
- Library routines
-
-
- NumToStr()
- StrCat()
- StrChr()
- StrCmp()
- StrCpy()
- StrEnd()
- StrFirstNum()
- StrLen()
- StrLFCat()
- StrNCmp()
- StrNumCat()
- StrToNum()
-
-
- Introduction:
- ~~~~~~~~~~~~~
- When coding utilities in assembler, string manipulation is something that
- you inevitably have to deal with. Routines coded to do the job are also
- something, that is needed again and again in new programs. In C, all the
- routines are in a link library, but they are not good for using through
- assembler. StringLib is a link library that has a number of useful routines
- related to string manipulation, and it is designed for use with assembler.
-
- Legal:
- ~~~~~~
- You are allowed to use StringLib in non-commercial productions.
- Redistribution is only allowed if all the files are included in their
- unmodified, original form.
-
- Instructions:
- ~~~~~~~~~~~~~
- To use StringLib, include "StringLib.I" in the beginning of your program.
- Then, after compiling your own code, link it with "StringLib.LIB". To be
- able to utilize StringLib, you must use an assembler which produces objects
- instead of executables. Some examples are PhxAss, SNMA and A68K. You must
- also have a linker such as BLink, SLink or PhxLnk. There are two versions
- of the library, one for 68000 and up and another for 68020 and up. Some of
- the 68020 routines are a bit more compact and faster.
-
- Contact Address:
- ~~~~~~~~~~~~~~~~
- If you have good routines to include with this library, or ideas for
- improvement, or if you happen to find bugs, please contact me.
-
- Henrik Tikanvaara
- Tikasrinne 3A
- 02200 Espoo
- Finland
-
- Internet:
- tetsuo@brahman.nullnet.fi
-
-
- --- NumToStr()
- Convert an integer to string.
-
- Arguments:
- A0 Pointer to space for the converted ASCII number. (11 bytes)
- D0 32 bit unsigned number to convert.
-
- Returns:
- A0 Pointer to the start of the ASCII number string.
- D0 Length of the string.
-
- A1 and D1 will be trashed, all other registers are preserved. The ASCII
- number is placed in the end of the buffer, remaining bytes are set to ' '
- ($20). For a more friendly routine, use StrNumCat().
-
-
- --- StrCat()
- Add a string in the end of another string.
-
- Arguments:
- A0 Pointer to the destination string.
- A1 Pointer to the source string.
-
- D0 is trashed.
-
-
- --- StrChr()
- Finds the first address for a byte in a string.
-
- Arguments:
- A0 Pointer to the string.
- D0 The byte which location to find.
-
- Returns:
- D0 Pointer to the equal byte in the string, or 0 if byte was not found.
-
-
- --- StrCmp()
- Compare two strings.
-
- Arguments:
- A0 Pointer to first string.
- A1 Pointer to second string.
-
- Returns:
- D0 0 if strings are equal, non-zero otherwise.
-
-
- --- StrCpy()
- Copy a string.
-
- Arguments:
- A0 Pointer to the destination space.
- A1 Pointer to the string to copy.
-
-
- --- StrEnd()
- Find the end and length of a string.
-
- Arguments:
- A0 Pointer to string.
-
- Returns:
- A0 Pointer to the null end byte of the string.
- D0 Length of the string.
-
-
- --- StrFirstNum()
- Find the first number ("0"-"9") in a string.
-
- Arguments:
- A0 Pointer to the string.
-
- Returns:
- D0 The address where the first byte was found, or 0 if not.
-
-
- --- StrLen()
- Find the length of a string.
-
- Arguments:
- A0 Pointer to the string.
-
- Returns:
- D0 The length of the string.
-
-
- --- StrLFCat()
- Adds a line-feed in the end of a string.
-
- Arguments:
- A0 Pointer to the string to which add the line-feed.
-
- Returns:
- A0 Pointer to the string null byte.
-
-
- --- StrNCmp()
- Compare two strings at certain length.
-
- Arguments:
- A0 Pointer to first string.
- A1 Pointer to second string.
- D0 The length at which to compare the strings.
-
- Returns:
- D0 0 if the strings are equal at the specified length, non-zero otherwise.
-
-
- --- StrNumCat()
- Adds a number in the end of a string.
-
- Arguments:
- A0 Pointer to the string.
- D0 The unsigned 32-bit number to add.
-
-
- --- StrToNum()
- Convert a string to a number.
-
- Arguments:
- A0 Pointer to the number string which to convert. Must be between 0-99999.
-
- Returns:
- D0 The value of the number.
-