0% found this document useful (0 votes)
8 views

coal assignment 3

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

coal assignment 3

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

Name:Alishba Nadeem Roll no:BSAI-168

LAB NO 4

ACTIVITY:
Code 03: Search and Replace the characters in a string.
.model small
.stack 100h
.data
msg db 'PAKISTAN$', 0
seaChar db 'S'
replaceChar db 'Z'
.code
main proc
mov ax, @data
mov ds, ax

lea si, msg


mov cx, 5

next_char:
mov al, [si]
cmp al, 0
je done
cmp al, seaChar
jne skip
mov al, replaceChar
mov [si], al

skip:
inc si
loop next_char

done:

lea dx, msg


mov ah, 9
int 21h

mov ah, 4ch


int 21h

main endp
end main
Count the ‘Even’ numbers in an array.
.model small
.stack 100h
.data
arr db 5, 8, 12, 22, 17, 44, 67, 90, 11, 2
len dw 10
count db 0
.code
main proc
mov ax, @data
mov ds, ax

lea si, arr


mov cx, len
mov bl, 0

next_num:
mov al, [si]
and al, 1
jnz skip
inc bl

skip:
inc si
loop next_num
mov count, bl

mov ah, 2
mov dl, bl
add dl, 30h
int 21h

mov ah, 4ch


int 21h

main endp

end main

You might also like