0% found this document useful (0 votes)
428 views8 pages

Microprocessor Experiment No.: 1 Use of Programming Tools Microprocessor Lab Experiment No.: 1 Use of Programming Tools

The document describes an experiment on using assembly language programming tools like Debug, TASM, MASM, and 8086 kit to perform basic arithmetic operations on 8-bit and 16-bit data. It provides examples of assembly language programs to add, subtract and multiply 8-bit and 16-bit numbers. The programs are written and executed using MASM assembler on operating systems like Ubuntu or Windows.

Uploaded by

rachanaypatil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
428 views8 pages

Microprocessor Experiment No.: 1 Use of Programming Tools Microprocessor Lab Experiment No.: 1 Use of Programming Tools

The document describes an experiment on using assembly language programming tools like Debug, TASM, MASM, and 8086 kit to perform basic arithmetic operations on 8-bit and 16-bit data. It provides examples of assembly language programs to add, subtract and multiply 8-bit and 16-bit numbers. The programs are written and executed using MASM assembler on operating systems like Ubuntu or Windows.

Uploaded by

rachanaypatil
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 8

Department of Computer Engineering

Microprocessor Lab

Experiment No.: 1

Use of Programming Tools

A.C. Patil College of Engineering www.acpce.org 12 | P a g e


Department of Computer Engineering

Experiment No. 1
1. Aim: Use of programming tools (Debug/TASM/MASM/8086kit) to perform basic
arithmetic operations on 88-bit/16-bit data.
2. Objective: To understand the programming tools used in assembly language
programming for 8086.
3. Outcomes: The learner wil
will be able to
• Write basic programs for 88-bit/16-bit arithmetic operation.
• Execute basic commands for assembly language program.
4. Hardware / Software Required: MASM assembler, Text Editor, DOSBOX, Operating
System-Ubuntu/Windows
Ubuntu/Windows
5. Theory:

• Debug: Translating th
thee assembly language to machine code is similar to building
a circuit from a schematic diagram. Debugging can help in determining:
o Values of register.
o Flow of program.
o Entry and exit point of a function.
o Entry into if or else statement.
o Looping of code.
o Calculation
culation check.
• TASM:: Turbo Assembler is an assembler for software development published by
Borland in 1989. It runs on and produces code for 16
16- or 32-bit
bit x86 MS-DOS
MS and
compatibles or Microsoft Windows. TASM itself is a 16-bit
bit program. It will run
on 16- and 32-bit
bit versions of Windows, and produce code for the same versions,
but it does not generate 64
64-bit x86 code.
• MASM: The Microsoft Macro Assembler (MASM) is an x86 assembler that uses
the Intel syntax for MS
MS-DOS
DOS and Microsoft Windows. Beginning with MASM
MA

A.C. Patil College of Engineering www.acpce.org 13 | P a g e


Department of Computer Engineering
8.0, there are two versions of the assembler: One for 16
16-bit & 32--bit assembly
sources, and another (ML64) for 64
64-bit sources only.
• 8086 kit: 8086 Microprocessor Trainer Kit is proposed to smooth the progress of
learning and developing designs of 8086 m
microprocessor
icroprocessor from Intel. It has Facility
to connect PC’s 101/104 Keyboar
Keyboard making this kit as standalone,, User can enter
user programs in Assembly languages. User verifies the programs through LCD
or PC. User friendly Firmware confirms facilitating the beg
beginners
inners learns
operations of a microprocessor quickly.

6. Program: For this experiment we are using MASM as programming tool.

i) Addition of two 88-bit numbers

.model small
.stack 100h
.data
NUM DB 12H, 34H
SUM DB 2 DUP(0)
.code
START: MOV AX,@data
MOV DS,AX ;Initialize data segment Register
MOV AL,NUM ;First number loaded into AL
MOV AH,0H ;For carry AH register is cleared
ADD AL,NUM+1 ;Second number added with AL
JNC DOWN ;Check for carry
INC BX ;If carry generated
erated increment the AH
DOWN: MOV SUM,AL ;Storing the sum value
MOV SUM+1,AH ;Storing the carry value
INT 3H
END START
ENDS
Output:

A.C. Patil College of Engineering www.acpce.org 14 | P a g e


Department of Computer Engineering

ii) Addition of two 16


16-bit numbers

.model small
.stack 100h
.data
NUM DW 1234H, 0F234H
SUM DW 2 DUP(0)
.code
START: MOV AX,@data
MOV DS,AX ;Initialize data segment Register
MOV AX,NUM ; First number loaded into AX
MOV BX,0H ; For carry BX register is cleared
ADD AX,NUM+2 ; Second number added with AX
JNC DOWN ; Check for carry
INC BX ; If carry generated increment the BX
DOWN: MOV SUM,AX ; Storing the sum value
MOV SUM+2,BX ; Storing the carry value
INT 3H
END START
ENDS

