[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wanted:info on IIe extension
- Subject: Re: wanted:info on IIe extension
- From: dempson@actrix.gen.nz (David Empson)
- Date: Fri, 23 Sep 1994 15:40:15 GMT
- Newsgroups: comp.sys.apple2
- Organization: Actrix Information Exchange
- References: <35l48j$gdj@maxwell5.ee> <35leuq$9p2@gap.cco.caltech.edu> <CwF5LL.82s@actrix.gen.nz> <35nq0m$8nu@zircon.cs.uow.edu.au>
In article <35nq0m$8nu@zircon.cs.uow.edu.au>,
David E A Wilson <david@zircon.cs.uow.edu.au> wrote:
> dempson@actrix.gen.nz (David Empson) writes:
> >3. Decimal mode implements the N, V and Z flags, at the expense of one
> >additional clock cycle for each ADC/SBC in decimal mode.
>
> Does anyone have a Rockwell R65C02 in their computer? According to
> the Rockwell data book I have, the R65C02 only fixes the N flag - the
> Z flag is still invalid after an ADC or SBC in decimal mode. This
> would be easy to check:
That can't be right - I was reading from the Rockwell data book when I
wrote that!
On page 1-10 of the 1987 Rockwell "Controller Products" Data Book, it
lists the 65C02 enhancements, including:
Decimal Flag NMOS R6502: Invalid N, V and Z flags
CMOS R65C00 family: Valid flags adds 1 additional cycle.
I notice that the instruction listing has a note saying that Z is
invalid after a decimal ADC/SBC. I suspect this is an error, probably
left over from the 6502 data sheet (which says Z is invalid, and
doesn't even mention that N and V are also invalid).
Checking other sources, "Programming the 65816" by Eyes & Lichty says
all three flags work in decimal mode on the 65C02.
The NCR65C02 data sheet in the IIe reference manual has a table which
is suspiciously similar to the Rockwell one. Who copied who? I can't
see anything in the opcode table about Z being invalid.
Your example code is interesting - it is very similar to part of the
routine given in Eyes & Lichty to test for which processor you have.
To identify a 6502, you can verify that the N flag is not affected in
decimal mode by doing:
SED
LDA #$99
CLC
ADC #$01
CLD
BMI IS_6502 ; 6502 doesn't set N flag for decimal mode add
You could also test the Z flag in this case (BNE IS_6502).
Testing for a 65C02 relies on the 65802/65816 "XCE" instruction being
treated as a NOP by the 65C02. This should only be done AFTER
verifying that you don't have a 6502, since the XCE opcode might do
something weird on a 6502.
--
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand