Co Programs For Lab
Co Programs For Lab
Co Programs For Lab
D ds:0000
8 - bit Addition
DEC CL
JNZ again
MOV od, DX
MOV eve , BX
INT 3H
code ends
end start
Greatest number in list
assume cs: code ,ds: data
data segment
list db 10h,20h,30h,40h,50h
res db ?
data ends
code segment
start:
MOV AX, data
MOV DS,AX
XOR AX,AX
MOV Cl,04H
MOV SI, offset list
MOV AL,[SI]
again: CMP AL,[SI+1]
JNC next
MOV AL, [SI+1]
next: INC SI
DEC CL
JNZ again
MOV res,AL
INT 3h
code ends
end start
Smallest number in list
assume cs: code ,ds: data
data segment
list db 10h,20h,30h,40h,50h
res db ?
data ends
code segment
start:
MOV AX, data
MOV DS,AX
XOR AX,AX
MOV Cl,04H
MOV SI, offset list
MOV AL,[SI]
again: CMP AL,[SI+1]
JC next
MOV AL, [SI+1]
next: INC SI
DEC CL
JNZ again
MOV res,AL
INT 3h
code ends
end start
Factorial of a given number
assume cs: code, ds: data
data segment
n1 db 04H
Fact dw ?
data ends
code segment
start:
MOV AX,data
MOVDS,AX
MOV AL,0000H
MOV AL,n1
MOV CL,03H
L1:
MUL CL
DEC CL
JNZ L1
MOV fact,AX
INT 3H
Code ends
end start
Move string from one location to other
Assume cs:code, ds:data, es: data
data segment
Str1 db ‘sreenidhi'
Str2 db ?
data ends
code segment
start:
MOV AX,data
MOV DS,AX
MOV ES,AX
MOV CX,09H
LEA SI,str1
LEA DI,str2
CLD
REP MOVSB
INT 3
code ends
end start
Compare two strings
assume cs:code,ds:data,es:data
data segment
str1db 'CSE'
str2db 'CSE'
Res db ?
data ends
code segment
Start: MOV AX, data
MOV DS,AX
MOV ES,AX
LEA SI,str1
LEA DI,str2
MOV CX,03H
CLD
REPE CMPSB
JZ ok
MOV res,'n'
MOV res+1,'o'
JMP go
ok:MOV res,'y'
MOV res+1,'e'
MOV res+2,'s'
go: INT 03H
code ends
end start
Reverse a Given String