Re: A86: ot: string comparison


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

Re: A86: ot: string comparison






Stephen Horne wrote:

> >> _strlen equ 4957h  ;bc = length of string (hl)
> >These routines are all for strings with a two byte length header; here's a
> >routine to compare strings preceded by a single length byte (hl) and (de):
>
> Wouldn't that be redundant though? (I'd rather use a rom based routine to
> count up string length than my own)

but you can't use it if it doesn't do what you want

>
>
> _________________________________________________
> Stephen Horne -- HorneS@rpi.edu -- www.wickedquality.com
>
> :q :q! :wq :w :w! :wq! :quit :quit! :help help helpquit quit quithelp
> :quitplease :quitnow :leave ^X^C ^C ^D ^Z ^Q QUITDAMMIT
> _________________________________________________
> -----Original Message-----
> From: assets <assets@eden.rutgers.edu>
> To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
> Date: Thursday, September 10, 1998 6:20 PM
> Subject: Re: A86: ot: string comparison
>
> >
> >
> >
> >Jeremy Goetsch wrote:
> >
> >> Here are some string routines in the ROM:
> >>
> >> _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
> >
> >These routines are all for strings with a two byte length header; here's a
> >routine to compare strings preceded by a single length byte (hl) and (de):
> >
> >cp_lstr:
> > ld a,(de)
> > ld c,a
> > sub (hl)
> > ret nz
> > ld b,a
> > inc de
> > inc hl
> >cp_ls_loop:
> > ld a,(de)
> > inc de
> > cpi
> > ret nz
> > ret po
> > jr cp_ls_loop
> >
> >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
> >
> >>
> >>
> >>   Jeremy G.
> >>
> >> >
> >> > (This question might belong to shell-developers, but I'll check here
> >> > first)...
> >> >
> >> > Hey, I've started developing a new shell (Linux86, looks pretty nifty
> so
> >> > far), but as most people should know linux, it's mostly string
> >> > comparisons.
> >> >  Does anyone just "happen" to have any string comparison ruteins (in
> asm)
> >> > that might be lying around?  Any help would be greatly appreciated!
> >> >
> >> >
> >> > -Chuck
> >> > chuckjr@sundial.net
> >> >
> >
> >
> >
> >




References: