Documentation for the strings module |
(This documentation was generated automatically from the file strings.asm
by asmdoc on Nov 22, 2000.)
This module contains a collection of string routines. The routines
are similar to some of the those in the Standard C strings library.
This module conforms to the conventions described in
Assembly Language Coding Standards.
The subroutines in this module cannot be called from a high-level
language (like C); they can only be invoked from assembler.
To use any of these routines, link strings.o.
These routines have not been tested extensively. Use at your own
risk!
Version: 1.0
Author: Ken Clowes
Summary |
strlen
  Determines the length of a null-terminated string. |
strcpy
  Copies a null-terminated string. |
strrev
  Reverses a string in place. |
strlen
Determines the length of a null-terminated string. If
the string is less than 256 characters in length, the correct
length is returned in Accumulator B and the Carry bit in the
Condition Code register is cleared. Otherwise, the C bit is set.
Since: 1.0
Parameters: Register X -- the starting address of the string
Returns: AccB -- the length of the string (if less than 256
characters).
CC -- Carry bit Set if length > 255; else Cleared
Side effects: none
Examples:
The following shows an elementary use of strlen.
msg: .asciz "Hello world";
....
ldx #msg
jsr strlen ;on return B <-- 11; Carry is clear
bcs tooBig
strcpy
Copies a null-terminated string. The string to be copied is passed
in IX and the address of the destination is IY.
Parameters: IX starting address of source string
IY starting address of destination string
Returns: nothing
Side effects: none
strrev
Reverses a string in place. The IX register points to a null-terminated
string. The same string is reversed in place (not copied). If the
string is more than 255 characters in length, the results are
unpredictable.
Examples:
The string "abcd" will be reversed to the string "dcba".
Parameters: IX--starting address of the string to be reversed
Returns: nothing
Side effects: Condition Code register (CC) modified.
Since: 1.0
Author: Ken Clowes