Professional Documents
Culture Documents
8086
8086
| |
| |
The address refers to a byte in memory. In the 8088, these bytes come in on
the 8-bit data bus. In the 8086, bytes at even addresses come in on the low
half of the data bus (bits 0-7) and bytes at odd addresses come in on the upper
half of the data bus (bits 8-15).
The 8086 can read a 16-bit word at an even address in one operation and at an
odd address in two operations. The 8088 needs two operations in either case.
4
4
V
4
4 4
4 a
a
4
| |
The 8086 has two parts, the Bus Interface Unit (BIU) and the
Execution Unit (EU).
The BIU fetches instructions, reads and writes data, and computes the
20-bit address.
The EU decodes and executes the instructions using the 16-bit ALU.
The BIU fetches instructions using the CS and IP, written CS:IP, to contract
the 20-bit address. Data is fetched using a segment register (usually the DS)
and an effective address (EA) computed by the EU depending on the
addressing mode.
The EU contains the following 16-bit registers:
AX - the Accumulator
BX - the Base Register
CX - the Count Register
DX - the Data Register
SP - the Stack Pointer \ defaults to stack segment
BP - the Base Pointer /
SI - the Source Index Register
DI - the Destination Register
The AX, BX, CX, and DX registers can be considers as two 8-bit registers, a
High byte and a Low byte. This allows byte operations and compatibility with
the previous generation of 8-bit processors, the 8080 and 8085. 8085 source
code could be translated in 8086 code and assembled. The 8-bit registers are:
AX --> AH,AL
BX --> BH,BL
CX --> CH,CL
DX --> DH,DL
| | !
ES Extra Segment
BIU registers
(20 bit adder) CS Code Segment
SS Stack Segment
DS Data Segment
IP Instruction Pointer
EU registers AX AH AL Accumulator
BX BH BL Base Register
CX CH CL Count Register
DX DH DL Data Register
SP Stack Pointer
BP Base Pointer
SI Source Index Register
DI Destination Index Register
FLAGS
| |||
#
) (
* ( +, %% !
*
) -
% %!
) .
*
) -
%
!
) $!$$/$$$
) +$++0+
) 01$00
* $
) 2 %
) 3 0&+
#45$
* 0
%
6 | || ||
('
)
*
* ,
* ,%
)
*
* ,!
7
*
03
+ 01(
| "
0
/
|
.
| " *-
-
*-
,
+ | "
*
'
&
V
§
/1 !
) 0% !
%
?
@
?
) 4
% !'%%
) +
%! .
% %%
)
%
.#'.|A
.#
B .|A
?|
* 111
2 3 4 &&
*|" + 5
4000H
CS: 0400H
IP 0056H 4056H
CS:IP = 400:56
Logical Address
?emory
0400 0
Segment Register
Offset + 0056
Physical or 04056H
0FFFFFH
Absolute Address
The offset is the distance in bytes from the start of the segment.
The offset is given by the IP for the Code Segment.
Instructions are always fetched with using the CS register.
05C00H
DS: 05C0
05C50H
SI 0050 DS:EA
?emory
05C0 0
Segment Register
Offset + 0050
0A00 0A000H
SS:
0A100H
SP 0100 SS:SP
?emory
0A00 0
Segment Register
Offset + 0100
0FFFFFH
Physical Address 0A100H
%
37%
+ %
0
1
%
C
%
$
>
%
)
%
'
* !
% ! "D
7
%"
)
%
'
* ,
! %&+,"%
7!% "
; 0 < a §
'
1 '- ', '+ '* '' / | . - , + * '
!
%! %
"
) 3#7%
0 7%
%
%! !"
) #0
%%
!7! "
) 0# 0 1
"
) # +! %
!"
) $#
%
!
E 7
) C#;0
%
! ! ;"
E
) # 1
%
>.%
; !"
) +# 0 !%
%! "
§
;= §:'
;= :§
+ +( | 9| #
> <3
- §#
;= §:? * @
;= §:?@
;= 0 :,
;= §:? * 60 @
) 0a" * ,
+ +( | 9| #
> <3
- 9
;= : *
;= 0 :,
;= §:?60 @
) 0a" * ,
+ +( | 9| #
> <3
-
;= 0 : * ,
;= :?0 @
;= §:?@
;= :?0 @
;= §:?@
K
The following signals now come from the 8288: ALE, DT/R¶, DE, and ITA¶.
The advanced commands become active earlier in the cycle to give devices
an earlier indication of a write operation.
IV-1
| |9
When in the maximum mode, the 8086/8088 has 3 status lines that are
connected to the 8288 and provide it with the information it needs to
generate the system bus signals. The information provided by the status
bits is as follows.
IV-2
0 § ( 0§
D?A allows data to go between memory and a peripheral, such as a disk
drive, without going through the cpu.
The D?A controller takes over the address bus, data bus, and control bus.
The 8237A D?A Controller is a commonly used device and is in the IB? PC.
Figure 11-4 is a simplified block diagram showing the use of a D?A controller.
For example, to read a disk file the following operations occur.
IV-4
Terminology
Volatile - data is lost when power is turned off.
onvolatile - retains data when powered off.
Random Access - all data locations accessed in the same amount of time.
Sequential Access - data accessed in varying amounts of time, e.g., tape.
Examples
VOLATILE OVOLATILE
Static RA? RO?, PRO?, EPRO?, EEPRO?, FLASH
Dynamic RA? Disk, tape
?agnetic core, magnetic bubble
IV-6
&| | '' §
| | -/G
21|
6
6
FFFF 4 A6
A6 FF
-/
?6
(:
4/
3/G
7
$G
(&$G
FF
6
6
&/&G A6
&03
FFF
<6| FF
:( (:
FFF
3/G
( $G
-/G
(/D :
$
( '//. 5 ,.
V
2 § #
> (a3&
- ( 3 #8
)
-
> (§ #
- & | |:| ||:| '|:| *|:| +|:
| ,|:
2 §§ #5
> a )
- #
> #A&( :
: & 8
3
> &( &
3 :# : :
: # #
2 § #
5
> 8 > § 8 &
3 8 B &&
> # 3
3 > § 8 3
> 93 #3 ()
3 &
> #
> C 3
8 3 3
03
> (' > 2 ( '
- 3 & -
3 & 8
3 D8 EF
> 0 #8 ( +*
> ( > G 8 ( ,
> ( | > H##( ,
- #
$
(%
H#a
> ( * > 8&
- :' - §&
> ;( | &
- :':*:I.
- 9:8
> 0( ' 93
- :':*:I:/ &
> 9 $9% :
&
- :':I:/:§::I: #
0
> 8 >
- ' ' # - §
> 9 > §a
-- - !
> ; >
- '* | - | $%
> 0 > 0
-| - - $&&%
> 555
> § &# :
! a
- < &# 3 3
3&
> #
> # #
> )# 3
§ #)
Label ( 3 3
' #i : ::::
#
Operator ( #
mnemonic" & &
§ # 9 opcode
93"Ú &|
Operand[s] ( +3 & J #
# ) &&&
0 #
: : :
Comment ( 9 & #
These fields are separated by White Space (tab, blank, \n, etc.)
8086 Instruction - Example
Label Operator Operand[s] ;Comment
V V
i
i
# ( V V
;3 (
;3 ( i
( 3 #8
> H )
> B # : 3 &
>
mnemonic #
opcode
Assembler Language Segment Types
> aB
-
- a & & E
- )9'
> 0
- a
- a & & E
- a & & $ 3 %
- )
>
-
- )'
Using ?AS? Assembler
> 3"
i
> A ) B§a8 "
i
a
Ú
a Õ
Ú
a
a
,2 *i
- #
*i' -
-7 #
*i''&-7
7# 7
i!
&*i!!#
77 7
i!
&*i!!7*
7-# 7
i#
7-7 7
i7*
+7 +! 7*
+ +&!i4
!!
4
++ +i
!i%V
i!"
$
+(#+# +'
*i'! #
+(7 +'
*i'7*
+0 +&!i
,+ %&
'i*
$# !i'i
#
$-7 #
*i','&-7
x86 Instruction Set Summary
(Control/Branch Cont.)
## i''
# 'i!i!!
#% 'i!%!
#V 'i!V!!&
,+ ,i5
!i'"6
(# (i'
V V!!&
V - V!!&
-!'
4
V7, V!!&7&!
88 , 8&
'
4
!,9&i'
8,8 8&
'
4
!,9&i'
8$ 8&
$!
8,8 8&
,9&i'!
$
#--1 #--1 , #
4'
!
,9&i'
#--1#--1, #
4'!
,9&i'
-1
-!i
5<$(2$
$6
7,17,1 ,7,1 7i7i
,9&i'
!
7,1,7,1 7i,9&i'!
7, 7&!!
i''
+,2 +* !*!
+ +i!!
+% +%!
+V +V!!&
,+ %&
'i*
V i
Assembler Directives
K %<$009 7
%J-
K"
! 1 9 >AA
9
G I
7
Program Example
ii '!
*!i =V!
i!i!!*>(''
!'">
%-+i"i!"
&&
&*%-+!!!&
&
?=
''
;+,2., @,+:A+:A%i;*
%BCC%0156+ i & i;
DEF5BCC6
''
;, %+
''
"i+,2., @,A%A%"ii*
"
!,G0?"i
ii,G0
!*%A(''
!'"A
BH
BC
AA%i!i!!*
''
"i, %+
''
"+,2., @,A-%,A%
"*
+7
i
+,2''
"iiI "ii* i!i""!
"
i"I i'"ii* !*!
i
"
!iI ?%-+DB!*&
"
-))+,!*"I **
!*
DB%-+!!!&
i
JCCiI J%-+DB!
*!i i'&
DB%-+!!!&
''
", %+
, %+7K, %'i'L"!
*!i !
Another Way to define Segments
0Ai& A"!
"*
''
;+,2., %i*
%BCC%0156
''
;, %+
''
"i+,2., "i*
"
!,G0?"i
i
!*%A(''
!'"A
BH
BC
AA%i!i!!*
''
"i, %+
''
"+,2., "i*
i& ''
"
"''
"i
''
;
+7
i
''
"iiI "ii* i!i""!
"
i"I i'"ii* !*!
i
"
!iI ?%-+DB!*&
"
-))+,!*"I **
!*
DB%-+!!!&
i
JCCiI J%-+DB!
*!i i'&
DB%-+!!!&
''
", %+
, %+7
*et another way to define Segs
0=i;
="ii
=
""!
"*
=i;BCC!!DEF
i;i
="ii
"
!,G0?"i
i
!*%A(''
!'"A
BH
BC
AA%i!i!!*
=
"
+7
i
+,2!*iI "ii* i!i""!
"
i"I i'"ii* !*!
i
"
!iI ?%-+DB!*&
"
-))+,!*"I **
!*
DB%-+!!!&
i
JCCiI J%-+DB!
*!i i'&
DB%-+!!!&
, %+7
a
i
!i
!i"56
> ;3 3 & )
8
- ( # 3
- )( 3 ( 3
> a3 # 3 &
> #8
> # )
0 a
> ( 3 & > < )
) J
3
- 0( #$ % - &
- 02( 8 $ %
- 00( #8 $ % - 3& &
- 0G( J 8 $ % )&
(
- 0<( #$ %
0&0
> H ) > § &)
- ' ( # (
- ' ( # & 8 ,
- ' ( 9 )8
- ' ( §a % JC(
BC
BH
C
- ' ( §a > §53
> 33 3 E
0 H )
$#:8 :1% %DEE
BDM
A$A
Ha
> H # > §H& #
8 :
E
& % J > <98
% BN
- ,
0 -% B > ;H H;&
$%% 8
> < > E
)# #8
§
> § ) &
E#
$% JC(
BC
BH
C
@%Aii!!iA
%% BC?DHF
))))))))(
B
BCC
> 3 &:6*:6,:6|
> 3 &**:*6':I:*6'-
> 3 &:6,:6|:6'*
0
> § 8 J &
# & )
> ; 3 & &
)
%JC%0156
% BC%015C6
%H"&5>>6
2 a