0% found this document useful (0 votes)
56 views8 pages

8086/8088Mp Instructor: Abdulmuttalib A. H. Aldouri

This document discusses unsigned and signed integer numbers in 8086/8088 microprocessors. It explains that unsigned integers can represent numbers from 0 to 255 for bytes and 0 to 65535 for words, while signed integers use two's complement to represent numbers from -128 to 127 for bytes and -32768 to 32767 for words. It then provides details on the instruction set of the 8086/8088 microprocessor, dividing it into groups for data transfer, arithmetic logic, shift/rotate, flag control, compare, jump, loop, string, and subroutine instructions. Examples are given for MOV, XCHG, XLAT, LEA, LDS, LES, and various arithmetic instructions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views8 pages

8086/8088Mp Instructor: Abdulmuttalib A. H. Aldouri

This document discusses unsigned and signed integer numbers in 8086/8088 microprocessors. It explains that unsigned integers can represent numbers from 0 to 255 for bytes and 0 to 65535 for words, while signed integers use two's complement to represent numbers from -128 to 127 for bytes and -32768 to 32767 for words. It then provides details on the instruction set of the 8086/8088 microprocessor, dividing it into groups for data transfer, arithmetic logic, shift/rotate, flag control, compare, jump, loop, string, and subroutine instructions. Examples are given for MOV, XCHG, XLAT, LEA, LDS, LES, and various arithmetic instructions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H.

ALDOURI

8
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

Unsigned and Signed Integer Numbers

1. Unsigned integer numbers: each type of integer can be either byte-wide or


word-wide. This data type can be used to represent decimal numbers in the
range 0 through 255. The unsigned word integer can be used to represent
decimal numbers in the range 0 through 65535.

2. Signed integer numbers: each type of integer can be either byte-wide or


word-wide. They are similar to unsigned integer numbers except the most
significant bit MSB in signed integer data type is a sign bit. This data type
represents decimal numbers in the range -128 to +127. The signed word
integer represents decimal numbers in the range –32768 to +32767.

Note: Negative integers are stored in 2's complement form.

-1H = FFH (byte) , -2H = FEH (byte)

-1H = FFFFH (word) , -2H = FFFEH (word)

0
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

Instruction Set of 8086µP


There are 117 basic instructions in the instruction set of 8086µP. The instruction
set of 8086µP can be divided into the following groups :
1. Data Transfer Instructions 2. Arithmetic and Logic Instructions
3.Shift and Rotate Instructions 4. Flag Control Instructions

8. Stack Instructions 
5. Compare Instructions 6. Jump Instructions
7. Loop Instructions
9.Strings Instructions 10. Subroutines Instructions
Data Transfer Instructions
The data transfer instructions include:
1. MOV (byte or word) Instruction. 2. XCHG (Exchange byte or word)
3. XLAT (Translate byte) 4. LEA (Load effective address )
5. LDS (Load register and DS) 6. LES (Load register and ES)

The MOV Instruction:

The MOV instruction is used to transfer (copy) a byte or word of data


from a source operand to a destination operand. The general form of MOV
instruction is as shown below:

The allowed operands for the source and destination are listed below:
Examples :
MOV AX , BX
MOV AL , FFH
MOV [BX] , CX
MOV [SI] , FF87H
MOV BH , [PB+DI]
MOV DS , AX
MOV AL , 'A'
MOV [BX] , [SI] is not allowed, why?
MOV DS , FA34H is not allowed, why?
MOV DS , CS is not allowed, why?
MOV CS, AX is not allowed, why?

9
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

The Exchange XCHG Instruction


The XCHG (exchange) instruction exchanges the contents of a register a
memory with the contents of any other register or memory. The general form of
this instruction is as shown below:

The allowed operands for the source and destination are listed below:
Example
(AX)=1000H and (BX)=2000H
XCHG AX , BX
After execution :
(AX)=2000H and (BX)=1000H

H.W. Repeat the example by using MOV instructions only.

The XLAT Instruction


This instruction used to simplify implementation of the lookup table operation.
The general form of this instruction is as shown below:

Ex: Assume (DS) = 1000H, (BX)=1000H, and (AL)=05H. Execution of XLAT


