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

Re: 6502 flag behaviour



In article <334D7DEE.1141@erols.com>, 
Sasha Cimermanis <scim@erols.com> writes...

>I have recently encountered a following piece of code:
> 
>lda $FE
>ora #$08
>bne <somewhere I don't want it to bne>
> 
>From all the sources on 6502 it appears that the Z flag will always be
>reset at the time of BNE, as we do ORA with a non-zero number. But then,
>this fragment of code loses any sense. Does anyone know how Z flag
>behaves
>in such situation?
> 

Well i guess it is to emulate a BRanch Always instruction, which is
missing from the original 6502. Since the programmer knows the Z
flag is clear at that point of the code, BNE emulates BRA.

					Paolo Micossi