You are on page 1of 3

Microcontroller and Microprocessor lab 2

LAB#2

Lab – 2: Basic machine code / Opcode

2.1 Objective:
 To learn the basic machine codes or opcodes of Intel 8086
2.2 Pre-Lab Reading:
Intel Microprocessors: Architecture, Programming and Interfacing, 8th Edition, BARRY B.
BREY, Chapter 4, Topic 4.1
2.3 Equipment:
Instruments MDA-Win 8086 Trainer
Kit

Components Power Cables

2.4 Code:
2.4.1: Mov A, #80H
2.4.2: Push AX
2.4.3: POP BX
2.4.4: PUSHF
2.4.5: POPF
2.4.6: ADD AH, 5
2.4.7: INC BH
2.4.8: JO
2.4.9: NEG
2.4.10: SUB BL, AH
2.6 Output:
2.5.1: A=80H
2.5.2: AX=55H and Top of stack=55H

1
21395
Microcontroller and Microprocessor lab 2

2.5.3: Top of stack=44H and BX=55H


2.5.4: FLAGS are PUSED into the stack
2.5.5: FLAGS are POPED from the stack
2.5.6: AH=5
2.5.7: Before INC BH=6, After INC BH=7
2.7 Exercise:

Name Opcode Operands Description


Mov 100010dw mod reg r/m Reg/Memory Data transfer between
Register/Memory to/
from Register
PUSH 11111111 mod 110 r/m Reg/Memory PUSH the data into
the stack
POP 10001111 mod 000 r/m Reg/Memory POP the data from
the stack
PUSHF 10011100 N/A Push FLAGS into the
stack
POPF 10011101 N/A Pop FLAGS into the
stack
ADD 000000dw mod reg r/m Reg/Memory Add the Reg/Memory
with Register to
Either
INC 01000 reg Reg Increments the Reg
by 1
SUB 001010dw mod reg r/m Reg/Memory Subtracts
Reg/Memory and
Register to Either
CMP 001110dw mod reg r/m Reg/Memory Compares the
contents of
Register/Memory and
Register
JO 01110000 displacement N/A Jumps on Overflow
JNO 01110001 displacement N/A Jumps on Not
Overflow
JP/JPE 01111010 displacement N/A Jump on Parity/Parity
Even
NEG 1111011w mod 011 r/m N/A Changes the sign
JS 01111000 displacement N/A Jump on sign

2
21395
Microcontroller and Microprocessor lab 2

2.8 Notes:

 When two operands are required for an instruction they are separated by comma. For
example:

REG, memory

 The size of operands must be same. For example:

AL, DL
DX, AX

 Mov command is use for the operation

Mov BX,AX
Mov BX,[BI+SI]

2.9 Assessment Sheet:


CMS ID: 21395
DATE: 13-04-2015

1-basic machine code


Problem Number
2-operands

Working
Lab Performance
Viva

Total Score in Lab#2

Instructor's Verification

3
21395