Show Menu
Cheatography

ASM 8086 Cheat Sheet

Microp­roc­essor 8086 Features

How many bits is the 8086 Microp­roc­essor?
16 bit
What and how many 16 bit general purpose registers are there?
4, 16 bit general purpose registers. They are: AX, BX, CX, DX
What and how many 8 bit general purpose registers are there?
8, 8 bit general purpose registers. They are: AL, AH, BL, BH, CL, CH, DL, DH
What is the maximum for an external memory of the 8086 microc­ont­roller?
1 MB
How many bits is the data bus?
16 bits
How many bits is the address bus?
20 bits
How many bytes is the instru­ction queue?
6 byte
How many bits is the ALU (Arith­metic Logic Unit)
16 bits
How many segmented memories are there and what's the maximum available space?
CS (Code Segment), DS (Data Segment), SS (Stack Segment), EX (Extra Segment), all of which are 64 KB each in space
What are the corres­ponding points for the segments?
IP (Instr­uction Pointer), SP (Stack Pointer), BP (Base Pointer), SI (Source Index), DI (Desti­nation Index)
What is the clock frequency of the microc­ont­roller?
5MHz frequency
How many pins does the miroco­ntr­oller have?
40 pins
A microp­roc­essor is the brain of the computer, it is:

1. Multip­urpose
2. Clock Driven
3. Register Based
4. Progra­mmable
5. Digital Integrated Circuit

Notes:

IP (Instr­uction Pointer) is respon­sible for storing the instru­ction of the next executable instru­ction
 

Addressing Modes

Direct addressing mode
The addressing mode in which the effective address of the memory location is written directly in the instru­ction.
Register addressing
It means that the register is the source of an operand for an instru­ction.
Immediate addressing
The addressing mode in which the data operand is a part of the instru­ction itself is known as immediate addressing mode.
Register indirect addressing
This addressing mode allows data to be addressed at any memory location through an offset address held in any of the following registers: BP, BX, DI & SI.
Base addressing
In this addressing mode, the offset address of the operand is given by the sum of contents of the BX/BP registers and 8-bit/­16-bit displa­cement.
Index addressing
In this addressing mode, the operands offset address is found by adding the contents of SI or DI register and 8-bit/­16-bit displa­cem­ents.
Base-index addressing
In this addressing mode, the offset address of the operand is computed by summing the base register to the contents of an Index register.
Relative addressing
In this the effective address is calculated with reference to instru­ction pointer.
Addressing applied in string processing instru­ctions
This addressing mode is related to string instru­ctions. In this the value of SI and DI are auto increm­ented and decrem­ented depending upon the value of direct­ional flag.
Stack addressing
The stack memory addressing mode is used whenever you perform a push or pop operation. Always a word will be entered or popped from the stack in this addressing mode, and the value of the Stack Pointer (SP) will be increm­ented or decrem­ented accord­ingly.
Examples below
1.
MOV AX, [1592H]
2.
MOV CX, AX
ADD BX, AX
3.
ADD AX, 2387H
4.
MOV AX, [BX]
5.
MOV DX, [BX+04]
6.
MOV BX, [SI+16]
7.
ADD CX, [AX+SI]

General Purpose Registers

AX
This is the accumu­lator. It is of 16 bits and is divided into two 8-bit registers AH and AL to also perform 8-bit instru­ctions. It is generally used for arithm­etical and logical instru­ctions but in 8086 microp­roc­essor it is not mandatory to have accumu­lator as the destin­ation operand.
BX
This is the base register. It is of 16 bits and is divided into two 8-bit registers BH and BL to also perform 8-bit instru­ctions. It is used to store the value of the offset.
CX
This is the counter register. It is of 16 bits and is divided into two 8-bit registers CH and CL to also perform 8-bit instru­ctions. It is used in looping and rotation.
DX
This is the data register. It is of 16 bits and is divided into two 8-bit registers DH and DL to also perform 8-bit instru­ctions. It is used in multip­lic­ation an input/­output port addres­sing.
Every digit of hex corres­ponds to 4 bits

