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

Re: Opcode Instruction Question



Bryan Parkoff <BParkoff@satx.rr.com> wrote:

>     I think that the word Program Status and Processor Status can be
> confusing to us.

I assume you are talking about the equivalent of the P register on the
65xxx family.

Many microprocessor manufacturers use slightly different names and
abbreviations for this register.  The most common names I've encountered
are "processor status register" (P), "condition code register" (CCR),
"status register" (SR) or just "Flags".

>     How many flags and 8/16/32 bits in Processor Status do Intel, 68K,
> PowerPC, Z80, 8080, other microprocessors have?

I can't see how this information is particularly useful.  As I've noted
in earlier posts, the organisation of control and status bits can vary
widely between microprocessors, and may be spread over multiple
registers.

About the only thing they have in common is that the nominal "status
register" is the one which contains the status of the last arithmetic
operation (N, Z, V and C flags), and this register is usually saved on
the stack during an interrupt.


I don't have detailed information on the Intel 8088/8086 and
derivatives.  All I can tell you without doing some research is that the
8086 and 8088 have a 16-bit register called "flags", which is logically
broken up into two 8-bit registers referred to as FLAGS_h and FLAGS_l
(high and low bytes).


The 68000 has a 16-bit "status register", which is split into a "user
byte" (also known as the "condition code register") and a "system byte".
Five bits are used in the CCR and five are used in the system byte.

The flags in the CCR are X, N, Z, V and C.  X is the "extend" flag.

The flags in the system byte are trace enable, Supervisor/User state and
interrupt priority mask (3 bits).

The 68020 adds two more bits in the system byte: a second trace bit, and
a master interrupt enable.


I haven't looked into the PowerPC in detail, and don't have any
reference books handy.  It may use a completely different concept for
storing the status of the last arithmetic operation.


The 8080 has an 8-bit flags register, of which 5 bits are used.  I don't
have details handy, but I believe they are S (sign), Z, H (half carry),
P (parity/overflow), and C (carry).

The Z80 is an enhanced version of the 8080.  It also has an 8 bit flag
register, of which 6 bits are used.  The extra flag indicates whether
the last operation was a subtraction (used for a decimal adjust
operation).


The 6800/6801/6803/6301/6303 has an 8-bit "condition code register", of
which 6 bits are used: H (half carry), I (interrupt mask), N (negative),
Z (zero), V (overflow) and C (carry).

The 6809 is like the 6800 but adds two more flags: E (entire) and F
(fast interrupt mask)

The 68HC11 is also like the 6800 with two more flags, but they differ
from the 6809: S (stop disable) and X (XIRQ interrupt mask).


Some 6805 variants have a two bit flag register (C and Z flags) which
cannot be accessed as a whole, with a  second register which is used to
store the flag register during an interrupt.  Other 6805 variants have
an 8-bit CCR like the 6800, omitting the overflow flag.


That's exhausted my collection of data books.
-- 
David Empson
dempson@actrix.gen.nz