Re: A83: Negative or positive?


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

Re: A83: Negative or positive?




No, yours is more inefficient, he was just taking care to show how to
check equallity and all, his would be:

  ld a,(Speed)
  jr m,negative
; not negative

You should take care to not try to over optimise your methodology.
Besides rra would modify the value which in this case you obviously need
to negate, and so you would have to reload the value.

David Phillips wrote:
> 
> That's highly inefficient.  The easiest way is to just quickly test the last
> bit:
> 
>  ld a,(Speed)
>  rra
>  jr c,negative
> ; not negative
> 
> > Sorry bout the extremely late post, but can't you just use the sign flag?
> >
> > ld a,(number)
> > cp 50
> > jp z,a_is_fifty
> > jp p,a_is_greater_than_fifty
> > jp m,a_is_less_than_fifty
> >
> > The p stands for plus and the m minus (meaning positive or negative). I
> know
> > all this does is check the 7th bit, but i think it might save a few bytes.

-- 
Scott "_Wrath_" Dial
wrath@calc.org
ICQ#3608935
TimeCity AI Guy II - www.timecity.org
Member of TCPA - tcpa.calc.org


Follow-Ups: References: