[A83] Re: Getting and comparing string inputs


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

[A83] Re: Getting and comparing string inputs



strcmp:
  ;input:
  ;  hl -> first z-string
  ;  de -> second z-string
  ;output:
  ;  zero flag indicates equality
  ld a,(de)
  sub (hl)
  ret nz
  cp (hl)
  ret z
  inc hl
  inc de
  jr strcmp


In a message dated 6/17/2001 11:41:30 AM Eastern Daylight Time, 
michael257257@yahoo.com writes:


> ;HL - string 1
> ;DE - string 2
> ;B - number of bytes to compare
> compareloop:
>         ld c,(hl)
>         ld a,(de)
>         cp c
>         jr nz,comparefailed
>         inc hl
>         inc de
>         djnz compareloop
>         ;code here if it passed
> comparefailed:
>         




----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org