replaces the contents of AL by the contents of memory location with physical
address : PA = (DS)0 + (BX) + (AL) = 10000H + 1000H + 05H = 11005H
Thus: (AL) = 6DH (the old byte 05H in AL is replaced by 6DH)

AX

BX

8
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

Load-Effective Address (LEA, LDS, and LES) Instructions:


These instructions load a segment and general purpose registers with an address
directly from memory. The general forms of these instructions are as shown
below:
Mnemonic Meaning Format Operation Flags Affected
LEA Load effective address LEA Reg16 , EA EA → (Reg16) None
[PA] → (Reg16)
LDS Load register and DS LDS Reg16 , EA None
[PA+2] → (DS)
[PA] → (Reg16)
LES Load register and ES LES Reg16 , EA None
[PA+2] → (ES)

Ex: What does BX contain after executing: LEA BX , [SI+100H] If


(SI)=1000H
Ans. The effective address EA=1000H + 100H = 1100H → (BX) = 1100H

Ex : If (SI)=1000H and (DS)=1000H , what do the registers BX and DS


contain after execution LDS BX , [SI] instruction?
Ans.
PA = 10000H + 1000H = 11000H
The execution of LDS BX , [SI] loads BX from addresses 11000H and 11001H
and DS from addresses 11002H and 11003H.
(BX) = 127AH and (DS) = 3000H

BX

SI

Note : All data transfer instructions do not affect the status flags.
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

Arithmetic and Logic Group


The arithmetic group includes instructions for the addition, subtraction,
multiplication, division as well as increment and decrement operations.
Addition and Subtraction Instructions

The allowed operands: Examples


ADD AL , BL
ADD AX , DI
ADC DX , 1234H
SUB AX , [BX]
SBB [BX+DI] , CL
INC AL
DEC [DI]
Ex: Write an ALP that subtracts Ex: Write a piece of code to add
1234H existing in DX from the two 32-bit numbers stored at
word beginning at memory 82000H and 84000H and store the
location 64200. result at 86000H.
Ans. : Ans. :
MOV AX , 6000H MOV AX , 8000H
MOV DS , AX MOV DS , AX
MOV BX , 4200H MOV AX , [2000]
MOV DX , 1234H MOV DX , [2002]
SUB [BX] , DX ADD AX , [4000]
HLT ADC DX , [4002]
MOV [6000] , AX
MOV [6002] , DX
HTL
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

Multiplication and Division Instructions:


The 8086µP has instructions for multiplication and division of binary,
BCD numbers, and signed or unsigned integers. Multiplication and division are
performed on bytes or on words.

The allowed operand: Examples


Source MUL BL
DIV [SI]
IMUL BX
IDIV [DI+1000H]

Ex: Write an ALP for dividing Ex : If (AL) = -1 and (BL) = -2 ,


1234H by 34H. what is the result of Executing :
Ans. 1. MUL BL
MOV AX, 1234H 2. IMUL BL
MOV CL, 34H Ans.
DIV CL The 2'complement of -1 = FFH
HLT The 2'complement of -2 = FEH
After Execution : (AX)= 2059H 1. (AX) = FF*FE = FD02H
Quotient in AL = 59H and 2. (AX) = -1H* -2H = 0002H
Remainder in AH = 20H.
8086/8088MP INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

CBW(Convert Signed Byte to Word) & CWD(Convert Signed Word to


Double Word) instructions:
The division instruction can also be used to divide a sign 8-bit dividend in AL
by an 8-bit divisor. For this purpose we use (CBW) instruction. When (CBW)
instruction is executed the value of AX register is as shown below:
AH=0 if the number is positive & AH=1 if the number is negative.

Ex: What is the result of executing the following piece of code?


MOV AL , A1H
CBW
CWD

The first instruction loads AL with


(AL)=A116=101000012
Executing the second instruction gives:
(AH)=111111112 = FF16
(AX)=11111111101000012= FFA116
Executing the third instruction gives:
(AX)=FFA116
(DX)=FFFF16

Ex: Write an ALP that divide a signed byte stored in 5600AH by the
content of BL.
Ans.
MOV AX , 5000H
MOV DS , AX
MOV SI , 6000H
MOV AL , [SI + 0AH]
CBW
IDIV BL
MOV [SI + 0AH] , AX
HLT

You might also like