Re: A86: Re: _strcat


[Prev][Next][Index][Thread]

Re: A86: Re: _strcat




It's not all that consistent.

_strlen, _strcpy, and _strcat use zero-terminated (c-style/asciiz)
strings.
_strcmp uses strings with a preceding length byte.

input to _strcat:
first string is at (de)
second string is at (hl)
The second string will be copied (using _strcpy) onto the end of the
first string.

there are some rom calls that use strings with a length word (mostly for
use with string variables) and some that take a plain string (no length,
no terminating 0) and a length in a register.

string formats:
        .db "asciiz",0
        .db 11,"byte-length"
        .dw 11        ; <----- note the w
        .db "word-length"


full example of _strcat:
        ld de,first_string
        ld hl,second_string
        call _strcat
...
; meanwhile, later in the code
first_string:
        .db "_str",0
        .db 0,0,0,0,0,0 ; make sure there's room for the rest
second_string:
        .db "cat",0

After the call to _strcat, first_string will be "_strcat",0 and
second_string will still be "cat",0

-josh


On Fri, 15 Dec 2000 20:20:42 -0700 "David Phillips" <david@acz.org>
writes:
> 
> IIRC, the strings that those routines use are not your traditional 
> C-style
> strings (null terminated), but are instead size-prefixed 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?
> 
> 
> 
> 
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.