0% found this document useful (0 votes)
8 views11 pages

Assembly Program Definitions

The document contains multiple assembly language programs that perform basic arithmetic operations (addition, subtraction, multiplication, division) on 8-bit and 16-bit numbers, as well as programs for block transfer, finding the smallest number, sorting numbers, and calculating the sum of a series. Each program includes data and code segments, demonstrating how to manipulate data in assembly language. The programs utilize various assembly instructions and system interrupts for execution.

Uploaded by

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

Assembly Program Definitions

The document contains multiple assembly language programs that perform basic arithmetic operations (addition, subtraction, multiplication, division) on 8-bit and 16-bit numbers, as well as programs for block transfer, finding the smallest number, sorting numbers, and calculating the sum of a series. Each program includes data and code segments, demonstrating how to manipulate data in assembly language. The programs utilize various assembly instructions and system interrupts for execution.

Uploaded by

Sampada Patil
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

PROGRAM FOR ADDITION OF TWO 8 BIT NUMBERS

assume cs:code, ds:data


data segment
a db 09h
b db 02h
c dw ?
data ends

code segment
mov ax,data
mov ds,ax
mov al,a
mov bl,b
add al,bl
mov c,ax
int 21h
code ends
end
ASSEMBLY PROGRAM TO ADD TWO 16 BIT NUMBERS
assume cs:code, ds:data
data segment
a dw 0202h
b dw 0408h
c dw ?
data ends

code segment
mov ax,data
mov ds,ax
mov ax,a
mov bx,b
add ax,bx
mov c,ax
int 21h
code ends
end
ASSEMBLY PROGRAM TO SUBTRACT TWO 16 BIT NUMBERS
assume cs:code,ds:data
data segment
a dw 9A88h
b dw 8765h
c dw ?
data ends
code segment
mov ax,data
mov ds,ax
mov ax,a
mov bx,b
sub ax,bx
mov c,ax
int 21h
code ends
end
ASSEMBLY PROGRAM TO MULTIPLY TWO 16 BIT NUMBERS
assume ds:data, cs:code
data segment
a dw 1234h
b dw 5678h
c dd ?
data ends
code segment
mov ax,data
mov ds,ax
mov ax,a
mov bx,b
mul bx
mov word ptr c,ax
mov word ptr c+2,dx
int 21h
code ends
end
ASSEMBLY PROGRAM TO DIVIDE TWO 16 BIT NUMBERS

assume ds:data, cs:code


data segment
a dw 4444h
b dw 0002h
c dw ?
data ends
code segment
mov ax,data
mov ds,ax
mov ax,a
mov bx,b
div bx
mov c,ax
int 21h
code ends
end
PERFORMING BLOCK TRANSFER USING ASSEMBLY LANGUAGE
ASSUME CS:CODE,DS:DATA
DATA SEGMENT
STRING1 DB 01H,02H,03H,04H,05H
STRING2 DB 4 DUP(0)
DATA ENDS
CODE SEGMENT
MOV AX,DATA
MOV DS,AX
MOV ES,AX
LEA SI,STRING1
LEA DI,STRING2
MOV CX,05H
CLD
REP MOVSB
INT 21H
CODE ENDS
END
ASSEMBLY PROGRAM TO FIND SMALLEST NUMBER FROM GIVEN NUMBERS
assume cs:code, ds:data
data segment
STRING1 DB 08h,14h,05h,0Fh,09h
res db ?
data ends
code segment
mov ax, data
mov ds, ax
mov cx, 04h
mov bl, 79h
LEA SI, STRING1
up:
mov al, [SI]
cmp al, bl
jge nxt
mov bl, al
nxt:
inc si
dec cx
jnz up
mov res,bl
int 3
code ends
end
ASSEMBLY PROGRAM TO SORT NUMBERS IN ASCENDING ORDER

ASSUME CS:CODE,DS:DATA JC
DOWN
DATA SEGMENT
STRING1 DB
MOV DL,[SI+1]
99H,12H,56H,45H,36H
DATA ENDS
XCHG [SI],DL
CODE SEGMENT
MOV AX,DATA MOV [SI+1],DL
MOV DS,AX DOWN: INC SI
MOV CH,04H DEC
CL
UP2: MOV CL,04H
JNZ
LEA SI,STRING1 UP1
UP1: MOV AL,[SI] DEC
MOV BL,[SI+1] CH
CMP AL,BL JNZ
UP2
JC DOWN
INT
3
ASSEMBLY LANGUAGE PROGRAM TO FIND THE SUM OF SERIES
assume code:cs, ds:data
data segment
blk1 db 5dup(?)
res dw ?h
data ends
code segment
mov ax,data
mov ds,ax
mov cl,0ah
mov al,[si]
up: inc si
add al,[si]
jnc dn
inc ah
dn : dec cl
jnz up
mov res,ax
int 3
code ends
end

You might also like