Re: A83: Negative or positive?


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

Re: A83: Negative or positive?




It's 'rla', not 'rra', I made a mistake there.  But this isn't 6502.
Loading the accumulator does NOT affect the flags.  You could do an 'or a'
or an 'and a' which would set the flags based on the value of the
accumulator, but then you'd still have to use an absolute jump, since
relative jumps only have conditionals for the zero and carry flags.  So
you'd use an extra byte, and still have to have the byte to set the flags.
But if you're just checking for negative, then it doesn't matter much.
Especially if you do the load using HL, since that's only one byte for the
load.

If you don't over optimize, you'll never have the most efficient code :)

> 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.




Follow-Ups: References: