You are on page 1of 6

# COMSATS-Lancaster Dual Degree Programme

Name

Ahmed Daud

Registration Number :

CIIT/DDP-FA10-BTE-002/LHR

Email

daud@live.lancs.ac.uk

Semester

Section

DDP

Department

Electrical Engineering

Course Title

## Lab - Microprocessor Systems & Interfacing

Course Code

EEE342

Assignment Number :

Assignment Topic

Course Book

Submission Date

Submitted To

## Engr. Mr. Usman Rafique

1|Page

QUESTION #

PAGE #

Q#1

Q#2

Q#3

References

2|Page

QUESTION NO. 1
Identify the incorrect instructions in the following code segment of 8086-88 assembly language.

SOLUTION:
MOV AX, BX

MUL CX

MOV [256AH], DX

## ; XCHNG IS WRONG ALSO NO CONSTANT ALLOWED.

; IT EXCHANGES THE CONTENTS OF REGISTERS OR MEMORY

DIV AL

## ; 8-BIT DIVISION USING DIV INSTRUCTION REQUIRES AX FOR DIVIDEND

; AND AN OPERAND FOR THE DIVISOR.

XOR [1256H], BX

; IT XOR MEMORY [1256H] AND BX AND STORE THE RESULT IN LOC [1256H]

## MOV AX, 1234H

; LOAD THE NUMBER INTO A REGISTER, THEN USE THE NEG INSTRUCTION

NEG AX

## ; ONLY REGISTERS OR MEMORY LOCATION ALLOWED.

; NEG COMPUTES THE TWO'S COMPLEMENT

3|Page

QUESTION NO. 2
Write an 8086-88 assembly language program to convert the Celsius reading into the Fahrenheit
reading. Celsius reading is found in AL register and Fahrenheit reading is to be placed in AH register.

SOLUTION:
; We will convert Celsius to Fahrenheit using formula: f = c * 9 / 5 + 32.
ORG 100H
MOV BL, AL

MOV AL, 9

; COPY 9 IN AL.

IMUL BL

MOV BL, 5

; COPY 5 IN BL.

IDIV BL

MOV AH, AL

## ; FAHRENHEIT READING IS TO BE PLACED IN AH REGISTER.

RET

4|Page

QUESTION NO. 3
Write an 8086-88 assembly language program that clears a specific bit in BX register. Number of the
bit which is to be cleared (from 0 to 15) is placed in AL. Program should clear only desired bit leaving
other bits unchanged.

SOLUTION:
MOV DX, 0001H

; COPY 1 IN DX.

MOV CL, AL

SHL DX, CL

NOT DX

AND BX, DX

## ; AND BX WITH DX TO CLEAR AL BIT.

RET

ALTERNATE SOLUTION:
MOV DX, 0FFFEH
MOV CL, AL
ROL DX, CL
AND BX, DX

5|Page

REFERENCES
Assembly language programming and organization of the IBM PC by Ytha Y. Yu, Charles
Marut
The 80x86 IBM PC and compatible computers: Assembly language, design, and interfacing by
Muhammad Ali Mazidi, Janice Gillispie Mazidi
Assembly Language for Intel-Based Computers by Kip R. Irvine
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486, Pentium,
Pentium Pro, and Pentium II Processors : Architecture, Programming, and Interfacing by
Barry B. Brey
Assembly language programming for the Intel 80XXX family by William B. Giles
The 80x86 IBM PC and Compatible Computers (Vol 1 and Vol 2)
Microcomputer Systems: The 8086/8088 Family
Online Materials
Intel Developers website http://developer.intel.com
AIX-86 (8086) Datasheet