print macro msg
lea dx,msg
mov ah,09h
int 21h
endm
.model small
.stack 100h
.data
s1 db 10,13,'1.to upper $'
s2 db 10,13,'2.to lower $'
msg1 db 10,13,'Enter the string $'
msg2 db 10,13,'Enter your option(1 or 2): $'
msg3 db 10,13,'Case converted string $'
msg4 db 10,13,'Invalid option $'
s3 db 50 dup('$')
.code
mov ax,@data
mov ds,ax
print msg1
mov cl,00
lea si,s3
loop1:mov ah,01h
int 21h
cmp al,0dh
jz loop2
mov [si],al
inc si
inc cl
jmp loop1
loop2:mov bl,cl
lea si,s3
print s1
print s2
print msg2
mov ah,01h
int 21h
sub al,30h
cmp al,01
je upper
cmp al,02
je lower
print msg4
jmp stop
upper:mov al,[si]
cmp al,61h
jc loop7
cmp al,7ah
jnc loop7
sub al,20h
loop7:mov [si],al
inc si
dec cl
jnz upper
jmp loop6
lower:mov al,[si]
cmp al,41h
jc loop8
cmp al,5ah
jnc loop8
add al,20h
loop8:mov [si],al
inc si
dec cl
jnz lower
loop6:print msg3
print s3
stop:mov ah,4ch
int 21h
end
No comments:
Post a Comment