Laboratory Manual: Microprocessor & Microcontroller

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

LABORATORY MANUAL

Microprocessor & Microcontroller


Department of Telecommunication

Engineering

NAME: Haider ali


CMS ID: 41162
SEMESTER: 4th
LAB Engr. Ali Israr
INSTRUCTOR:
DATE: 15-04-2019
LAB 03

Faculty of Information & Communication Technology

BALOCHISTAN UNIVERSITY OF INFORMATION TECHNOLOGY ENGINEERING &


MANAGEMENT SCIENCES,
QUETTA, PAKISTAN
EXPERIMENT NO. 03

1. OBJECTIVE:

 Learn manipulation of iAPX86’s 16-bit AX and BX registers.


 Understand the software tool-chain involved in assembling an assembly language program using
Netwide Assembler (NASM).
 Analyze the generated op-codes in the listing file from NASM.
 Analyzing the register status during sequential execution of a program using Advanced Full-
screen Debugger (AFD).

2. EXPERIMENT REQUIREMENTS:
2.1. SOFTWARE

1. DOSBox
2. Notepad++
3. AFD

DOS Box

Dos Box in IT`s Lang is a term that gets used in more than one way. People may refer to a Dos box as
some sort of emulator or software

Dos box is actually an X86 simulator it needs a directory that contain the file that need to run and used to
process all the file

Note pad++

Notepad++ is a content manager and source code editorial manager for use with Microsoft Windows. It
underpins selected altering, which permits working with various open documents in a solitary window

In simple words, Note pad++ is used to write the assembly program


AFD

Software used to run the assembly program step by step.

2.2. HARDWARE
In this lab we only use PC having specification

OS Name Microsoft windows 10 Home

Version: 10.0.16299 Build 162999

OS manufacture: Microsoft Corporation

System manufactures Dell Inc.

System model inspiron 5521

System Type X64-based PC

System SKU xxx123x#ABA

Processor: Intel(R) core™i7-3537U CPU @2.00GHZ, 2501 MHz, 2 core(s),4 Logical processor(s)

BIOS Version date Dell Inc. A05, 1/3/2013

SMBIOS Version 2.7

Embedded Controller Version 1.01


Hardware Abstraction layer Version = “10.0.16299.248”

3. BACKGROUND
[6:51 am, 4/20/2019] Haider Uni: The first program that we will write adds three numbers. This very
simple program will clarify most of the basic concept of assembly language. We will start with writing
our algorithm in pseudo code and the convert it into assembly language, but let’s first clarify what is
program?

Definition:

A program is an ordered set of instruction for the processor.

Pseudo Code:

Instruction Source Destination


move 5 to ax
move 10 to bx
add Bx to ax
move 15 to bx
add bx to ax

[6:51 am, 4/20/2019] Haider Uni: Even in this simple reflection of thoughts in English, there are some
keys things to observe. One is the concept of destination as every instruction has a “to destination” part
and there is a source before it as well. For example, the second line has a constant 10 as its source and the
register BX as its destination the key point in giving the first program in English that you know very well,
and every concept will eventually be applicable to assembly language. Intel could have made their
assembly language exactly identical to our program in plain English but they have abbreviated a lot of
symbols to avoid unnecessarily lengthy program when the meaning could conveyed with less effort. For
example, Intel has named their move instruction “mov” instead of move. Similarly, the Intel odder of
placing source and destination in opposite to what we have used in our English program, just a change
interpretation so, the Intel way writing things is:

IAPX86 operation destination source

Instruction operation destination

Syntax operation source Operation

4. PROGRAM
Program that add two numbers
[ORG 0x100] ; Starting Offset
mov ax,5 ; Assigning a value to register ax
mov bx,10
ADD ax,bx
mov ax,15
ADD ax,bx
mov ax,0x4c00
Int 0x21

5. METHODOLOGY
a. First turn on the PC
b. Open Notepad++.
c. Write pseudocode of (written above) in Notepad ++.
d. Then save the file in C drive in hadi.assembly folder with “asm” extension.
e. Now open DosBox and load the file hadi.assembly placed in drive C by typing this command.\
f. Sub sequent that “C:” and then ‘dir’ to check available file in hadi.assembly folder.
g. After call the compiler for manipulation of the selected file by the command here nasm is
netwid assembler , hadi is file on which we have written codes via notepad ++ ‘o’ stands for output
and ‘l’ stands for make list file. For object file (nasm hadi.asm –o hadi33.com). For list file (nasm
hadi.asm –l hadi3.lst). Type hadi3.lst to see the code in hexadecimal
h. At last giving advance full screen debugger instruction for execution (afd hadi3.com).The window
will appear where we run our program step by step by pressing F1/F2.
6. DATA TABLE
Table 1 Data Table

Offset Address Instructions AX BX IP


00000000 MOV ax, 5 0005 0000 0100
00000003 MOV bx, 10 0005 000A 0103
00000006 ADD ax, bx 000F 000A 0106
00000008 MOV ax, 15 000F 000F 0108
0000000B ADD ax, bx 001E 000F 010B
0000000D MOV ax, 0x4c00 4C00 000F 0110
00000010 Int 0x21 4C00 000F 14A0

7. RESULTS AND DISCUSIONS


The task which we performed in our lab given by our instructor are described blow with the snapshots of
each step. In these programs we simply add 2 values and save the result in register ax. We will start with
the program done in the laboratory. Once the list and executable files have been created, the AFD is
commanded to run the executable file. We will see a window that shows the status of the registers,
memory and it also shows the program that we are running.

As we can see, the registers are all shown at the topside of the window, the memory is shown to the far
and the bottom of the window. The program is written to the right wide of the window. This program will
run step at a time whenever the user presses F1 or F2 key.

7.1. THE PROGRAM OF ADDING TWO NUMBERS


In this task we wrote a program from offsets starting location 100 assign value to attribute ax and base
register 5 and 10. Then we gave instruction to nasm to add ax and bx and store result in ax again we
assign value to bx and add it into ax. Press F1 to run the program set by step.

Figure 1 DosBox mounting assembly folder in C drive

Figure 2 DosBox checking files


Figure 3 Dos Box manipulating test file

Figure 4 DosBox AFD


Figure 5 by pressing F1 value 5 moved to ax

Figure 6 by pressing F1 value 10 moved to bx


Figure 7 by pressing F1value added and saved in ax

Figure 8 by pressing F1 new value is assigned to the bx


Figure 9 by pressing F1 values added and saved in ax

8. CONCLUSION
This laboratory experiments holds the techniques about microprocessor iAPX86’s architecture and
standup and application of microprocessor system. Nevertheless, the coding of Assembly language is a bit
lengthy comparatively other high-level languages, but it is more effective, efficient and accurate. This lab
holds all about moving and adding the data of two registers and assembly language’s syntax.

You might also like