A.C. Patil College of Engineering www.acpce.org 15 | P a g e


Department of Computer Engineering

iii) Subtraction of two 8-bit numbers

.model small
.stack 100h
.data
NUM DB 45
45H, 34H
DIFF DB 2 DUP(0)
.code
START: MOV AX,@data
MOV DS,AX ;Initialize data segment Register
MOV AL,NUM ;First number loaded into AL
MOV AH,0H ;For carry AH register is cleared
SUB AL,NUM+1 ;Second
econd number subtracted from AL
JNC DOWN ;Check for borrow
INC BX ;If borrow generated increment the AH
DOWN: MOV DIFF,AL ;Storing the sum value
MOV DIFF
DIFF+1,AH ;Storing the carry value
INT 3H
END START
ENDS

A.C. Patil College of Engineering www.acpce.org 16 | P a g e


Department of Computer Engineering

iv) Subtraction of two 16


16-bit numbers

.model small
.stack 100h
.data
NUM DW 1234H, 0234H
SUM DW 2 DUP(0)
.code
START: MOV AX,@data
MOV DS
DS,AX ;Initialize data segment Register
MOV AX,NUM ; First number loaded into AX
MOV BX,0H ; For carry BXX register is cleared
ADD AX,NUM+2 ; Second number subtracted from AX
JNC DOWN ;Check for borrow
INC BX ; If borrow generated increment the BX
DOWN: MOV SUM,AX ; Storing the sum value
MOV SUM+2,BX ; Storing the carry value
INT 3H
END START
ENDS

v) Multiplication of two 8-bit numbers

.model small
.stack 100h
.data
NUM DB 12H, 34H
PROD DB 2 DUP(0)
.code
START: MOV AX,@data
MOV DS,AX
LEA SI,NUM ;SI pointed to the Multiplicand
MOV AH, 0 ;clear AH register
MOV AL,[
AL,[SI] ;Multiplicand has to be in AL register
MOV BL,[SI+1] ;SI+2 pointed to the Multiplier and move it to BL
MUL BL ;Perform the multiplication
MOV PROD,AL ;16 bit product stored in AH-AL AL registers
MOV PROD+1, AH
INT 3H
END START
ENDS

A.C. Patil College of Engineering www.acpce.org 17 | P a g e


Department of Computer Engineering

vi) Multiplication
tiplication of two 16
16-bit numbers

.model small
.stack 100h
.data
NUM DW 1234H,1234H
PROD DW 2 DUP(0)
.code
START: MOV AX,@data
MOV DS,AX
LEA SI,NUM ;SI pointed to the Multiplicand
MOV AX,[SI] ;Multiplicand has to be in AX register
MOV BX,[SI+2] ;SI+2 pointed to the Multiplier and move it to BX
MUL BX ;Perform the multiplication
MOV PROD,AX ;32 bit product stored in DX-AX AX registers
MOV PROD+2,DX
INT 3H
END START
ENDS

vii) Division of two 88-bit numbers

.model small
.stack
stack 100h
.data
NUM1 DB 46H
NUM2 DB 11H
QUO DB 1 DUP(0)
REM DB 1 DUP(0)
.code
START: MOV AX,@data
MOV DS,AX
MOV AL,NUM1 ;Move the lower bit of Dividend to AL
MOV AH,00 ; Move the higher bit of Dividend to AH
DIV NUM2 ; Perform the Division operation
MOV QUO
QUO,AL ; Store the quotient to AL
A
MOV REM
REM,AH ; Store the reminder to AH
INT 3H
END START
ENDS

A.C. Patil College of Engineering www.acpce.org 18 | P a g e


Department of Computer Engineering

viii) Division of two 16


16-bit numbers
.model small
.stack 100h
.data
NUM1 DW 2246H
NUM2 DW 1111H
QUO DW 1 DUP(0)
REM DW 1 DUP(0)
.code
START: MOV AX,@data
MOV DS,AX
MOV AX,NUM1 ;Move the lower bit of Dividend to AX
MOV DX,00 ; Move the higher bit of Dividend to DX
DIV NUM2 ; Perform the Division operation
MOV QUO,AX ; Store the quotient to AX
MOV REM,DX ; Store the reminder to DX
INT 3H
END START
ENDS

7. Conclusion: Write conclusion in your own understanding


understanding. Do not copy
c it. Write in
four to five lines.

A.C. Patil College of Engineering www.acpce.org 19 | P a g e

You might also like