Examples:

MOV AX, 05H
MOV [500], AX

MOV BL, [500]
 

Addressing Modes

Immediate Addressing Mode
In this immediate data is the part of the instru­ction itself. Example: Mov AX, 0005H
Direct Addressing Mode
In it, a 16-bit memory address (offset) or an input/­output address is directly specified in the instru­ction as a part of it.
Register Addressing Mode
Here data is stored in a register and referred using the particular register.
Register Indirect Addressing Mode
In this offset address of data is in either Bx, SI, DI, (Base register, source index or Destin­ation index) default segment is either DS or ES. Data is supposed to be available at the address pointed to by the content of any of the above registers in the default data segment.
Indexed Addressing Mode
Here offset of the operand is stored in one of the index registers. DS is the default segment for SI and DI in string instru­ction DS and ES default segment for register SI and DI.
Register Relative Addressing Mode
In it, data is available at an effective address formed by adding an 8 bit or 16-bit displa­cement with content, any one of the registers Bx, Bp, SI, DI in the default (DS or ES) segment.
Based Indexed Addressing Mode
The effective address of data is formed by adding content of base register Bx or Bp to the content of index register.
Relative Based Indexed Addressing Mode
Here the effective address is formed by adding an 8 bit or 16-bit displa­cement with the sum of the content of any one of the index registers in the default segment.

Index Registers

SI
This is the source index register. It is of 16 bits. It is used in the pointer addressing of data and as a source in some string related operat­ions. It’s offset is relative to data segment.
DI
This is the destin­ation index register. It is of 16 bits. It is used in the pointer addressing of data and as a destin­ation in some string related operat­ions. It’s offset is relative to extra segment.

Segment Registers

CS
Points to the segment containing the current program
DS
Points to the segment where the variables are defined
ES
It is an extra segment register, and it is up to the coder for the usage
SS
Points at the segment containing the stack
Note:
These registers each have an available space of 64 KB and 256 KB in total. The rest of the 1 MB total memory goes to the microc­ont­roller. It can be assumed as an "­Ope­rating System­".
 

Pointer Registers

SP
This is the stack pointer. It is of 16 bits. It points to the topmost item of the stack. If the stack is empty the stack pointer will be (FFFE)H. It’s offset address relative to stack segment.
BP
This is the base pointer. It is of 16 bits. It is primary used in accessing parameters passed by the stack. It’s offset address relative to stack segment.
IP
To access instru­ction the 8086 uses the register CS and IP. The CS register contains the segment number of the next instru­ction and IP contains the offset.

Control Flags

Direct­ional Flag (D)
This flag is specif­ically used in string instru­ctions. If direct­ional flag is set (1), then access the string data from higher memory location towards lower memory location. If direct­ional flag is reset (0), then access the string data from lower memory location towards higher memory location.
Interrupt Flag (I)
This flag is for interr­upts. If interrupt flag is set (1), the microp­roc­essor will recognize interrupt requests from the periph­erals. If interrupt flag is reset (0), the microp­roc­essor will not recognize any interrupt requests and will ignore them.
Trap Flag (T)
This flag is used for on-chip debugging. Setting trap flag puts the microp­roc­essor into single step mode for debugging. In single stepping, the microp­roc­essor executes a instru­ction and enters into single step ISR. If trap flag is set (1), the CPU automa­tically generates an internal interrupt after each instru­ction, allowing a program to be inspected as it executes instru­ction by instru­ction. If trap flag is reset (0), no function is performed.

Status Flags

Overflow Flag (O)
This flag will be set (1) if the result of a signed operation is too large to fit in the number of bits available to represent it, otherwise reset (0).
There are also 5 other flags, but they are the same as the 8085.
           
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          ASM 8085 Cheat Sheet
          ARM Assembly Cheat Sheet

          More Cheat Sheets by Deathtitan77

          ASM 8085 Cheat Sheet