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

Re: Recreate 6502 Bug II



Mark,

    It is the way to put legal and illegal results from Accumulator and
Value through ADC and SBC.  Accumulator ranges from $00 to $FF.  Value
ranges from $00 to $FF.  Only result shows the range between $00 and $5F and
$80 and $DF.  It is why I created two loops to capture into 65536 records.

Bryan Parkoff

"Mark Cummings" <NOTfigjams@primus.com.au> wrote in message
3ef986d3_1@news.iprimus.com.au">news:3ef986d3_1@news.iprimus.com.au...
> "Bryan Parkoff" <spam> wrote in message
> uRudndM_6oeJqGSjXTWcqw@texas.net">news:uRudndM_6oeJqGSjXTWcqw@texas.net...
> >     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
>
> hi Bryan,
>
> I am certainly no expert with BCD, but I have used it on at least one
> occasion on a Z80 based countdown timer I wrote for my Sprinkler
Controller.
> Why would you be adding an illegal BCD value of $FA to a valid BCD value
of
> $20. I don't think anything over $0-$9 should be used for each digit.
>
> Mark
>
>