0

I am trying to code a simple program that converts the lowercase characters of a string to uppercase but I get no output at all. For example:

Input:AaBb Output:AABB

I don't know where my mistake is but anyway, My code is:

data segment
prompt db 0dh,0ah,"Your string: $"
str1 db 15 dup('$')
msg db 0dh,0ah,"Result after conversion: $"
data ends

code segment
assume cs:code,ds:data
START:
mov ax,data
mov ds,ax

mov dx,offset prompt
mov ah,09h
int 21h

mov ah,01h
lea dx,str1

read:
int 21h
mov bl,al
cmp al,0Dh
je display1
cmp al,61h
jl nexx
cmp al,7Ah
jg nexx

sub al,20h
mov [si],al
inc si
jmp read

display1:

lea dx,msg
mov ah,09h
int 21h

lea dx,str1
mov ah,09h
int 21h

mov ah,4ch
int 21h

nexx:
inc si
jmp read

code ends
end start
user3848412
  • 115
  • 3
  • 11

1 Answers1

0

You forgot to point si to str1 before getting input characters

mov ah,01h
lea dx,str1 
mov si,dx    ;point si to str1

and you forgot to save non converted uppercase characters to output string

nexx: 
mov [si],al
inc si
jmp read
rcd
  • 112
  • 1
  • 4