Re: A85: PUSH and POP


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

Re: A85: PUSH and POP



John Koch wrote:
> 
> Also, I an using a for my pinter in my matrice, sorry I forgot to say
> this earlier!  Well, I xor a or ld a,0 (same thing right?) and then I
> push af so I can load my c which is my y cordinate into a to compare and
> see if the rows need to increase any!  Well, here is what I do
> 
> ld a,0
> push af
> ld a,c
> cp 0
> pop af
> jr z,AddCol
> 
> When I pop af, I don't reset my z terminated thing do I?  If so, this is
> where my bug is!

the problem is that when you pop af, you pop the flag register (f). so
that test for z is from somewhere before the ld a,0 (since ld never
changes flags) 
just a bit of optimization
ld a,0 -> xor a
cp 0   _> or a


References: