Masm All Programes
Masm All Programes
ASM
data segment
num1 dd 12345678h
num2 dd 22221111h
num3 dw ?
data ends
code segment
assume cs:code ,ds:data
start:
mov ax,data
mov ds,ax
mov ax, word ptr[num1]
mov bx, word ptr[num1+2]
mov cx, word ptr[num2]
mov dx, word ptr[num2+2]
add ax,cx
add bx,dx
mov num3,ax
mov num3+2,bx
mov ah,4ch
int 21h
code ends
end start
2.ASM
data segment
num1 dw 0400h
num2 db 05h
qut db ?
rem db ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ax,num1
mov bl,num2
idiv bl
mov qut,al
mov rem,ah
mov ah,4ch
int 21h
code ends
end start
3.ASM
data segment
arr db 02h,01h,03h,02h,01h
res db ?
data ends
code segment
assume cs:code, ds:data
start:
mov dx,data
mov ds,dx
mov cl,04h
lea si,[arr]
lea bx,res
mov ah,4ch
int 21h
code ends
end start
ADD 8.ASM
Data segment
no1 db 25h
no2 db 23h
res dw 00h
Data ends
code segment
assume cs:code, ds:Data
Start:
Mov ax,Data
Mov ds,ax
mov al,no1
mov bl,no2
mov ah,00h
add al,bl
jnc skip
inc ah
skip:mov res,ax
And al,0f0h
mov cl,04h
ror al,cl
Add al,30h
mov ah,02h
mov dl,al
int 21h
mov ah,02h
mov dl,al
int 21h
mov ah,4ch
int 21h
code ends
end start
ADD8s.ASM
data segment
num1 db 24h
num2 db 11h
num3 db ?
data ends
code segment
assume cs:code,ds:data
start:
mov dx,data
mov ds,dx
mov al,num1
mov bl,num2
add al,bl
mov num3,al
mov ah,4ch
int 21h
code ends
end start
ADD16.ASM
data segment
num1 dw 0025h
num2 dw 0050h
num3 dw ?
data ends
code segment
assume cs:code , ds:data
start:
mov cx , data
mov ds , cx
mov ax , word ptr [num1]
mov bx , word ptr [num2]
add ax , bx
mov word ptr [num3] , ax
mov ah , 4ch
int 21h
code ends
end start
ADD16.ASM
Data Segment
No1 DB 25h
No2 DB 35h
res DB 00h
Data ENDS
Code segment
Assume CS:Code, DS:Data
Start:
Mov AX,Data Data=0b60h
Mov DS,AX DS=0b60H
Mov AL,No1
Mov BL,No2
Add AL,BL
Mov res,AL
mov ah,4ch
int 21h
code ends
end start
ADD 32.ASM
data segment
num1 dd 23h
num2 dd 27h
num3 dd ?
data ends
code segment
assume cs:code,ds:data
start:
mov dx,data
mov ds,dx
add ax,cx
add bx,dx
mov ah,4ch
int 21h
code ends
end start
ADD88.ASM
data segment
num1 db 11h
num2 db 33h
num3 db ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds, ax
mov al,num1
mov bl,num2
add al,bl
mov num3,al
mov ah,4ch
int 21h
code ends
end start
ADDI.ASM
data segment
num1 dw 0025h
num2 dw 0050h
num3 dw ?
data ends
code segment
assume cs:code,ds:data
start:
mov cx,data
mov ds,cx
mov ax,word ptr[num1]
mov bx,word ptr[num2]
add ax,bx
mov word ptr[num3],ax
mov ah,4ch
int 21h
code ends
end start
ARR12.ASM
DATA SEGMENT
str1 DB 'HEllo$'
str2 db 10 dup('$')
newline db 10,13, '$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:
mov al,[si]
cmp al,'$'
je next
inc cl
inc si
jmp back
next:
lea si,str1
Back1:
mov al,[si]
mov [di],al
inc si
inc di
dec cl
jnz Back1
END START
ASC.ASM
Data Segment
No2 DB 35h
No1 DB 22h
res DB 00h
Data ENDS
Code segment
Assume CS:Code, DS:Data
Start:
Mov AX,Data
Mov DS,AX
Mov AL,No1
Mov BL,No2
Add AL,BL
mov res,al
Mov ah,02h
Mov Dl,al
int 21h
mov ah,4ch
int 21h
code ends
end start
ASS12.ASM
DATA SEGMENT
DEC DB 99H
HEX DB ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV DX,DATA
MOV DS,DX
MOV AL,DEC
MOV AL,0FH
MOV DL,AL
MOV AL,DEC
AND AL,0F0H
MOV CL,04H
ROL AL,CL
MOV BL,0AH
MUL BL
ADD AL,DL
MOV HEX,AL
MOV AL,4CH
INT 21H
CODE ENDS
END START
BCDADD.ASM
data segment
num1 db 06H
num2 db 08H
res dw ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds, ax
MOV AH,00h
mov al,num1
mov bl,num2
ADD al,bl
DAA
JNC Skip
INC AH
SKIP :MOV res, ax
mov ah,4ch
int 21h
code ends
end start
BCDSUB.ASM
data segment
num1 db 06H
num2 db 08H
res dw ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds, ax
MOV AH,00h
mov al,num1
mov bl,num2
sub al,bl
DAS
SKIP :MOV res, ax
mov ah,4ch
int 21h
code ends
end start
BLCKWITHOUTSTR.ASM
;Write and execute Assembly language program for block tranfer without using string instruction.
Data segment
Arr1 DB 24h,25H,26H,27H,28H
Arr2 DB 11h,12H,13H,14H,15H
Data end
code segment
assume cs:code,ds:Data
start:
mov DX,Data
mov DS,DX
MOV ES,DX
LEA SI,Arr1
LEA DI,Arr2
Mov CL,05h
mov ah,4ch
int 21
code ends
end start
D001.ASM
DATA SEGMENT
NUM1 DW 1234H
NUM2 DW 5678H
RES DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV DX,DATA
MOV DS,DX
MOV AX,NUM1
MOV BX,NUM2
ADD AX,BX
MOV RES ,AX
MOV AH,4CH
INT 21H
CODE ENDS
END START
DEC.ASM
.MODEL SMALL
.STACK 100H
.DATA
PROMPT DB 'Enter a HEX digit : $\'
DECIMAL DB 'The equivalent Decimal digit is : $\'
CONTINUE DB 'Do you want to do it again : $\'
ILLEGAL DB 'Illegal Character - Enter 0..9 or A..F : $\'
NEXT_LINE DB 0DH,0AH,\"$\"
.CODE
MAIN PROC
MOV AX, @DATA ; initialize DS
MOV DS, AX
DISP.ASM
DATA SEGMENT
str1 DB 'HEllo$'
str2 db 10 dup('$')
newline db 10,13, '$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:
mov al,[si]
cmp al,'$'
je next
inc cl
inc si
jmp back
next:
lea si,str1
Back1:
mov al,[si]
mov [di],al
inc si
inc di
dec cl
jnz Back1
END START
DIV16.ASM
;Write and execute Assembly language program for unsigned division of two 16/8 bit nos.
Data segment
no1 dw 2500h
no2 db 23h
que db 00h
rem db 00h
Data ends
code segment
assume cs:code, ds:Data
Start:
Mov ax,Data
Mov ds,ax
mov ax,no1
mov bl,no2
div bl
mov que,al
mov rem,ah
mov ah,4ch
int 21h
code ends
end start
DIV32.ASM
Data segment
no1 dd 2500h
no2 dw 0300h
que dw 00h
rem dw 00h
Data ends
code segment
assume cs:code, ds:Data
Start:
Mov ax,Data
Mov ds,ax
div bx
mov que,ax
mov rem,dx
mov ah,4ch
int 21h
code ends
end start
EVEN.ASM
;Write and execute Assembly language program for finding no of Even numbers from the given array.
DATA SEGMENT
arr1 DB 25h,20h,27h,21h,19h
msg1 db "The total Even Nos are:$"
even1 db 00H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:mov al,[si]
ror al,01h
jc skip
inc bl
skip:inc si
loop back
mov ah,09h
lea dx,msg1
int 21h
mov even1,bl
mov dl,bl
and dl,0f0H
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,even1
and dl,0fH
add dl,30h
mov ah,02h
int 21h
END START
EVEN.ASM
;Write and execute Assembly language program for find whether the given no is Even or Odd .
DATA SEGMENT
no1 DB 36h
msg1 db "The given no is Even:$"
msg2 db "The given no is Odd:$"
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:mov al,no1
ror al,01h
jc skip
mov ah,09h
lea dx,msg1
int 21h
jmp exit
skip:mov ah,09h
lea dx,msg2
int 21h
exit:MOV AH, 4CH ; return control to DOS
INT 21H
CODE ENDS
END START
FNEG.ASM
;Write and execute Assembly language program for finding whether the -neg or +ve.
DATA SEGMENT
no1 DB -36h
msg1 db "The given no is -ve:$"
msg2 db "The given no is +ve:$"
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:mov al,no1
rol al,01h
jnc skip
mov ah,09h
lea dx,msg1
int 21h
jmp exit
skip:mov ah,09h
lea dx,msg2
int 21h
END START
ADD.ASM
data segment
arr1 db 10h,54h,87h,78h,43h,98h,34h,12h,87h,34h
arr2 db 54h,87h,98h,32h,09h,87h,54h,34h,98h,76h
arr3 db ?
data ends
code segment
assume cs:code,ds:data
start:
mov dx,data
mov ds,dx
mov cl,05h
lea si,arr1
lea di,arr2
lea bx,arr3
up:mov al,[si]
mov dl,[di]
add al,dl
mov[bx],al
inc si
inc di
inc bx
dec cl
jnz up
mov ah,4ch
int 21h
code ends
end start
LARGEST.ASM
;Write and execute Assembly language program for sort the given array.
DATA SEGMENT
arr1 DB 25h,20h,27h,21h,19h
msg1 db "The sorted array is:$"
msg2 db 10,13,"$"
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
mov ch,04H
up:mov al,[si]
inc si
cmp al,[si]
jnc skip
mov dl,[si]
mov [si],al
dec si
mov [si],dl
inc si
skip:dec ch
jnz up
dec cl
jnz up1
mov ah,09h
lea dx,msg1
int 21h
mov ah,09h
lea dx,msg2
int 21h
mov bx,05h
lea si,arr1
back:mov dl,[si]
and dl,0f0H
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,[si]
and dl,0fH
add dl,30h
mov ah,02h
int 21h
mov ah,09h
lea dx,msg2
int 21h
inc si
dec bx
jnz back
END START
MUL8.ASM
Data Segment
No1 Db 25h
No2 Db 05h
res Dw 0000h
Data ENDS
Code segment
Assume CS:Code, DS:Data
Start:
Mov AX,Data Data=0b60h
Mov DS,AX DS=0b60H
Mov AL,No1
mov bl,No2
mul bl
mov res,ax
mov ah,4ch
int 21h
code ends
end start
NEG.ASM
;Write and execute Assembly language program for finding no of -ve numbers from the given array.
DATA SEGMENT
arr1 DB 25h,-20h,27h,-21h,19h
msg1 db "The total +ve Nos are:$"
neg1 db 00H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:mov al,[si]
rol al,01h
jc skip
inc bl
skip:inc si
loop back
mov ah,09h
lea dx,msg1
int 21h
mov neg1,bl
mov dl,bl
and dl,0f0H
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,neg1
and dl,0fH
add dl,30h
mov ah,02h
int 21h
END START
NUMONES.ASM
;Write and execute Assembly language program for finding whether the -neg or +ve.
DATA SEGMENT
no1 DB 37h
msg1 db 10,13,"The number of ones are:$"
msg2 db 10,13,"The number of zeross are:$"
ones db 00h
zeros db 00h
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
mov cx,08h
mov bl,00h ;for ones
mov bh,00h ;for zeros
mov al,no1
back:rol al,01h
jnc skip
inc bl
jmp next
skip:inc bh
next:loop back
mov ah,09h
lea dx,msg1
int 21h
mov ones,bl
mov dl,bl
and dl,0f0h
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,ones
and dl,0fh
add dl,30h
mov ah,02h
int 21h
mov ah,09h
lea dx,msg2
int 21h
mov zeros,bh
mov dl,bl
and dl,0f0h
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,zeros
and dl,0fh
add dl,30h
mov ah,02h
int 21h
END START
ODD.ASM
;Write and execute Assembly language program for finding no of oddn numbers from the given array.
DATA SEGMENT
arr1 DB 25h,20h,27h,21h,19h
msg1 db "The total Even Nos are:$"
odd1 db 00H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:mov al,[si]
ror al,01h
jnc skip
inc bl
skip:inc si
loop back
mov ah,09h
lea dx,msg1
int 21h
mov odd1,bl
mov dl,bl
and dl,0f0H
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,odd1
and dl,0fH
add dl,30h
mov ah,02h
int 21h
END START
PR11.ASM
data segment
srcstr db 'computer$'
strrev db 50 dup(0)
len db ?
counts db 'src string :'s',10,13
data ends
code segment
assume cs:code,ds:data
mov dx,data
mov ds,data
back:lea si,srcstr
mov al,[si]
cmp al $
je exit
inc si
inc counts
jmp back
exit:
back2:lea di,strrev
dec counts
jz back1
mov al,[si]
mov [di],al
jmp back2
back1:
mov ah,09h
mov dx,meg1
int 21h
mov ah 09h
mov dx,meg2
int 21h
mov ah 09h
mov dx,strrev
int 21h
end data
ROLL NO = 07
BATCH =A
*****************************************
DATA SEGMENT
NO1 DD 00000020H
NO2 DW 0010H
QUE DW ?
REM DW ?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV DX,DATA
MOV DS,DX
MOV BX,NO2
DIV BX
MOV QUE,AX
MOV REM,DX
MOV AH,4CH
INT 21H
CODE ENDS
END START
**********************************************
*********************************************
PST2.ASM
data segment
num1 dw -0300h
num2 db 10h
qut db ?
rem db ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ax,num1
mov bl,num2
idiv bl
mov qut,al
mov rem,ah
mov ah,4ch
int 21h
code ends
end start
MOV AH,4CH
INT 21H
Code Ends
End Start
REVSTR.ASM
DATA SEGMENT
str1 DB "String$"
rev dB 10 dup('$')
msg1 db "The revers String is:$"
msg2 db 10,13,"$"
len1 db 00h
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
mov es,ax
call len11
mov len1,cl
up:dec si
MOV al,[si]
mov [di],al
inc di
dec cl
jnz up
lea dx,str1
Mov ah,09h
int 21h
lea dx,msg2
Mov ah,09h
int 21h
lea dx,msg1
Mov ah,09h
int 21h
lea dx,rev
Mov ah,09h
int 21h
len11 proc
back:
mov al,[si]
cmp al,'$'
je next
inc si
inc cl
jmp back
next:ret
len11 endp
CODE ENDS
END START
;cm1:1,11,12,15,23,28,29,35,43,44,45,55
;cm2:1,2,3,4,6,7,13,15,17,20,25,27,28,31,37,44,50,51,54,56,61,66,69,71,73,74
DAA.ASM
data segment
no1 dd 20,34h
no2 dd 47h,56h
res dd ?
data ends
code segment
assume cs:code,ds:data
start:
mov dx,data
mov ds,dx
mov ax,no1
mov bx,no2
add ax,bx
daa
mov result,ax
mov ah,4ch
int 21h
ends data
start end
Code segment
Assume CS:Code, DS:Data
Start:
Mov AX,Data
Mov DS,AX
Mov Ax,No1
mov bx,No2
imul bx
mov ah,4ch
int 21h
code ends
end start
SMALL NO.ASM
;Write and execute Assembly language program for finding small number from the given array.
DATA SEGMENT
arr1 DB 25h,20h,27h,21h,19h
small db 00H
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:
inc si
cmp al,[si]
jc skip
mov al,[si]
skip:loop back
mov small,al
mov dl,al
and dl,0f0H
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,small
and dl,0fH
add dl,30h
mov ah,02h
int 21h
END START
SORT.ASM
;Write and execute Assembly language program for finding large number from the given array.
DATA SEGMENT
arr1 DB 25h,20h,27h,21h,19h
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
back:
inc si
cmp al,[si]
jnc skip
mov al,[si]
skip:loop back
mov ah,09h
lea dx,msg1
int 21h
mov large,al
mov dl,al
and dl,0f0H
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,large
and dl,0fH
add dl,30h
mov ah,02h
int 21h
END START
SORTING.ASM
;Write and execute Assembly language program for sort the given array in descending order .
DATA SEGMENT
arr1 DB 25h,20h,27h,21h,19h
msg1 db "The sorted array is:$"
msg2 db 10,13,"$"
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
up1:lea si,arr1
mov ch,04H
up:mov al,[si]
inc si
cmp al,[si]
jnc skip
mov dl,[si]
mov [si],al
dec si
mov [si],dl
inc si
skip:dec ch
jnz up
dec cl
jnz up1
mov ah,09h
lea dx,msg1
int 21h
mov ah,09h
lea dx,msg2
int 21h
mov bx,05h
lea si,arr1
back:mov dl,[si]
and dl,0f0H
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,[si]
and dl,0fH
add dl,30h
mov ah,02h
int 21h
mov ah,09h
lea dx,msg2
int 21h
inc si
dec bx
jnz back
DATA SEGMENT
arr1 DB 25h,20h,27h,21h,19h
msg1 db "The sorted array is:$"
msg2 db 10,13,"$"
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
up1:lea si,arr1
mov ch,04H
up:mov al,[si]
inc si
cmp al,[si]
jnc skip
mov dl,[si]
mov [si],al
dec si
mov [si],dl
inc si
skip:dec ch
jnz up
dec cl
jnz up1
mov ah,09h
lea dx,msg1
int 21h
mov ah,09h
lea dx,msg2
int 21h
mov bx,05h
lea si,arr1
back:mov dl,[si]
and dl,0f0H
mov cl,04h
ror dl,cl
add dl,30h
mov ah,02h
int 21h
mov dl,[si]
and dl,0fH
add dl,30h
mov ah,02h
int 21h
mov ah,09h
lea dx,msg2
int 21h
inc si
dec bx
jnz back
END START
STR.ASM
DATA SEGMENT
STR1 DB "ENTER FIRST STRING HERE ->$"
STR2 DB "ENTER SECOND STRING HERE ->$"
STR11 DB "FIRST STRING : ->$"
STR22 DB "SECOND STRING: ->$"
INSTR1 DB 20 DUP("$")
INSTR2 DB 20 DUP("$")
NEWLINE DB 10,13,"$"
N DB ?
S DB ?
MSG1 DB "BOTH STRING ARE SAME$"
MSG2 DB "BOTH STRING ARE DIFFERENT$"
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA SI,INSTR1
LEA DI,INSTR2
;GET STRING
MOV AH,09H
LEA DX,STR1
INT 21H
MOV AH,0AH
MOV DX,SI
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,09H
LEA DX,STR2
INT 21H
MOV AH,0AH
MOV DX,DI
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,09H
LEA DX,STR11
INT 21H
MOV AH,09H
LEA DX,INSTR1+2
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,09H
LEA DX,STR22
INT 21H
MOV AH,09H
LEA DX,INSTR2+2
INT 21H
MOV AH,09H
LEA DX,NEWLINE
INT 21H
;STRING COMPARISION
MOV BX,00
MOV BL,INSTR1+1
MOV BH,INSTR2+1
CMP BL,BH
JNE L1
ADD SI,2
ADD DI,2
MOV AH,09H
LEA DX,MSG1
INT 21H
JMP L5
L1:MOV AH,09H
LEA DX,MSG2
INT 21H
L5:
MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
STR COMPARE.ASM
;Write and execute Assembly language program for compare two string using string instruction.
DATA SEGMENT
str1 DB "Hello$"
str2 dB "Welcome$"
msg1 db 10,13, "Strings are Equal:$"
msg2 db 10,13,"Strings are not equal:$"
len1 db 00h
len2 db 00h
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
mov ES,AX ; initialize ES
back:
mov al,[si]
cmp al,'$'
je next
inc si
inc cl
jmp back
next:mov len1,cl
lea si, str1
cld
repe cmpsb
jne next1
lea dx,msg1
Mov ah,09h
int 21h
jmp exit
next1:lea dx,msg2
Mov ah,09h
int 21h
END START
STR COMPARE1.ASM
;Write and execute Assembly language program for compare two string using string instruction.
Data Segment
str1 db "Hello$"
str2 db "Hello$"
msg1 db 10,13,"Strings are Equal:$"
msg2 db 10,13,"Strings are not Equal:$"
Data Ends
Code segment
assume cs:code, Ds:Data
Start:
Mov dx,Data
mov ds,dx
mov es,dx
lea si,str1
lea di,str2
mov cx,00h
next:lea si,str1
cld
repe cmpsb
jne next1
mov ah,09h
lea dx,msg1
int 21h
jmp exit
next1:
mov ah,09h
lea dx,msg2
int 21h
exit:mov ah,4ch
int 21h
code ends
end start
STR CON.ASM
DATA SEGMENT
str1 DB "String$"
str2 dB "Hello$"
Cont db 25 dup('$')
msg1 db 10,13, "$"
len1 db 00h
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
mov es,ax
next:mov al,[di]
cmp al,'$'
je next1
mov al,[di]
mov [bx],al
inc bx
inc di
jmp next
next1:
lea dx,str1
Mov ah,09h
int 21h
lea dx,msg1
Mov ah,09h
int 21h
lea dx,str2
Mov ah,09h
int 21h
lea dx,msg1
Mov ah,09h
int 21h
lea dx,cont
Mov ah,09h
int 21h
END START
STRCPYT.ASM
DATA SEGMENT
str1 DB "String$"
str2 dB 10 dup('$')
msg1 db "String is coppied:$"
msg2 db 10,13,"$"
len1 db 00h
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
mov es,ax
back:
mov al,[si]
cmp al,'$'
je next
inc si
inc cl
jmp back
next:mov len1,cl
mov si, offset str1
cld
rep movsb
lea dx,str1
Mov ah,09h
int 21h
lea dx,msg2
Mov ah,09h
int 21h
lea dx,msg1
Mov ah,09h
int 21h
lea dx,str2
Mov ah,09h
int 21h
END START
SRE LEN.ASM
DATA SEGMENT
str1 DB "String$"
str2 dB 10 dup('$')
msg1 db "String is coppied:$"
msg2 db 10,13,"$"
len1 db 00h
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA ; initialize DS
MOV DS, AX
mov es,ax
back:
mov al,[si]
cmp al,'$'
je next
inc si
inc cl
jmp back
next:mov len1,cl
mov si, offset str1
back1:
mov al,[si]
mov [di],al
inc si
inc di
dec cl
jnz back1
lea dx,str1
Mov ah,09h
int 21h
lea dx,msg2
Mov ah,09h
int 21h
lea dx,msg1
Mov ah,09h
int 21h
lea dx,str2
Mov ah,09h
int 21h
END START
BCD.ASM
data segment
num1 db 0012h
num2 db 0013h
res db ?
data ends
code segment
assume cs:code,ds:data
start:mov ax,data
mov ds,ax
mov al,num1
mov bl,num2
add al,bl
daa
mov res,al
mov ah,4ch
int 21h
code ends
end start
PTR
data segment
num1 dd 11253467h
num2 dd 00130000h
res dd ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ax,word ptr[num1]
mov bx,word ptr[num1+2]
mov cx,word ptr[num2]
mov dx,word ptr[num2+2]
add ax,cx
add bx,dx
mov word ptr[res],ax
mov word ptr[res+2],bx
mov ah,4ch
int 21h
code ends
end start