Write an assembly program to CONVERT UPPERCASE TO LOWERCASE IN A STRING

Write an assembly program to CONVERT UPPERCASE TO LOWERCASE IN A STRING
title convert uppercase to lowercase in a string
dosseg
.model small
.stack 100H
.code
main proc
mov ax, @data ; initialize ds register
mov ds, ax
mov cx, 09h ; for 9 characters including space
mov si, offset message
BACK: mov al, [si] cmp al, 41h ; compares if al = 41
jb AHEAD ; jump below ie if al < 40 cmp al, 5A ja AHEAD ; jump above ie if al > 5A
XOR al, 00100000B ; in binary or in hex 20h
mov [si], al
AHEAD: inc si
loop BACK
mov ax, 4C00H ; return to DOS
int 21H
main endp
.data
message db ‘I AM FINE’, ‘$’
end main
Visit our download section to download free simulators/ emulators and other essential engineering softwares or join the free update newsletters now.

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top