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

Recreate 6502 Bug II



    After you have read my post, "Recreate 6502 Bug", I would like to
provide additional information.  It is what I thought that Z flag was placed
into N flag that showed invalid flag.
    I have studied 65536 BCD records in my database.  I have discovered that
it has nothing to switch between N flag and Z flag since V flag and C flag
are always correct.  $60 and $66 show enabled Z(1) flag while $00 shows
disabled Z(0) flag.  It is the inversion or one complement for Z flag.
    It is the same for N flag.  Between $00 and $5F show enabled N(1) flag
while between $80 and $DF show disabled N(0) flag.  It is also the inversion
or one complement for N flag.
    How do 6502 programmers survive with 6502 bug using BCD?  If they try
this example below.

    CLC
    SED
    LDA    #$20
    ADC    #$FA
    CLD
    EOR    #$80
    BMI    +$03
    STA    2000
    RTS

--and--

    CLC
    SED
    LDA    #$20
    ADC    #$FA
    CLD
    EOR    #$80
    BPL    +$03
    STA    2000
    RTS

    None of both BMI and BPL are working if we want to inverse N flag.  The
result is $80 that will show cleared N flag.  If we replace from #$80 to
#$00 in EOR, both BMI and BPL are working, but N flag is still wrong.
    I am curious how you can experience with 6502 bug.  Tell me how you can
survive using EOR #$80 to inverse N flag and Z flag.

Bryan Parkoff