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

20BCE2442 MICRO LAB DA-2

Uploaded by

Akhil Ac
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)
8 views

20BCE2442 MICRO LAB DA-2

Uploaded by

Akhil Ac
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/ 6

VIT – School of Computer Science and Engineering

(SCOPE)
Winter Semester 2021-2022
Digital Assessment-02

Name: AC AKHIL RAVINDRAN


Reg no. 20BCE2442
Course Name : MICROPROCESSOR AND INTERFACING
Course Code : CSE2006
Slot : L11+L12
1. Verify the given string is Palindrome or not without using assembler directives.

Ex string: MALAYALAM

CODE:
m1:
s db 'MALAYALAM'
s_size = $ - m1
db 0Dh,0Ah,'$'

start:

; first let's print it:


mov ah, 9
mov dx, offset s
int 21h

lea di, s
mov si, di
add si, s_size
dec si ; point to last char!

mov cx, s_size


cmp cx, 1
je is_palindrome ; single char is always palindrome!

shr cx, 1 ; divide by 2!

next_char:
mov al, [di]
mov bl, [si]
cmp al, bl
jne not_palindrome
inc di
dec si
loop next_char

is_palindrome:
; the string is "palindrome!"
mov ah, 9
mov dx, offset msg1
int 21h
jmp stop

not_palindrome:
; the string is "not palindrome!"
mov ah, 9
mov dx, offset msg2
int 21h
stop:

; wait for any key press:


mov ah, 0
int 16h

ret

msg1 db " this is palindrome!$"


msg2 db " this is not a palindrome!$"

OUTPUT:
2. WAP to arrange the given numbers in descending order. [Assume 10 no’s]

CODE:

org 100h

MOV [3000H],25H

MOV [3001H],15H

MOV [3002H],45H

MOV [3003H],35H

MOV [3004H],55H

MOV [3005H],75H

MOV [3006H],10H

MOV [3007H],20H

MOV [3008H],90H

MOV [3009H],65H

MOV SI,3000H

MOV DX,3001H

MOV CH,09H

Back1:MOV CL,CH

MOV DI,DX

Back: MOV AL,[SI]


MOV BL,[DI]

CMP AL,BL

JNC Next

MOV [SI], BL

MOV [DI],AL

Next: INC DI

DEC CL

JNZ Back

INC SI

INC DX

DEC CH

JNZ Back1

ret
OUTPUT:

You might also like