Re: A86: ot: string comparison


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

Re: A86: ot: string comparison







>
>>and a routine to compare zero-terminated strings (hl) and (de):
>>
>>cp_zstr:
>> ld a,(de)
>> inc de
>> cpi
>> ret nz
>> or a
>> ret z
>> jr cp_zstr
>>
>>both of these routines set the zero flag if the strings match & reset the
>zero
>>flag the strings do not match
>
>

Yeah, just do this:

 ld hl,string
 ld de,other_string
 push hl
 call cp_zstr
 pop hl


>Hey, Dux, does this routine destroy the hl register?
>Like if I did:
>    ld hl,string
>    push hl
>compare:
>    pop hl
>    ld de,string
>    call cp_zstr
>string:
>    .db "Text",0
>
>Could I push hl and still have it point to "string"?
>Thanks,
>--------------
>Jbrett
>tbarwick@esn.net
>http://ww2.esn.net/~tbarwick
>I just added a TI-86 page, Check it out!!!
>