Re: A86: 16-bit cp


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

Re: A86: 16-bit cp




_cphlde does this:

 push hl
 or a
 sbc hl,de
 pop hl
 ret


David Phillips wrote:

> I thought he was just checking if equal.  Does _cphlde set the flags as well?
>
> At 08:55 PM 8/2/98 -0600, you wrote:
> >
> >
> >
> >David Phillips wrote:
> >
> >> It is only 10 t-states faster if the lower bytes are not equal.  If they
> >> are equal, it is 2 t-states slower than SBC.
> >>
> >> cphlde:
> >>         ld a, l ; 4T
> >>         cp e            ; 4T
> >>         ret nz          ; 11T/5T  (5 for fall-through or 1 more than
> normal RET)
> >>         ld a, h ; 4T
> >>         cp d            ; 4T
> >>                         ; -----
> >>         ret             ; 9T or 21T total
> >>
> >> cphlde2:
> >>         and a           ; 4T
> >>         sbc hl,de       ; 15T
> >>                         ; -----
> >>         ret             ; 19T total
> >
> >You said you wanted a routine that sets the same flags as cp.  sbc will
> set the
> >carry / sign flags when de is greater like cp does.
> >
>
> --
> David Phillips
> mailto:electrum@tfs.net
> ICQ: 13811951
> AOL/AIM: electrum32





References: