CH 2 1
CH 2 1
RCX (count):
RCX addressable as RCX, ECX, CX, CH, or CL,.
It is a general-purpose register that also holds the count for
various instructions.
In the 80386 and above, the ECX register also can hold the offset
address of memory data.
In the 64-bit Pentium 4, RCX can also address memory data.
Instructions that use a count are the repeated string instructions
(REP/REPE/REPNE); and shift, rotate, and LOOP/LOOPD
RDX (data) :
RDX is addressable as RDX, EDX, DX, DH, or DL,.
It is a general-purpose register that holds a part of the result
from a multiplication or part of the dividend before a division.
In the 80386 and above, this register can also address memory
data.
RBP(base pointer) :
RBP is addressable as RBP, EBP, or BP.
It points to a memory location in all versions of the
microprocessor for memory data transfers.
R8 through R15 :
These registers are only found in the Pentium 4 and Core2 if
64-bit extensions are enabled.
Most applications will not use these registers until 64-bit
processors are common.
Legacy software doesn't access R8 through R15.
SPECIAL-PURPOSE REGISTERS
The special-purpose registers include:
RIP,
RSP and
RFLAGS.
RFLAGS :
RFLAGS indicate the condition of the microprocessor and control its
operation.
The 8086–80286 contain a FLAG register (16 bits) and the 80386 and
above contain an EFLAG register (32-bit extended flag register).
The 64-bit RFLAGS contain the EFLAG register, which is unchanged
in the 64-bit version.
RFLAGS
C (carry) :
Carry holds the carry after addition or the borrow after
subtraction.
Sometimes for DOS function calls the carry flag also indicates
error conditions.
P (parity) :
Parity is a logic 0 for odd parity and a logic 1 for even parity.
Parity is the count of ones in a number expressed as even or odd.
A (auxiliary carry) :
The auxiliary carry holds the carry (half-carry) after addition or
the borrow after subtraction between bit positions 3 and 4 of the
result.
Z (zero) :
The zero flag shows that the result of an arithmetic or logic operation
is zero.
If , Z=1, the result is zero; if Z=0 , the result is not zero.
S (sign) :
The sign flag holds the arithmetic sign of the result after an
arithmetic or logic instruction executes.
If S=1, the sign bit (leftmost bit of a number) is set or negative; if
S=0, the sign bit is cleared or positive.
T (trap) :
The trap flag enables trapping through an on-chip debugging feature.
If the T flag is enabled (1), the microprocessor interrupts the flow of
the program on conditions as indicated by the debug registers and
control registers.
If the T flag is a logic 0, the trapping (debugging) feature is disabled.
The Visual C++ debugging tool uses the trap feature and debug
registers to debug faulty software.
I (interrupt) :
The interrupt flag controls the operation of the INTR (interrupt
request) input pin.
If I=1, the INTR pin is enabled; if I=0, the INTR pin is
disabled.
The state of the I flag bit is controlled by the STI (set I flag)
and CLI (clear I flag) instructions.
D (direction) :
The direction flag selects either the increment or decrement
mode.
If D=1, the registers are automatically decremented; if D=0,
the registers are automatically incremented.
The D flag is set with the STD (set direction) and cleared with
the CLD (clear direction) instructions.
O (overflow) :
Overflows occur when signed numbers are added or subtracted.
An overflow indicates that the result has exceeded the capacity
of the machine.
For unsigned operations, the overflow flag is ignored.
RF (resume) :
The resume flag is used with debugging to control the
resumption of execution after the next instruction.
VM (virtual mode) :
The VM flag bit selects virtual mode operation in a protected
mode system.
A virtual mode system allows multiple DOS memory
partitions that are 1M byte in length to coexist in the memory
system.
ID (identification) :
The ID flag indicates that the Pentium–Pentium 4 microprocessors
support the CPUID instruction.
The CPUID instruction provides the system with information about
the Pentium microprocessor, such as its version number and
manufacturer.
SEGMENT REGISTERS
Segment registers include:
CS (Code Segment) ,
DS (Data Segment) ,
ES (Extra Segment) ,
SS (Stack Segment) ,
FS and GS (Supplement Segment Registers)
SS (stack) :
The stack segment defines the area of memory used for the
stack.
The stack entry point is determined by the stack segment and
stack pointer registers.
FS and GS :
The FS and GS segments are supplemental segment registers
available in the 80386–Core2 microprocessors.
They allow two additional memory segments for access by
programs.
REAL MODE MEMORY
ADDRESSING
Real Memory- The first 1M byte of memory(00000H-
FFFFFH)
(Also called Conventional memory, or DOS memory).
FFFFFH
00000H
Real Mode operation- It allows the microprocessor to address
only the first 1M byte of memory space.
Only 8086 and 8088 operate exclusively on real mode.
SEGMENTS AND
OFFSETS
Segments in real mode always have a length of 64K bytes.
Real mode segments can begin only at a 16-byte boundary in
the memory system, known as paragraph.
To access a memory location in real-mode
A program can have more than four segments but can access
only four or six segments at a time.
The figure shows a system that contains four memory segments.
RELOCATION IN SEGMENT AND
OFFSET ADDRESSING SCHEME
This complicated scheme of segment plus offset addressing
allows DOS programs to be relocated in the memory system.
It also allows programs written to function in the real mode
to operate in a protected mode system.
For the 80386 and above, the base address is 00F00000H and
the limit is 000FFH.
THE G-BIT