Micro-Computer Applications:Number system & 8086 Organization
Dr. Eng. Amr T. Abdel-Hamid
ELECT 707
Fall 2011
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
The Microprocessor Age World’s first microprocessor the Intel 4004. A 4-bit microprocessor-programmable controller
on a chip. Addressed 4096, 4-bit-wide memory locations.
a bit is a binary digit with a value of one or zero4-bit-wide memory location often called a
nibble The 4004 instruction set contained 45 instructions.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Main problems with early microprocessor were speed, word width, and memory size.
Evolution of 4-bit microprocessor ended when Intel released the 4040, an updated 4004. operated at a higher speed; lacked
improvements in word width and memory size Texas Instruments and others also produced 4-bit
microprocessors. still survives in low-end applications such as
microwave ovens and small control systemsCalculators still based on 4-bit BCD (binary-
coded decimal) codes
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Intel released 8008 in 1971.extended 8-bit version of 4004 microprocessor
Addressed expanded memory of 16K bytes.A byte is generally an 8-bit-wide binary number
and a K is 1024. memory size often specified in K bytes
Contained additional instructions, 48 total. Provided opportunity for application in more
advanced systems.engineers developed demanding uses for 8008
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Intel introduced 8080 microprocessor in 1973.first of the modern 8-bit microprocessors
Motorola Corporation introduced MC6800 microprocessor about six months later.
8080—and, to a lesser degree, the MC6800—ushered in the age of the microprocessor.other companies soon introduced their own
versions of the 8-bit microprocessor
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Only Intel and Motorola continue to create new, improved microprocessors.
IBM also produces Motorola-style microprocessors
Motorola sold its microprocessor division.now called Freescale Semiconductors, Inc.
Zilog still manufactures microprocessors. microcontrollers and embedded controllers
instead of general-purpose microprocessors
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
The Modern Microprocessor In 1978 Intel released the 8086; a year or so later,
it released the 8088. Both devices are 16-bit microprocessors.
executed instructions in as little as 400 ns (2.5 millions of instructions per second)
major improvement over execution speed of 8085
8086 & 8088 addressed 1M byte of memory.16 times more memory than the 80851M-byte memory contains 1024K byte-sized
memory locations or 1,048,576 bytes
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Increased memory size and additional instructions in 8086/8088 led to many sophisticated applications.
Improvements to the instruction set included multiply and divide instructions.missing on earlier microprocessors
Number of instructions increased. from 45 on the 4004, to 246 on the 8085over 20,000 variations on the 8086 & 8088
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
These microprocessors are called CISC (complex instruction set computers).additional instructions eased task of developing
efficient and sophisticated applications 16-bit microprocessor also provided more internal
register storage space. Popularity of Intel ensured in 1981 when IBM
chose the 8088 in its personal computer.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
THE MICROPROCESSOR-BASED PERSONAL COMPUTER SYSTEM
Computers have undergone many changes recently. Machines that once filled large areas reduced to
small desktop computer systems becauseof the microprocessor. although compact, they possess computing
power only dreamed of a few years ago
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
The block diagram of a microprocessor-based computer system.
a bus is the set of common connections that carry the same type of information
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
The Microprocessor Called the CPU (central processing unit). The controlling element in a computer system. Controls memory and I/O through connections
called buses.buses select an I/O or memory device, transfer
data between I/O devices or memory and the microprocessor, control I/O and memory systems
Memory and I/O controlled via instructions stored in memory, executed by the microprocessor.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Microprocessor performs three main tasks:data transfer between itself and the memory or
I/O systemssimple arithmetic and logic operationsprogram flow via simple decisions
Power of the microprocessor is capability to execute billions of millions of instructions per second from a program or software (group of instructions) stored in the memory system.stored programs make the microprocessor and
computer system very powerful devices
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Another powerful feature is the ability to make simple decisions based upon numerical facts.a microprocessor can decide if a number is
zero, positive, and so forth These decisions allow the microprocessor to
modify the program flow, so programs appear to think through these simple decisions.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Buses A common group of wires that interconnect
components in a computer system. Transfer address, data, & control information
between microprocessor, memory and I/O. Three buses exist for this transfer of information:
address, data, and control. Figure 1–12 shows how these buses interconnect
various system components.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Figure 1–12 The block diagram of a computer system showing the address, data, and control bus structure.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
The address bus requests a memory location from the memory or an I/O location from the I/O devices. if I/O is addressed, the address bus contains a
16-bit I/O address from 0000H through FFFFH. if memory is addressed, the bus contains a
memory address, varying in width by type ofmicroprocessor.
64-bit extensions to Pentium provide 40 address pins, allowing up to 1T byte of memory to be accessed.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
The data bus transfers information between the microprocessor and its memory and I/O address space.
Data transfers vary in size, from 8 bits wide to 64 bits wide in various Intel microprocessors. 8088 has an 8-bit data bus that transfers 8 bits
of data at a time8086, 80286, 80386SL, 80386SX, and 80386EX
transfer 16 bits of data80386DX, 80486SX, and 80486DX, 32 bits Pentium through Core2 microprocessors transfer
64 bits of data
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Organization of 8088
AH AL
BH BL
CH CL
DH DL
SP
BP
SI
DI
ALU
Flag register
Execution Unit (EU)
EU control
CS
DS
SS
ESALU Data bus (16 bits)
Address bus (20 bits)
Instruction Queue
Bus control
External bus
IP
Data bus(16 bits)
Bus Interface Unit (BIU)
General purpose register
Segment register
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
General Purpose Registers
15 8 7 0
AX
BX
CX
DX
AH AL
BH BL
CH CL
DH DL
Accumulator
Base
Counter
Data
SP
BP
SI
DI
Data Group
Pointer and Index Group
Stack Pointer
Base Pointer
Source Index
Destination Index
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Microprocessors 3-21
Arithmetic Logic Unit (ALU)
n bits n bits
A B
Y
F
Carry
Y= 0 ?
A > B ?
F Y
0 0 0 A + B0 0 1 A - B0 1 0 A - 1
0 1 1 A and B
1 0 0 A or B
1 0 1 not A
Signal F control which function will be conducted by ALU.
Signal F is generated according to the current instruction.
Basic arithmetic operations: addition, subtraction, Basic logic operations: and, or, xor, shifting,
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Flag Register
OFDF IF TF ZFSF AF PF CF 015
Control Flags Status Flags
IF: Interrupt enable flagDF: Direction flagTF: Trap flag
CF: Carry flagPF: Parity flagAF: Auxiliary carry flagZF: Zero flagSF: Sign flagOF: Overflow flag
Flag register contains information reflecting the current status of a microprocessor. It also contains information which controls the operation of the microprocessor.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Instruction Machine Codes Instruction machine codes are binary numbers
For Example:
1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 1 MOV AL, BL
MOV Machine code structure
Opcode Operand1
Opcode tells what operation is to be performed.EU control logic generates ALU control signals according to Opcode)
Some instructions do not have operands, or have only one operand
Operands tell what data should be used in the operation. Operands can
be addresses telling where to get data (or where to store results)
Registermode
Mode Operand2
Mode indicates the type of a instruction: Register type, or Memory type
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
EU Operation1. Fetch an instruction from instruction queue
2. According to the instruction, EU control logic generates control signals.
(This process is also referred to as instruction decoding)
3. Depending on the control signal, EU performs one of the following operations:
An arithmetic operation A logic operation
Storing a datum into a register Moving a datum from a register
Changing flag register
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Registers
A register is a storage element inside a microprocessor.
Almost all operations would involve using registers.
Some registers are general purpose registers, while others have special purposes.General purpose registers can hold various
data sizes and used for almost any purpose as dictated by the program.
However, each general purpose register does have its own special purposes.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Registers
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Registers
Since the x86 instruction set is designed to be compatible with previous microprocessors, the same register can be accessed using different names.Different names are given for 64-bit, 32-bit, 16-bit and 8-bit version of the same register.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
General Purpose Registers
RAX, EAX, AX (AH & AL)A general purpose register Also an accumulator – stores intermediate
results after arithmetic and logic operationsCan also hold the offset address of a location
in memory (80386 and above)RBX, EBX, BX (BH & BL)
A general purpose registerAlso a base index register – holds the offset
address of a location in memoryCan also address memory data (80386 and
above)
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
General Purpose Registers
RCX, ECX, CX (CH & CL)A general purpose registerAlso a count register – holds the count for
various instructionsCan also hold the offset address of a location
in memory (80386 and above)RDX, EDX, DX (DH & DL)
A general purpose registerAlso a data register – stores data related to
accumulator’s calculation (multiply and divide)
Can also address memory data (80386 and above)
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
General Purpose Registers
RBP, EBP, BPA general purpose registerAlso a base pointer register – points to a
memory location for memory data transfer RDI, EDI, DI
A general purpose registerAlso a destination index register – holds the
memory address for the destination data of a string instruction
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
General Purpose Registers
RSI, ESI, SIA general purpose registerAlso a source index register - holds the
memory address for the source data of a string instruction
R8 through R15General purpose registersFound only in 64-bit microprocessorsData are addressed in 64-, 32-, 16-, or 8-bit
sizes
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Special Purpose Registers
RIP, EIP, IP Instruction pointer – points to the next
instruction in the memory to be executed
RSP, ESP, SPStack pointer – points to an area in memory
called the stack
RFLAGS, EFLAGS, FLAGS Indicates the condition of the microprocessor
and control its operation
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Flags
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Flags
The C, P, A, Z, S and O flags are changed by most arithmetic and logic operations.
Flags never change for any data transfer or program control operations.
Some flags are also used to control features found in the microprocessor.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Flags
Descriptions for some of the flag bits:C (carry): holds the carry after addition or
borrow after subtraction.P (parity): the count of 1s in a number
expressed as even or odd.0 for odd, 1 for even.
A (auxiliary carry): holds the half-carry after addition or the borrow after subtraction between bit positions 3 and 4 of the result.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Flags
Z (zero): shows that the result of an arithmetic or logic operation is zero.0 result is not zero, 1 result is zero.
S (sign): holds the arithmetic sign of the result after an arithmetic or logic instruction executes.0 for positive, 1 for negative.
T (trap): enables trapping through an on-chip debugging feature.0 disable trapping, 1 enable trapping. If enabled, allows the microprocessor to interrupt
the flow of the program on conditions indicated by the debug registers and control registers.
Microsoft Visual Studio debugging tool uses this feature.
Dr. A
mr T
alaat
ELECT 707
Micro
-Co
mp
uter A
pp
lication
s
Flags
I (interrupt): control the operation of the INTR (interrupt request) input pin.0 disables INTR pin, 1 enables INTR pin.
D (direction): selects increment or decrement mode for SI/DI registers.0 increment, 1 decrement.
O (overflow): indicates that the result of an addition/subtraction of signed numbers exceeded the capacity of the machine.