Skip to main content

Flag Register & Instruction Organization

Flag Register & Instruction Organization
FLAG REGISTER

The Status Flags of the 8080 and 8085 are single bits which indicate the logical conditions that existed as a result of the execution of the instruction just completed. This allows instructions following to act accordingly, such as a branch as a result of two values comparing equal. The flags are:

ZERO FLAG: This flag is set to a 1 by the instruction just ending if the A Register contains a result of all 0’s. Besides the obvious mathematical applications, this is useful in determining equality in a compare operation (a value subtracted from a second value with an answer of 0), or in logical AND or OR operations where the result left the A Register with no bit set to a 1 (the AND was not satisfied). If any bits were left set to a 1 in the A Register, the flag will be reset to a 0 condition.

SIGN FLAG: This flag is set to a 1 by the instruction just ending if the leftmost, or highest order, bit of the A Register is set to a 1. The leftmost bit of a byte in signed arithmetic is the sign bit, and will be 0 if the value in the lower seven bits is positive, and 1 if the value is negative.

PARITY FLAG: This flag is set to a 1 by the instruction just ending if the A Register is left with an even number of bits set on, i.e., in even parity. If the number of bits in the A Register is odd, the bit is left off. This may be useful in I/O operations with serial devices, or anyplace that error checking is to be done.

CARRY FLAG: This flag is set to a 1 by the instruction just ending if a carry out of the leftmost bit occurred during the execution of the instruction. An example would be the addition of two 8-bit numbers whose sum was 9 bits long. The 9th bit would be lost, yielding an erroneous answer if the carry bit was not captured and held by this flag. This flag is also set if a borrow occurred during a subtraction or a compare operation.

AUXILIARY CARRY FLAG: This flag is set to a 1 by the instruction just ending if a carry occurred from bit 3 to bit 4 of the A Register during the instruction’s execution. Because of the relationships of decimal in pure BCD to hexadecimal coding, it is possible to bring BCD values directly into the A Register and perform mathematical operations on them. The result, however, will be as if two hex characters are being processed. If the result must be returned to the program as BCD rather than as hex, the Decimal Adjust Accumulator (DAA) instruction can make that translation; the Auxiliary Carry Flag is provided to assist in this operation.

INSTRUCTION ORGANIZATION

The 8085’s instructions are made up of bytes. In microprocessor parlance, a byte is described as 8 contiguous binary bits treated as a unit. The least significant bit is on the right, and is labeled Bit 0. The most significant bit is on the left, and is Bit 7. Thus, the machine coding is "origin zero", unless noted otherwise. Note also that there is no parity bit, or provision for it, as would be found in larger systems.

The 8085’s instructions are either one, two, or three bytes long. In all cases, the first byte contains the essential information, such as the OP code. The second and third bytes, if included, provide operand information that won’t fit in the first byte.

A close look at the first byte of each instruction will reveal a very great similarity between the 8085’s instruction format and that of the PDP11 system by DEC. In many instances, the description of the instructions in the Intel documentation specifies that certain bits of the first byte (#2,1,0) be designated as the "source" operand, and others (#5,4,3) as the "destination" operand. In this manner, all of the major functional units available to the programmer are encoded into three bits, according to the chart below:

DDD or SSS

Register Name

111

A

000

B

001

C

010

D

011

E

100

H

101

L

Similarly, the registers may be defined as register pairs, and two bits within the first byte may then be used to define these:

RP Bits

Register Pair

00

B-C

01

D-E

10

H-L

11

SP

The similarity between PDP11 and 8085 instruction sets is interesting, but by no means rigid. Many differences exist, primarily due to the difference between the 8- and 16-bit architectures.

Comments

Popular posts from this blog

WINDOWS 8.1 ACTIVATION KEYS

Windows 8 Cracked Keys(Activation/Product Keys) 4NJ8T-3MRPX-HPRB6-9GKWD-Y4FXB J7JBD-2NTPH-HXFHK-3FXFP-TMQG7 VK7JG-NPHTM-C97JM-9MPGT-3V66T NG4HW-VH26C-733KW-K6F98-J8CK4 GNBB8-YVD74-QJHX6-27H4K-8QHDG XCVCF-2NXM9-723PB-MHCB7-2RYQQ HB39N-V9K6F-P436V-KWBTC-Q3R9V 6PN82-R4BBH-XX8K2-DCK84-VMFDH QGR4N-78PMD-KCRQ7-83BXT-YG667 BTNJ7-FFMBR-FF9BH-7QMJ9-H49T7 G9XNM-YYY38-8R9HM-YFPTX-T8XT7 CR8NG-63KCR-X2MPD-G7M7P-GQ4DH NGMMV-FVDXB-QP6XF-9FTRT-P7F9V 7TWWK-WNB2W-VRVPV-XG6RV-MBFDH HN42W-QF3D6-2KM6W-C79XK-JW8XV RFQ3N-4Y4XR-JY9PV-883PR-BY2KV VC972-N7YXW-G9WQY-VBDP4-GXT67 QDCTN-G878G-WBHHQ-GW7XP-XTJXV NBCCB-JJJDX-PKBKJ-KQX8X-WTV3H 2747P-9WNWW-MD6JF-HRC36-HFPKV 2Y8NR-PPTC4-XYX8G-4KQGC-6JCKV 38N79-8B9GY-J4JYJ-D29V3-YBFDH 3FCND-JTWFM-24VQ8-QXTMB-TXT67 GX9N8-4H2FH-D987T-BQ9GK-XKT67 P8MCC-G7NDR-D27YY-Q83CC-8W8XV KKPMN-469HY-H6V43-T8VX2-8W8XV T3NJK-3P683-2T7BJ-2X27F-8B2KV HB39N-V9K6F-P436V-KWBTC-Q3R9V 6PN82-R4BBH-XX8K2-DCK84-VMFDH QGR4N-78PMD-KCRQ7-83BXT-YG667 BTNJ7-FFMBR-FF9BH-7QMJ9-H49T7 G9XNM-YYY38-8R9HM-...