[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recreate 6502 Bug II
- Subject: Re: Recreate 6502 Bug II
- From: "Bryan Parkoff" <spam>
- Date: Wed, 25 Jun 2003 22:14:28 -0500
- Newsgroups: comp.sys.apple2
- References: <uRudndM_6oeJqGSjXTWcqw@texas.net> <3ef946fb$1@news.uow.edu.au>
- Xref: archiver1.google.com comp.sys.apple2:31963
> According to my Rockwell data book, only the ADC instruction is listed
with
> "(4) if in decimal mode, Z flag is invalid. Accumulator must be checked
for
> zero result" but I suspect they left it off the line for SBC.
NMOS 6502 only shows invalid N, V, and Z flags during D flag is enabled
for BCD, but CMOS 65C02 fixed it. It is now showing valid N, V, and Z
flags. One extra cycle is added for BCD only.
>
> The R65C02 does not fix this error according to the same data book.
>
> So the way a 6502 programmer does BCD arithmetic is:
Please explain what you mean that R65C02 does not fix this error
according to the same data book. Do you mean that data book is to be R65C02
data book. I have reviwed, "Understanding the Apple //e" manual that it
does show 6502 and 65C02 datasheet. It did say that 65C02 has fixed BCD
error. Please explain.
>
> CLC
> SED
> LDA #$05
> ADC #$95
> CLD
> CMP #$00 ; additional instruction needed on 6502
> BEQ xxxx
If you claim that 65C02 does not fix BCD error, why Understanding the
Apple //e say that N, V, and Z flags are valid. Suppose #$05 + #$95 is
equal to #$9A for HEX, but #$00 for BCD. It causes that #$9A to enable N
flag and disable Z flag while it causes that #$00 to disable N flag and
enable Z flag. It means that BCD is really using HEX flag instead of BCD
flag for 6502 that it is why N, V, and Z flags are wrong.
What do you think?
Bryan Parkoff
> --
> David Wilson School of IT & CS, Uni of Wollongong, Australia