Re: A85: Complement the Z flag?
[Prev][Next][Index][Thread]
Re: A85: Complement the Z flag?
Dines Justesen wrote:
>
> >push af
> >ex (sp),hl ; to preserve HL
>
> pop hl would be faster, so unlees you need īthe value in hl replace this.
> (or use pop de/pop bc)
>
> >ld a,%01000000 ; Z flag is the 6th bit in the F register
> >xor l ; L = previous F register
>
> Changing this to xor %01000000 would be faster (Saves one M cycle and 1
> byte)
You can't do xor l,%01000000. There is only one parameter for xor, and
that is the value or register xor'ed with the acc, and the result is
stored in the acc. Or did you mean
this?
ld a,l
xor %01000000
i can't see how that saves a byte...
> >ld l,a
> >ex (sp),hl
>
> This would be replaced by push hl.
>
> >pop af ; 8 bytes
> I can not see why you need to complement the zero flag (but you probably do
> :) ), couldnt you just replace jr z with jr nz ?
>
> Dines
He is using the zero flag as an error flag on the return from a routine.
Let's say that
at one place in his routine, the zero flag would be RESET if there were
an error. How does he fix this? He needs to do a
czf
ret z
Of course there is no czf, which is why he asked :)
I think that it may be easier just to set the cf than to use Yarin's
routine, although it really depends on the situation.
--
Terry Peng <tpeng@geocities.com>
References: