A86: Re: _strcat
[Prev][Next][Index][Thread]
A86: Re: _strcat
IIRC, the strings that those routines use are not your traditional C-style
strings (null terminated), but are instead size-prefixed strings. The
includes for the routines are listed below, which should make it clearer for
you. A word (16 bits) is used to store the length of the string, which
prefixes the string. An example of this is shown below also. The source
string should be concatenated onto the destination string, so make sure
there is enough room. If you are used to the parameter order of the C
routine, you can think of it as strcat(de, hl). Length prefixed strings
have the advantage of being faster in some operations and being binary safe,
but suffer from having a fixed maximum size. If your strings are short, you
will waste space by taking up two bytes for the size. If you are going to
be doing a lot of string handling, you might be better off writing your own
routines to handle C-style strings.
_strlen equ 4957h ; bc = length of string (hl)
_strcpy equ 495Bh ; hl->source, de->destination
_strcat equ 495Fh ; hl->source, de->destination
_strcmp equ 4963h ; compare (hl) to (de), length bytes
first
String:
.dw 6
.db "hello!"
> What are the inputs for the _strcat call?
> More specifically, how do I refer to the two strings to be joined?
References: