Skip to content

Instantly share code, notes, and snippets.

@abrarShariar
Created February 12, 2016 18:28
Show Gist options
  • Select an option

  • Save abrarShariar/4ed4541a1af5132d73c3 to your computer and use it in GitHub Desktop.

Select an option

Save abrarShariar/4ed4541a1af5132d73c3 to your computer and use it in GitHub Desktop.
inter conversion between capital and small letters (show 0 if invalid letter)
;inter conversion between capital and small letters (show 0 if invalid letter)
.model small
.stack 100h
.data
input db ?
.code
main proc
mov ax,@data
mov ds,ax
INP:
mov ah,01 ;input
int 21h
mov input,al
cmp input,'A' ;check if letter is capital
jl INVALID
cmp input,'Z'
jle BIG
cmp input,'a'
jl INVALID
cmp input,'z'
jle SMALL
jg INVALID
SMALL:
sub input,32
jmp OUTPUT
BIG:
add input,32
jmp OUTPUT
INVALID:
mov input,'0'
jmp OUTPUT
OUTPUT:
mov ah,02 ;print char
mov dl,input
int 21h
mov dl,09h ;newline
int 21h
jmp INP ;loop for input
EXIT:
mov ah,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