8086 Assembly Language: String Manipulation Instructions, Lecture notes of Microprocessors

Lecture notes from the University of Namibia

Typology: Lecture notes

2018/2019

Uploaded on 03/24/2019

201607006
201607006 🇳🇦

8 documents

1 / 77

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
& ASSEMBLER DIRECTIVES
8086
INSTRUCTION
SET
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d

Partial preview of the text

Download 8086 Assembly Language: String Manipulation Instructions and more Lecture notes Microprocessors in PDF only on Docsity!

& ASSEMBLER DIRECTIVES

INSTRUCTION

SET

1. Data Transfer Instructions

2. Arithmetic Instructions

3. Logical Instructions

4. String manipulation Instructions

5. Process Control Instructions

6. Control Transfer Instructions

8086 supports 6 types of instructions.

  1. Data Transfer Instructions Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT … MOV reg2/ mem, reg1/ mem MOV reg2, reg MOV mem, reg MOV reg2, mem (reg2)  (reg1) (mem)  (reg1) (reg2)  (mem) MOV reg/ mem, data MOV reg, data MOV mem, data (reg)  data (mem)  data XCHG reg2/ mem, reg XCHG reg2, reg XCHG mem, reg (reg2)  (reg1) (mem)  (reg1)

XCHG ■ (^) Exchanges a byte/word between the source and the destination specified in the instruction. Source: Register, Memory Location

  • Destination: Register, Memory Location
  • (^) Even here, both operands cannot be memory locations. Eg: XCHG CX, BX ; CX <-----> BX XCHG BL, CH ; BL <------> CH
  1. Data Transfer Instructions Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT …

PUSH AX & POP BX

  1. Data Transfer Instructions Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT … IN destination register, source port Loads the destination register with the contents of the I/O port specified by the source. Source : It is an I/O port address. If the address is 8-bit it will be given in the instruction by Direct addressing mode. If it is a 16 bit address it will be given by DX register using Indirect addressing mode. Destination : It has to be some form of “A” register, in which we will get data from the I/O device. If we are getting 8-bit data, it will be AL or AH register. If we are getting 16-bit data, it will be AX register. Eg: IN AL, 80H ; AL gets 8-bit data from I/O port address 80H IN AX, 80H ; AX gets 16-bit data from I/O port address 80H IN AL, DX ; AL gets 8-bit data from I/O port address given by DX. IN AX, DX ; AX gets 16-bit data from I/O port address given by DX. OUT destination port, source register Loads the destination I/O port with the contents of the source register. Eg: OUT 80H, AL ; I/O port 80H gets 8-bit data from AL OUT 80H, AX ; I/O port 80H gets 16-bit data from AX OUT DX, AL ; I/O port whose address is given by DX gets 8-bit data from AL OUT DX, AX ; I/O port whose address is given by DX gets 16-bit data from AX
  1. Data Transfer Instructions 11 Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT … I/O addresses in 8086 can be either 8–bit or 16-bit Direct Addressing Mode: If we use 8-bit I/O address we get a range of 00H… FFH. This gives a total of 256 I/O ports. Here we use Direct addressing Mode, that is, the I/O address is specified in the instruction. E.g.:: IN AL, 80H ; AL gets data from I/O port address 80H. This is also called Fixed Port Addressing. Indirect Addressing Mode: If we use 16-bit I/O address we get a range of 0000H… FFFFH. This gives a total of 65536 I/O ports. Here we use Indirect addressing Mode, that is, the I/O address is specified by DX register. E.g.:: MOV DX, 2000H IN AL, DX ; AL gets data from I/O port address 2000H given by DX. This is also called Variable Port Addressing.
  1. Arithmetic Instructions Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… ADC reg2/ mem, reg1/mem ADC reg2, reg ADC reg2, mem ADC mem, reg (reg2)  (reg1) + (reg2)+CF (reg2)  (reg2) + (mem)+CF (mem)  (mem)+(reg1)+CF ADC reg/mem, data ADC reg, data ADC mem, data (reg)  (reg)+ data+CF (mem)  (mem)+data+CF ADDC A, data ADD AL, data ADD AX, data (AL)  (AL) + data8+CF (AX)  (AX) +data16+CF
  1. Arithmetic Instructions Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…
  1. Arithmetic Instructions Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… SBB reg2/ mem, reg1/mem SBB reg2, reg SBB reg2, mem SBB mem, reg (reg2)  (reg1) - (reg2) - CF (reg2)  (reg2) - (mem)- CF (mem)  (mem) - (reg1) –CF SBB reg/mem, data SBB reg, data SBB mem, data (reg)  (reg) – data - CF (mem)  (mem) - data - CF SBB A, data SBB AL, data SBB AX, data (AL)  (AL) - data8 - CF (AX)  (AX) - data16 - CF
  1. Arithmetic Instructions Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… INC reg/ mem INC reg INC reg INC mem (reg8)  (reg8) + 1 (reg16)  (reg16) + 1 (mem)  (mem) + 1 DEC reg/ mem DEC reg DEC reg DEC mem (reg8)  (reg8) - 1 (reg16)  (reg16) - 1 (mem)  (mem) - 1
  1. Arithmetic Instructions Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP… MUL reg/ mem MUL reg MUL mem For byte : (AX)  (AL) x (reg8) For word : (DX)(AX)  (AX) x (reg16) For byte : (AX)  (AL) x (mem8) For word : (DX)(AX)  (AX) x (mem16) IMUL reg/ mem IMUL reg IMUL mem For byte : (AX)  (AL) x (reg8) For word : (DX)(AX)  (AX) x (reg16) For byte : (AX)  (AX) x (mem8) For word : (DX)(AX)  (AX) x (mem16)
  1. Arithmetic Instructions Mnemonics: ADD, ADC, SUB, SBB, INC, DEC, MUL, DIV, CMP…