Created
February 5, 2016 22:03
-
-
Save abrarShariar/ec79c556793ebb11b155 to your computer and use it in GitHub Desktop.
converting lowercase char to uppercase char in a loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Convert char input in a loop (lowercase -> UPPERCASE) | |
.model small | |
.stack 100h | |
.data | |
text db 'CONVERT LOWERCASE TO UPPERCASE $' | |
low db 'Lower: $' | |
up db 'Upper: $' | |
input db ? | |
.code | |
main proc | |
mov ax,@data ;prepare data segment | |
mov ds,ax | |
mov ah,09h ;print string | |
lea dx,text | |
int 21h | |
f1: mov ah,02h ;print newline | |
mov dl,0Ah | |
int 21h | |
mov dl,0Ah | |
int 21h | |
mov dl,0Dh | |
int 21h | |
mov ah,09h ;print string | |
lea dx,low | |
int 21h | |
mov ah,01h ;input char | |
int 21h | |
mov input,al | |
mov cl,input | |
sub cl,32 ;convert to lowercase | |
mov ah,02h ;print tab | |
mov dl,09h | |
int 21h | |
mov ah,09h ;pirint string | |
lea dx,up | |
int 21h | |
mov ah,02h ;print char | |
mov dl,cl | |
int 21h | |
;newline | |
mov dl,0Ah | |
int 21h | |
mov dl,0Dh | |
int 21h | |
mov ah,01h ;exit input | |
int 21h | |
cmp al,'x' | |
je END | |
jmp f1 | |
END: mov ah,4ch ;4ch | |
int 21h | |
main endp | |
end main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment