0% found this document useful (0 votes)
43 views7 pages

Experiment 05 EEE 3210

The document contains 8 code examples demonstrating various assembly language programming concepts in 8086 such as input/output, variables, functions, strings, loops, jumps, and arithmetic. The code shows how to get single character input, output to screen, assign values to variables in memory, call functions to display strings, use loops to iterate operations, make jumps in program flow, and perform addition of numbers.

Uploaded by

Jahedul Islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views7 pages

Experiment 05 EEE 3210

The document contains 8 code examples demonstrating various assembly language programming concepts in 8086 such as input/output, variables, functions, strings, loops, jumps, and arithmetic. The code shows how to get single character input, output to screen, assign values to variables in memory, call functions to display strings, use loops to iterate operations, make jumps in program flow, and perform addition of numbers.

Uploaded by

Jahedul Islam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Experiment 05: Assembly language programming in 8086

Code 01: Let’s start


.model small
.stack 100h
.code
Main proc
Mov ah,1
Int 21h
Mov bl,al

Mov ah,2
Mov dl,bl
Int 21h

Exit:
Mov ah,4ch
Int 21h
Main endp
End main

Code 02: Input & Output Concept

.model small
.stack 100h
.code
Main proc
Mov ah,1
Int 21h
Mov bl,al

Mov ah,1
Int 21h
Mov bh,al
Mov ah,2
Mov dl,bl
Int 21h

Mov ah,2
Mov dl,bh
Int 21h

Exit:
Mov ah,4ch
Int 21h
Main endp
End main

Code 03: Variable assign concept

.model small
.stack 100h
.data
Data1 bd 3
Data2 db ?
.code
Main proc
Mov ax, @data
Mov ds,ax

Mov ah,2
Add data1, 48
Mov dl, data1

Mov ah,1
Int 21h
Mov data2,al

Mov ah,2
Mov dl,10
Int 21h
Mov dl,13
Int 21h

Mov ah,2
Mov dl, data2
Int 21h

Exit:
Mov ah,4ch
Int 21h
Main endp
End main

Code 04: Function and String concept

.model small
.stack 100h
.data
M db ‘I love EEE, JUST $’
.code
Main proc
; 1 >> single key input
; 2 >> single character output
; 9 >> character string output

Mov ax, @data


Mov ds, ax

Mov ah,9
Lea dx, m
Int 21h

Mov ah,1
Int 21h
Mov bl,al

Mov ah,2
Mov dl,bl
Int 21h

Exit:
Mov ah,4ch
Main endp
End main

Code 05: Newline concept

.model small
.stack 100h
.code
Main proc
Mov ah,1
Int 21h
Mov bl,al

Mov ah,2
Mov dl,10
Int 21h
Mov dl, 13
Int 21h

Mov ah,1
Int 21h
Mov bh,al
Mov ah,2
Mov dl,10
Int 21h
Mov dl,13
Int 21h

Mov ah,2
Mov dl,bl
Int 21h

Mov ah,2
Mov dl,10
Int 21h
Mov dl,13
Int 21h

Mov ah,2
Mov dl,bh
Int 21h

Ext:
Mov ah, 4ch
Int 21h
Main endp
End main

Code 06: Loop concept and print A to Z


.model small
.stack 100h
.data
M db ‘I love EEE, JUST $’
.code
Main proc
; 1 >> single key input
; 2 >> single character output
; 9 >> character string output

Mov ax, @data


Mov ds, ax

Mov ah,9
Lea dx, m
Int 21h

Mov ah,2
Mov dl,10
Int 21h
Mov dl,13
Int 21h

Mov cx,26
Mov ah,2
mov dl,'A'

Level1:
Int 21h
Inc dl
Loop level1

Exit:
Mov ah, 4ch
Int 21h
Main endp
End main

Code 07: JUMP concept


.model small
.stack 100h
.data
a db ‘JUMP CONCEPT $’
b db ‘I DON’T LIKE PROGRAMMING $’
c db ‘YAA, I LIKE MACHINE LANGUAGE $’
.code
Main proc

Mov ax, @data


Mov ds, ax

Mov ah,9
Lea dx, a
Int 21h

Mov ah,2
Mov dl,10
Int 21h
Mov dl,13
Int 21h

m:
Mov ah,9
Lea dx, b
Int 21h
Jmp n

N:
Mov ah,2
Mov dl,10
Int 21h
Mov dl,13
Int 21h

Mov ah,9
Lea dx, c
Int 21h
Jmp exit

Exit:
Mov ah, 4ch
Int 21h
Main endp
End main

Code 8: Add three numbers

.model small
.stack 100h
.data
sum db ?
Main proc

Mov ax, @data


Mov ds, ax

Mov ah,1
Int 21h
Mov bl,al

Mov ah,1
Int 21h
Mov bh,al

Mov ah,1
Int 21h
Mov cl,al

Add bl,bh
Sub bl,48
Mov ch,bl
Add ch,cl
Sub ch,48
Mov sum,ch

Mov ah,2
Mov dl,sum
Int 21h

Exit:
Mov ah, 4ch
Int 21h
Main endp
End main

You might also like